-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path7scan.src
More file actions
102 lines (89 loc) · 3.13 KB
/
7scan.src
File metadata and controls
102 lines (89 loc) · 3.13 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
91
92
93
94
95
96
97
98
99
100
101
102
// NAME: 7scan (gives all kind of information to given ip-addr)
cryptools = include_lib("/lib/crypto.so")
if not cryptools then exit("Error: Missing crypto library")
if params.len == 0 or params.len > 1 or params[0] == "-h" or params[0] == "--help" then exit("<b>Usage: 7scan [ip address]</b>")
PrintYellow=function(string); print("<color=yellow>" + string + "</color>"); end function
PrintWhite=function(string); print("<color=white>" + string + "</color>"); end function
PrintRed=function(string); print("<color=red>" + string + "</color>"); end function
GetSMTP=function(ipAddress, port)
PrintWhite("running smtp_user_list on port " + port + " ...")
users = cryptools.smtp_user_list(ipAddress, port)
if(typeof(users) == "list") then
for user in users
userPass = user.split(" ")
print(userPass[0])
end for
end if
end function
// nmap
if params.len != 1 then exit("<b>Usage: 7scan [ip address]</b>")
if not is_valid_ip(params[0]) then exit("nmap: invalid ip address")
if not get_shell.host_computer.is_network_active then exit("nmap: No internet access.")
ipAddress = params[0]
isLanIp = is_lan_ip( ipAddress )
if isLanIp then
router = get_router;
else
router = get_router( ipAddress )
end if
clear_screen
PrintYellow("running /bin/7scan")
print("checking IP: " + ipAddress)
if router == null then PrintRed("nmap: ip address not found")
ports = null
if not isLanIp then
ports = router.used_ports
else
ports = router.device_ports(ipAddress)
end if
if ports == null then PrintRed("nmap: ip address not found")
if typeof(ports) == "string" then exit(ports)
if(ports.len == 0) then PrintRed("nmap: No open ports found")
nmapInfo = ""
for port in ports
service_info = router.port_info(port)
lan_ips = port.get_lan_ip
port_status = "open"
if(port.is_closed and not isLanIp) then
port_status = "closed"
end if
if (not port.is_closed) and (service_info.split(" ")[0] == "smtp") then GetSMTP(ipAddress, port.port_number)
if nmapInfo == "" then
nmapInfo = port.port_number + " " + port_status + " " + service_info + " " + lan_ips
else
nmapInfo = nmapInfo + "\n" + port.port_number + " " + port_status + " " + service_info + " " + lan_ips
end if
end for
PrintWhite("running nmap ...")
if nmapInfo != "" then print(format_columns(nmapInfo))
// scanrouter
PrintWhite("running scanrouter ...")
router = get_router( ipAddress )
if router == null then
PrintRed("scanrouter: ip address not found")
else
version = router.kernel_version
if not version then
print("Warning: kernel_router.so not found")
else
print("kernel_router.so : v" + version)
end if
firewall_rules = router.firewall_rules
if typeof(firewall_rules) == "string" then PrintRed(firewall_rules)
if firewall_rules.len == 0 then
print("No firewall rules found!")
else
scanInfo = "ACTION PORT SOURCE_IP DESTINATION_IP"
for rules in firewall_rules
scanInfo = scanInfo + "\n" + rules
end for
print(format_columns(scanInfo))
end if
end if
//whois
PrintWhite("running whois ...")
if whois(ipAddress) == "Error: the IP address must be public" then
PrintRed("whois: the IP address must be public")
else
print(whois(ipAddress))
end if