-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmnettools.py
40 lines (36 loc) · 1.14 KB
/
mnettools.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
import sys
from port_scan import port_scan
from ip_scan import ip_scan
from ping import ping
def main(command, host):
if command == 'port_scan':
port_scan(host)
elif command == 'ip_scan':
ip_scan(host)
elif command == 'ping':
ping(host)
if __name__ == '__main__':
# Get args or show prompt
if len(sys.argv) > 2:
command = sys.argv[1]
host = sys.argv[2]
main(command, host)
else:
while True:
inputs = input("mnettools > ").split()
if len(inputs) == 1:
command = inputs[0]
if command == 'exit':
sys.exit(0)
elif command == 'help':
print("Commands: port_scan, ip_scan, ping, help, exit")
else:
print("Invalid command")
elif len(inputs) == 2:
command, host = inputs[0], inputs[1]
if command in ['port_scan', 'ip_scan', 'ping']:
main(command, host)
else:
print("Invalid command")
else:
print("Invalid Input")