-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsimpleNMAP.py
executable file
·91 lines (78 loc) · 2.98 KB
/
simpleNMAP.py
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
91
#!/usr/bin/env python2
"""
written by Slacker007 of www.cybersyndicates.com & hunttools.org
Simple python script written for the commandline challenged. Quick and
dirty. And before you complain about whether or not it's suitable for a
certain situation, ask yourself if the person performing the task SHOULD
even need a script to get this info...
"""
import subprocess
chances = 4
end_prog = 0
def menu2( ):
cidr = raw_input("[*] Please enter the network cider or IP to be scanned "
"EX:192.168.1.0/16 or 10.10.1.4 ")
return cidr
def menu1( chances ):
print "\n[*] (1) Host Discovery: "
print "[*] (2) Port & Service Discovery (top ports only): "
print "[*] (3) Port & Service Discovery (All 65536): "
print "[*] (4) OS Discovery: "
print "[*] (5) RUN ALL \n"
choice1 = raw_input( "[*] What type of scan would you like to run? " )
if choice1 == '3':
print "\n[+] ******* If you are running this against a network range " \
"it will take a while! Best if used agaist a single IP or small " \
"range of addresses *******\n"
if choice1 not in ("1", "2", "3", "4", "5"):
if chances <= 1:
exit( )
chances = chances - 1
print "Error, Please check your answer choice and try again: %d tries " \
"remaining: " % (
chances)
menu1( chances )
else:
print "Choice Successful"
return choice1
def menu3(chances, end_prog):
if chances > 1:
choice3 = raw_input( "would you like to run another scan? (y or n) " )
choice3 = choice3.lower( )
if choice3 not in ('y', 'n'):
print "*** INPUT ERROR, Please enter either y or n ***"
chances = chances - 1
menu3(chances, end_prog)
if str(choice3) == 'n':
exit()
def scanner( cidr, choice1, chances ):
if choice1 == '1':
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-sn', '-PE', '-PP', '-T4',
'-ohostlist.UP', cidr ] )
elif choice1 == '2':
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-sV', '-oservices2', cidr ] )
elif choice1 == '3':
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-sV', '-p 1-65535', '-oservices3',
cidr ] )
elif choice1 == '4':
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-O', '-oosversions', cidr ] )
elif choice1 == '5':
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-sn', '-PE', '-PP', '-T4',
'-ohostlist.UP', cidr ] )
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-sV', '-p 1-65535', '-oservices3',
cidr ] )
subprocess.check_call(
[ 'nmap', '-n', '-v', '-Pn', '-O', '-oosversions', cidr ] )
else:
return
while (1):
choice1 = menu1( chances )
cidr = menu2( )
scanner( cidr, choice1, chances )
menu3( chances, end_prog )