-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhosts.py
35 lines (33 loc) · 1.21 KB
/
hosts.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
# This Module Interact with Database to Add/Edit Scanned Hosts
import requests
import couchdb
from termcolor import cprint
from design_view import get_all_ports_full, get_all_ports_name, get_all_ports_no,get_os_type
def get_all_scanned_hosts():
hosts = []
res = requests.get("http://localhost:5984/_all_dbs")
if(res.status_code == 200):
for host in res.json():
if("machine" in host):
ip = str(host).split("_")[::-1]
ip.pop()
ip = ip[::-1]
ip = str(".".join(ip))
cprint("%s"%ip,'white')
hosts.append(ip)
else:
cprint("[x] Can't Get Scanned hosts Error Code :%s "%str(res.status_code),'red')
return hosts
def get_ports():
ip = raw_input("spector/host > Enter IP: ")
options = raw_input("Choose Options\n[1] Port Number Only\n[2] Port Name and Number\n[3] Full Port Details\n[4] OS Type\nspector/hosts > ")
if(options == "1"):
get_all_ports_no(ip)
elif(options == "2"):
get_all_ports_name(ip)
elif(options == "3"):
get_all_ports_full(ip)
elif(options == "4"):
get_os_type(ip)
else:
cprint("[x] No Valid Option Selected ",'red')