-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnmap2.src
More file actions
57 lines (46 loc) · 1.31 KB
/
nmap2.src
File metadata and controls
57 lines (46 loc) · 1.31 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
host = get_shell.host_computer;
target = params[0];
targetRouter = get_router(target);
if (typeof(targetRouter) != "router") then
exit("Failed to connect to " + target);
end if
computers = targetRouter.computers_lan_ip;
forwardedPorts = targetRouter.used_ports;
forwardingMap = {};
for port in forwardedPorts
if (true != forwardingMap.hasIndex(port.get_lan_ip)) then
forwardingMap.push(port.get_lan_ip);
forwardingMap[port.get_lan_ip] = [];
end if
forwardingMap[port.get_lan_ip].push(port.port_number);
end for
checkForwarded = function(lan, port)
if (forwardingMap.hasIndex(lan)) then
if forwardingMap[lan].indexOf(port) != null then
return true;
end if
end if
return false;
end function
print("EXT: " + targetRouter.public_ip);
print("INT: " + targetRouter.local_ip);
rows = "HOST PORT FORWARDED STATE SERVICE VERSION";
for computer in computers
ports = targetRouter.computer_ports(computer);
for port in ports
entry = computer + " " + port.port_number;
if checkForwarded(computer, port.port_number) then
entry = entry + " YES ";
else
entry = entry + " NO ";
end if
if port.is_closed then
entry = entry + "CLOSED ";
else
entry = entry + "OPEN ";
end if
entry = entry + targetRouter.port_info(port);
rows = rows + "\n" + entry;
end for
end for
print(format_columns(rows));