-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathscanScript_1.sh
57 lines (42 loc) · 1.36 KB
/
scanScript_1.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
#! /bin/bash
scan (){
if [ ${#} -eq 2 ];then
for i in $(cat $1);do
echo "****************************" >> XConnection.txt
echo "*Scanning $2-Rank @ $(date)*" >> XConnection.txt
echo "****************************" >> XConnection.txt
if [ $(ping -c5 $i|grep "64 bytes from" |wc -l) -ge 1 ];then
# If server is pingable Start Scan
#Create Directory for each IP Address
baseFile="/root/Desktop/target/nmap_"$2"-Rank/"
mkdir -p $baseFile
ipBase="$(echo $i|tr '.' '_')"
filePath=$baseFile$ipBase"_logs"
echo $filePath
mkdir -p $filePath
#Enter working Directory
cd $filePath
echo "**************************************************">>$ipBase"_log.txt"
echo "*[+] Scan S-Rank $(date) *" >> $ipBase"_log.txt"
echo "**************************************************">>$ipBase"_log.txt"
cat $ipBase"_log.txt"
echo "--------------------------------"
echo "[+]Scanning $i ..." ;
tail -f $ipBase"_log.txt" &
nmap -sV -sS -sC --traceroute -T3 --reason --open -v -A $i -oX $ipBase"_scan.xml" -oA $ipBase"_xlog.txt"
echo "---------------------------------"
#clear
#Exit from Old working directory
cd ..
else
echo "*************************************************************"
echo "- $i doesn't reply to my ping @ $(date) -" >> ../XConnection.txt
fi
done
else
echo "Usage $0 hostIPAddressesListFile {S|C|N} "
fi
}
collect (){
}
}