Skip to content

Commit d7de6f0

Browse files
author
Matt Lebrun
committed
Added service banners in the scan result
1 parent db9aa20 commit d7de6f0

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

masscan/masscan.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ def analyse_masscan_xml_scan(self, masscan_xml_output=None, masscan_err='', mass
349349
<host endtime="1490242775"><address addr="10.0.9.6" addrtype="ipv4"/><ports><port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/></port></ports></host>
350350
<host endtime="1490242775"><address addr="10.0.9.12" addrtype="ipv4"/><ports><port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/></port></ports></host>
351351
<host endtime="1490242776"><address addr="10.0.9.28" addrtype="ipv4"/><ports><port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="64"/></port></ports></host>
352+
<host endtime="1498802982"><address addr="10.0.9.29" addrtype="ipv4"/><ports><port protocol="tcp" portid="80"><state state="open" reason="response" reason_ttl="48"/><service name="title" banner="401 - Unauthorized"></service></port></ports></host>
352353
<runstats>
353354
<finished time="1490242786" timestr="2017-03-23 12:19:46" elapsed="13" />
354355
<hosts up="10" down="0" total="10" />
@@ -390,6 +391,8 @@ def analyse_masscan_xml_scan(self, masscan_xml_output=None, masscan_err='', mass
390391

391392
scan_result['scan'] = {}
392393

394+
self._dom_hosts = dom.findall('host')
395+
393396
for dhost in dom.findall('host'):
394397
# host ip, mac and other addresses
395398
host = None
@@ -414,16 +417,24 @@ def analyse_masscan_xml_scan(self, masscan_xml_output=None, masscan_err='', mass
414417
state = dport.find('state').get('state')
415418
reason = dport.find('state').get('reason')
416419
reason_ttl = dport.find('state').get('reason_ttl')
420+
services = []
417421

418422
if not proto in list(scan_result['scan'][host].keys()):
419423
scan_result['scan'][host][proto] = {}
420424

421425
scan_result['scan'][host][proto][port] = {
422426
'state': state,
423427
'reason': reason,
424-
'reason_ttl': reason_ttl
428+
'reason_ttl': reason_ttl,
425429
}
426430

431+
for service in dhost.findall('ports/port/service'):
432+
services.append({
433+
'name': service.get('name'),
434+
'banner': service.get('banner'),
435+
})
436+
scan_result['scan'][host][proto][port]['services'] = services
437+
427438
self._scan_result = scan_result
428439
return scan_result
429440

0 commit comments

Comments
 (0)