Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Column Version #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions nmap_xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def get_host_data(root):
try:
product = port.findall('service')[0].attrib['product']
except (IndexError, KeyError):
product = ''
product = ''
try:
version = port.findall('service')[0].attrib['version']
except (IndexError, KeyError):
version = ''
try:
servicefp = port.findall('service')[0].attrib['servicefp']
except (IndexError, KeyError):
Expand All @@ -89,7 +93,7 @@ def get_host_data(root):

# Create a list of the port data
port_data.extend((ip_address, host_name, os_name,
proto, port_id, service, product,
proto, port_id, service, product, version,
servicefp, script_id, script_output))

# Add the port data to the host data
Expand Down Expand Up @@ -123,7 +127,7 @@ def parse_to_csv(data):
csv_writer = csv.writer(csv_file)
top_row = [
'IP', 'Host', 'OS', 'Proto', 'Port',
'Service', 'Product', 'Service FP',
'Service', 'Product', 'Version', 'Service FP',
'NSE Script ID', 'NSE Script Output', 'Notes'
]
csv_writer.writerow(top_row)
Expand Down