-
Notifications
You must be signed in to change notification settings - Fork 2
/
vulnscan.tmp
73 lines (71 loc) · 1.99 KB
/
vulnscan.tmp
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
#!/bin/bash
# Module Header
MODULENAME="VulnScan"
MODULEVERS="0.14"
MODULECRED="REDD"
modcreds;
# End of Module Header
LOGDIR="$HOMEDIR/loot"
VULNLOG="$LOGDIR/vulnlog.txt"
TMPLOG="/tmp/netuplog.txt"
TMPLOG2="/tmp/netuplog2.txt"
DBGIP=""
mkdir -p $LOGDIR
if [ -f "$VULNLOG" ]; then
rm -rf $VULNLOG
fi
plswait(){
pid=$! ; i=0
while ps -a | awk '{print $1}' | grep -q "${pid}"
do
c=`expr ${i} % 4`
case ${c} in
0) printf '%s\b' '\' ;;
1) printf '%s\b' '|' ;;
2) printf '%s\b' '/' ;;
3) printf '%s\b' '-' ;;
esac
i=`expr ${i} + 1`
sleep .25
done
wait ${pid}
ret=$?
}
nmapscancommon(){
printf " Running Vuln scan for Subnet - $SUBNET \n"
printf " DO NOT EXIT OR CRTL+C! PROCESSES ARE\n"
printf " STILL RUNNING!!!\n"
printf "\n"
printf " Note: Scan can take 5-15 mins depending on speed of Network.\n"
printf "\n"
printf " Please Wait ... "
echo -e "Results of $SUBNET:" > $VULNLOG
if [ ! -f "$TMPLOG" ]; then
touch $TMPLOG;
fi
if [ ! -f "$TMPLOG2" ]; then
touch $TMPLOG2;
fi
if [ -z "$DBGIP" ]; then
nmap -sV --script=vuln --script-args=vulns.short --open $SUBNET -p21-445 > $TMPLOG
else
nmap -sV --script=vuln --script-args=vulns.short --open $DBGIP -p21-445 > $TMPLOG
fi
grep -P 'scan report for|tcp open|tcp open|VULNERABLE[^"]*' $TMPLOG > $TMPLOG2
sed -i 's/Nmap scan report for /\n\nPort Scan Analysis for /g' $TMPLOG2
sed -i 's/^|_ / ->/g' $TMPLOG2
# sed -i 's/.tcp open.*/ Port Analysis: - OPEN/g' $TMPLOG2
# sed -i 's/.tcp open.*/ Port Analysis: - OPEN/g' $TMPLOG2
cat $TMPLOG2 > $VULNLOG
if [ -f "$TMPLOG" ]; then
rm -rf $TMPLOG;
fi
if [ -f "$TMPLOG2" ]; then
rm -rf $TMPLOG2;
fi
}
(nmapscancommon; /bin/false) &
plswait;
echo -e ""
cat $VULNLOG
echo -e ""