Skip to content

Commit d8fa1d6

Browse files
committed
Update nmap, use top tcp_ports when no port_str given.
1 parent 7b6811d commit d8fa1d6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

darkbox/commands/nmap.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" darkbox nmap command """
22

33
from darkbox.commands.template import Command
4+
from darkbox.static.ports import tcp_ports
45

56
import sys
67
import time
@@ -138,19 +139,18 @@ def run(self):
138139
if port_str:
139140
ports = self.parse_port_str(port_str)
140141
else:
141-
print("No port range specified.")
142-
return
143-
142+
ports = tcp_ports
143+
144144
self.validate_ports(ports)
145145

146-
results = 'PORT STATE\n'
146+
results = '\nPORT STATE\n'
147147
for p in ports:
148148
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
149149
c = s.connect_ex((ip, p))
150150
socket.setdefaulttimeout(0.5)
151151
state = 'open' if not c else 'closed'
152152
results += '{:<9} {:<7}\n'.format(str(p)+'/tcp', state)
153-
print(results.rstrip())
153+
print(results)
154154

155155
end_time = time.time()
156156
t_delta = end_time - start_time

0 commit comments

Comments
 (0)