forked from jamesmhann/NetScanX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetScanX
More file actions
81 lines (66 loc) · 1.8 KB
/
NetScanX
File metadata and controls
81 lines (66 loc) · 1.8 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
#!/usr/bin/python3
import requests
import os
from colorama import Fore
import sys
from art import *
import ipaddress
import socket
if os.name == 'posix':
os.system('clear')
else:
print(Fore.YELLOW+"\n[!] Unable to run NetScanX on this platform...\n"+Fore.WHITE)
exit(0)
def banner():
print(text2art("NetScanX"))
print(Fore.BLUE+"[+] Owner: https://x.com/cyb3rf034r3ss\n"+Fore.WHITE)
print(Fore.BLUE+"A security tool that looks up open ports and vulnerabilities...\n"+Fore.WHITE)
banner()
def get_help():
print(Fore.YELLOW+"[!] ./NetScanX -t <ip address>\n"+Fore.WHITE)
if len(sys.argv) == 3:
pass
else:
get_help()
exit(0)
if sys.argv[1] != '-t':
get_help()
exit(0)
if sys.argv[2] == "":
get_help()
exit()
def validate_ip(ip_str):
try:
ip_obj = ipaddress.ip_address(ip_str)
return True
except ValueError:
return False
if validate_ip(sys.argv[2]) == True:
pass
else:
get_help()
exit(0)
ip_addr = sys.argv[2]
try:
data = requests.get("https://internetdb.shodan.io/{}".format(ip_addr)).json()
except requests.exceptions.ConnectionError:
print(Fore.YELLOW+"[!] Error: requests.exceptions.ConnectionError...\n"+Fore.WHITE)
exit(0)
ip = data.get('ip', '')
ports = data.get('ports', [])
vulns = data.get('vulns', [])
print(Fore.YELLOW+"IP ADDRESS - {}".format(ip_addr),Fore.WHITE)
print(Fore.BLUE+"\n-[OPEN PORTS]-\n"+Fore.WHITE)
print(ports)
print()
if len(vulns) == 0:
print(Fore.BLUE+"-[VULNERABILITY STATUS]-\n"+Fore.WHITE)
print(Fore.GREEN+"- Not Vulnerable\n"+Fore.WHITE)
else:
print(Fore.BLUE+"-[VULNERABILITY STATUS]-\n"+Fore.WHITE)
print(Fore.RED+"- Vulnerable"+Fore.WHITE)
print(Fore.BLUE+"\n-[FOUND CVES]-\n"+Fore.WHITE)
for v in vulns:
print("https://www.cve.org/CVERecord?id="+v)
print()
exit()