forked from xx0hcd/python_scripts
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoolwrapper.py
More file actions
Latest commit
92 lines (77 loc) · 2.38 KB
/
Copy pathtoolwrapper.py
File metadata and controls
92 lines (77 loc) · 2.38 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/python
#./toolwrapper.py - xx0hcd
#Tool to scan multiple hosts from a list (mostly for if the tool doesn't support multiple hosts :))
#Tool must already be installed!
#If tool has arguments, enclose in quotes. i.e. './toolwrapper.py -t 'nbtscan -r' -f target_file.txt'
#If the tool supports writing use it in the quotes, if not for now redirect to stdout via '>' etc.
importos
importsys
importgetopt
defcmds(argv):
whileTrue:
try:
f=open(hostfile, "rb")
list=f.readlines()
f.close()
break
exceptValueError:
print"Error with file, I should probably write something that checks if the file exists and append a number to the end of the file name or something... "
forwordinlist:
cmd=tool+' '+word
os.system(cmd)
defmain(argv):
globaltool
globalhostfile
tool=''
hostfile=''
try:
opts, args=getopt.getopt(argv, "ht:f:",["tool=","hostfile="])
exceptgetopt.GetoptError:
print"[-] "
print"[-] "
print"[+] "
print"[+] -t, --tool Name of tool with arguements to use. "
print"[+] "
print"[+] -f, --hostfile Name of taget host file to use. "
print"[+] "
sys.exit(2)
foropt, arginopts:
ifopt=='-h':
print"[+] "
print"[+] Help Options: "
print"[+] "
print"[+] -t, --tool Name of tool to run. "
print"[+] Enclose command and argument with quotes. "
print"[+] i.e. './toolwrapper.py -t 'nbtscan -r' -f target_hostfile.txt'"
print"[+] "
print"[+] -f, --hostfile Name of file that conatins targets. "
print"[+] "
print"[+] Example: ./toolwrapper.py -t 'ping -c 1' -f targetlist.txt. "
print"[+] "
print"[+] Example: ./toolwrapper.py -t 'snmp-check' -f targetlist.txt. "
print"[+] "
sys.exit()
elifoptin ("-t, --tool"):
tool=arg
elifoptin ("-f, --hostfile"):
hostfile=arg
if__name__=="__main__":
whileTrue:
try:
main(sys.argv[1:])
cmds(sys.argv[1:])
break
exceptIOError, e:
print"[-] "
print"[-] Invalid Options: "
print"[-] "
print"[+] -t, --tool Name of tool to run. "
print"[+] Enclose command and argument with quotes. "
print"[+] "
print"[+] -f, --hostfile Name of file that conatins targets. "
print"[+] "
print"[+] Example: ./toolwrapper.py -t 'ping -c 1' -f targetlist.txt. "
print"[+] "
print"[+] Example: ./toolwrapper.py -t 'snmp-check' -f targetlist.txt. "
print"[+] "
break