-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto-enum
55 lines (52 loc) · 1.2 KB
/
auto-enum
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
#!/bin/bash
if [ "$1" = "-h" ]
then
echo '
# $1 - List of IPs or "<ip1> <ip2>"
# $2 - base name to save the output files
# $3 - commands to run in quotes
#echo "use {} to replace ip argument"
#echo "example: nmap {} -p 139,445 -vv --script=smb-vuln-ms10-061.nse,smb-vuln-ms17-010.nse --min-rate=500 -Pn"
#echo "example: enum4linux -d -a {}"
'
exit
fi
SAVENAME=$2
path=$(pwd)
COMMANDS=$3
function run (){
new_commands=$(echo $COMMANDS | sed "s/{}/$ip/")
NEWFILE=$path/$ip/$SAVENAME.txt
echo "===============================================" | tee $NEWFILE
echo "===============================================" | tee -a $NEWFILE
echo ""
echo "IP: $ip" | tee -a $NEWFILE
echo "SAVEFILE: $NEWFILE"
echo "COMMAND: $new_commands" | tee -a $NEWFILE
echo "" | tee -a $NEWFILE
$new_commands | tee -a $NEWFILE
echo ""
echo ""
echo "==============================================="
echo "==============================================="
echo ""
}
makedirs $1
rm FILE 2> /dev/null
if [[ ! -f $1 ]]
then
#echo "$1 is not a file!"
mkfifo FILE
echo -n $1 > FILE &
for ip in $(cat FILE)
do
run $ip
done
else
FILE=$1
for ip in $(cat $FILE)
do
run $ip
done
fi
rm FILE 2> /dev/null