-
Notifications
You must be signed in to change notification settings - Fork 1
/
shodancidr.sh
74 lines (62 loc) · 2.4 KB
/
shodancidr.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
#!/bin/bash
echo -e "
▄▄▄▄▄ ▄ █ ████▄ ██▄ ██ ▄ ▄█▄ ▄█ ██▄ █▄▄▄▄
█ ▀▄ █ █ █ █ █ █ █ █ █ █▀ ▀▄ ██ █ █ █ ▄▀
▄ ▀▀▀▀▄ ██▀▀█ █ █ █ █ █▄▄█ ██ █ █ ▀ ██ █ █ █▀▀▌
▀▄▄▄▄▀ █ █ ▀████ █ █ █ █ █ █ █ █▄ ▄▀ ▐█ █ █ █ █
█ ███▀ █ █ █ █ ▀███▀ ▐ ███▀ █
▀ █ █ ██ ▀
▀
SALAH BENTAYEB V1.0
---------------------------------------------------------------
"
api=
echo "Testing API Key ..."
if [[ -z "$api" ]];then
echo
echo -e "Please add API KEY for Shodan !"
exit
fi
#Color
green='\033[0;32m'
red='\033[0;31m'
NC='\033[0m'
#Testing API
test="$(nmap -sn -Pn -n --script shodan-api --script-args shodan-api.target=8.8.8.8,shodan-api.apikey=$api)"
if echo $test | grep "Error: Your ShodanAPI key"; then
echo -e "${red}Your shodanAPI Key is invalide !{NC}"
exit
fi
target=$1
founded=""
echo -n "you want to analyze for the whole range / 24? [Y/n]: "
read response
if [[ $response == "n" ]]; then
result="$(nmap -sn -Pn -n --script shodan-api --script-args shodan-api.target=$target,shodan-api.apikey=$api)"
if echo $result | grep "|_shodan-api: Shodan done: 1 hosts up" ;then
echo -e "${green}[${target}] IP found in database of Shodan${NC}"
echo -e "${result}"
echo "$result" >> shodancidr.txt
else
echo -e "${red}[${target}] IP Not found in the database of Shodan${NC}"
fi
exit
fi
baseip=`echo $target | cut -d"." -f1-3`
for ((i=1;i<255;i++));do
ip=$baseip"."$i
echo "Scan start for $baseip.$i"
result="$(nmap -sn -Pn -n --script shodan-api --script-args shodan-api.target=$ip,shodan-api.apikey=$api)"
if echo $result | grep "|_shodan-api: Shodan done: 1 hosts up" ;then
$founded="${founded} \n ${result}"
echo -e "${green}[${ip}] IP found in database of Shodan${NC}"
echo -e "${result}"
else
echo -e "${red}[${ip}] IP Not found in the database of Shodan${NC}"
fi
for ((x = 0; x < 30; x++)); do
printf %s -
done
echo
done
echo "$founded" >> shodancidr.txt