-
Notifications
You must be signed in to change notification settings - Fork 10
/
start_recscr.sh
executable file
·79 lines (61 loc) · 1.63 KB
/
start_recscr.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#/bin/bash
##### (Cosmetic) Colour output
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
BLUE="\033[01;34m" # Heading
BOLD="\033[01;01m" # Highlight
RESET="\033[00m" # Normal
chk_scrot=$(dpkg -l | grep "scrot")
if [ "$chk_scrot" ]; then
#echo -e "${YELLOW} Screen Capture Started. ${RESET}"
path1="$PWD/scr_cap.sh"
echo -e "${YELLOW}The screenshots will be saved at :" "/tmp/$(date '+%d-%b-%Y') ${RESET}"
#echo -e "The screen capture will start in about: " $varr "Seconds"
#CRON="*/1 * * * * $path1"
# pentest : limit screenshot from 9:00 to 18:00
#CRON="*/1 09-18 * * * $path1"
#cat <(crontab -l |grep -v "${CRON}") <(echo "${CRON}") | crontab -
#CRON=" "
count=1
# frequency in seconds
#freq=10
freq="$1"
while [ $count -le 60 ]
do
if [ $count -eq 1 ]
then
CRON="* * * * * $path1"
# For pentest engagement : Capture only between 09:00 and 18:00
# CRON="* 09-18 * * * $path1"
count=$(( count+freq ))
else
# For pentest engagement : Capture only between 09:00 and 18:00
# CRON="* 09-18 * * * sleep $count; $path1"
CRON="* * * * * sleep $count; $path1"
count=$(( count+freq ))
fi
cat <(crontab -l |grep -v "${CRON}") <(echo "${CRON}") | crontab -
CRON=" "
done
var1=$(echo $(date '+%S'))
var2='60'
varr="$((var2 - var1))"
cc=$((varr/freq))
while [ $cc != 0 ]
do
sleep $freq 2>/dev/null
chkscr=" "
chkscr=$(crontab -l | grep "scr_cap")
if [ "$chkscr" ]; then
cc=$((cc-1))
bash $PWD/scr_cap.sh
else
:
exit
fi
done &
else
:
echo -e "${RED}[*] You need to install scrot. apt-get install scrot ${RESET}"
fi