forked from chenkaie/Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVivotekbot.sh
executable file
·50 lines (42 loc) · 1.81 KB
/
Vivotekbot.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
#!/bin/sh
#This is a Vivotekbot (similar to Googlebot), to automatically request something from camera!
echo -n "Network-Camera login:"
read username
echo -n "Password:"
read password
echo -n "Camera IP Address:"
read ipaddr
#$RANDOM -> /dev/random (0~32767)
declare -i randomNumber
cgi_array=(system network ipfilter ddns videoin image motion security privacymask event server media recording ircutctrl capability layout)
wagpage_array=(system security https network ddns accesslist video motin tampering homelayout application recording syslog parafile maintain)
# get length of an array
#echo "${#cgi_array[@]}"
#echo "${#wagpage_array[@]}"
RandomSleep()
{
#let randomNumber belong to 0~60
randomNumber=$RANDOM*60/32767
echo "sleep $randomNumber"
randomNumber=1
sleep $randomNumber
}
while [ 1 ]
do
#Get a video.jpg
echo "GET: /cgi-bin/viewer/video.jpg"
curl -u $username:$password http://$ipaddr/cgi-bin/viewer/video.jpg -o /dev/null > /dev/null 2>&1 &
RandomSleep
#Get a cgi command
ranNumCgi=$RANDOM*${#cgi_array[@]}/32767
echo "CGI: /cgi-bin/admin/getparam.cgi?${cgi_array[$ranNumCgi]}"
curl -u $username:$password http://$ipaddr/cgi-bin/admin/getparam.cgi?${cgi_array[$ranNumCgi]} -o /dev/null > /dev/null 2>&1 &
#echo "curl -u $username:$password http://$ipaddr/cgi-bin/admin/getparam.cgi?${cgi_array[$ranNumCgi]} -o /dev/null > /dev/null 2>&1 &"
RandomSleep
#Get a webpage.html
ranNumWebpage=$RANDOM*${#wagpage_array[@]}/32767
echo "GET: /setup/${wagpage_array[$ranNumWebpage]}.html"
curl -u $username:$password http://$ipaddr/setup/$wagpage_array[$ranNumWebpage].html -o /dev/null > /dev/null 2>&1 &
#echo "curl -u $username:$password http://$ipaddr/setup/${wagpage_array[$ranNumWebpage]}.html -o /dev/null > /dev/null 2>&1 &"
RandomSleep
done