I do not understand error message with port scanner challenge

Tell us what’s happening:
Describe your issue in detail here.

I do not understand this error message:

Traceback (most recent call last):
  File "main.py", line 10, in <module>
    ports = port_scanner.get_open_ports("", [8079, 8090])
  File "/home/runner/portscan/port_scanner.py", line 26, in get_open_ports
    host_ip = checkTarget(target)
  File "/home/runner/portscan/port_scanner.py", line 13, in checkTarget
    host = socket.gethostbyaddr(target)
socket.herror: [Errno 1] Unknown host
exit status 1

Your project link(s)

solution: https://portscan.dmikes.repl.co

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36

Challenge: Port Scanner

Link to the challenge:

It most likely means that ip address doesn’t have corresponding host name.

I added it when possible, but still some errors I don’t understand. Example:

FAIL: test_port_scanner_url_multiple_ports (test_module.UnitTests)
Traceback (most recent call last):
  File "/home/runner/portscan/test_module.py", line 22, in test_port_scanner_url_multiple_ports
    self.assertEqual(actual, expected, 'Expected scanning ports of URL address to return [22, 80].')
AssertionError: 'Open ports for scanme.nmap.org (\nPORT     SERVICE\n22       \n80' != [22, 80] : Expected scanning ports of URL address to return [22, 80].

Looks like the function returns the full text also in case when only list is expected as a returned value.

1 Like

Ah ok, thank you very much.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.