Created
August 2, 2018 09:41
-
-
Save nopslider/3fe4880d069acc2426864cb72b2d906e to your computer and use it in GitHub Desktop.
List information about hosts in a Nessus scan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import xml.etree.ElementTree as ET | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument("nessusfile") | |
args = parser.parse_args() | |
nessus = ET.parse(args.nessusfile) | |
nessusroot = nessus.getroot() | |
for host in nessusroot.iter('ReportHost'): | |
name = host.attrib["name"] | |
ip = "Unknown" | |
netbios = "Unknown" | |
os = "Unknown" | |
for tag in host.iter('tag'): | |
if tag.attrib['name'] == 'operating-system': | |
os = tag.text.replace("\n","/") | |
if tag.attrib['name'] == 'host-ip': | |
ip = tag.text | |
if tag.attrib['name'] == 'netbios-name': | |
netbios = tag.text | |
print("{}|{}|{}|{}".format(name,netbios,ip,os)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment