Skip to content

masscan.masscan.NetworkConnectionError: network is unreachable. part deux #29

Description

@sirmodok

When I add some output options to the scan to store the output into an XML file, the scan happens, and the file is created, but I get the output "masscan.masscan.NetworkConnectionError: network is unreachable."

Details:

Python 3.8.1 (default, Jan  3 2020, 22:44:00) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import masscan
>>> mas = masscan.PortScanner()
>>> mas.scan('192.168.1.111', ports='1-1000', arguments='--max-rate=1000 -oX testfile')
[2020-01-12 02:03:06,241] [DEBUG] [masscan.py 10 line] Scan parameters: "masscan -oX - 192.168.1.111 -p 1-1000 --max-rate=1000 -oX testfile"
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/masscan/masscan.py", line 384, in analyse_masscan_xml_scan
    dom = ET.fromstring(self._masscan_last_output)
  File "/usr/local/lib/python3.8/xml/etree/ElementTree.py", line 1321, in XML
    return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/masscan/masscan.py", line 325, in scan
    return self.analyse_masscan_xml_scan(
  File "/usr/local/lib/python3.8/site-packages/masscan/masscan.py", line 387, in analyse_masscan_xml_scan
    raise NetworkConnectionError("network is unreachable.")
masscan.masscan.NetworkConnectionError: network is unreachable.
>>> quit()
root@a23c6822251f:/opt/apps/src# cat testfile 
<?xml version="1.0"?>
<!-- masscan v1.0 scan -->
<nmaprun scanner="masscan" start="1578794586" version="1.0-BETA"  xmloutputversion="1.03">
<scaninfo type="syn" protocol="tcp" />
<host endtime="1578794586"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="445"><state state="open" reason="syn-ack" reason_ttl="62"/></port></ports></host>
<host endtime="1578794587"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="61"/></port></ports></host>
<host endtime="1578794587"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="139"><state state="open" reason="syn-ack" reason_ttl="62"/></port></ports></host>
<host endtime="1578794587"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="111"><state state="open" reason="syn-ack" reason_ttl="62"/></port></ports></host>
<host endtime="1578794588"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="62"/></port></ports></host>
<host endtime="1578794588"><address addr="192.168.1.111" addrtype="ipv4"/><ports><port protocol="tcp" portid="53"><state state="open" reason="syn-ack" reason_ttl="61"/></port></ports></host>
<runstats>
<finished time="1578794599" timestr="2020-01-12 02:03:19" elapsed="13" />
<hosts up="6" down="0" total="6" />
</runstats>
</nmaprun>

Additionally I see you pass the arguments '-oX -' which should output in XML format, but the format comes out in JSON. I don't understand why.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions