Skip to content

Commit

Permalink
Merge pull request #1 from LimberDuck/develop
Browse files Browse the repository at this point in the history
v. 0.3.0
  • Loading branch information
damian-krawczyk authored Jul 25, 2020
2 parents f67c468 + 7d753e8 commit dd80dbe
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ __pycache__
build
dist
nessus_file_reader.egg-info
test_files
.vscode
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Change Log

This document records all notable changes to [nessus file reader by LimberDuck][1].

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2020-07-25

### Added

- new function host.netbios_network_name - to get NetBIOS Computer Name, Workgroup / Domain name for given target.

### Changed

- possibility to pars network address with mask in target

## [0.2.0] - 2019-09-09

### Added

- new function plugin.report_item_values - to get list of values for all items with given name e.g. 'cve'


## [0.1.0] - 2019-06-23

- Initial release

[0.3.0]: https://github.com/LimberDuck/nessus-file-reader/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/LimberDuck/nessus-file-reader/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/LimberDuck/nessus-file-reader/releases/tag/v0.1.0

[1]: https://github.com/LimberDuck/nessus-file-reader
19 changes: 0 additions & 19 deletions CHANGELOG.rst

This file was deleted.

4 changes: 2 additions & 2 deletions nessus_file_reader/file/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def nessus_scan_file_root_element(file):
:param file: given nessus file
:return: root element for this tree.
"""
nessus_scan_file = nessus_scan_file_name_with_path(file)
nessus_scan_file_parsed = parse(nessus_scan_file)

nessus_scan_file_parsed = parse(file)
root = nessus_scan_file_parsed.getroot()
return root
23 changes: 23 additions & 0 deletions nessus_file_reader/host/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,29 @@ def resolved_fqdn(report_host):
return host_fqdn


def netbios_network_name(root, report_host):
"""
Function returns information about NetBIOS Computer Name, Workgroup / Domain name for given target.
:param root: root element of scan file tree
:param report_host: report host element
:return: os for given target
"""
pido_10150 = plugin.plugin_output(root, report_host, '10150')
pido_10150_split = pido_10150.split('\n')

netbios_computer_name = ''
netbios_domain_name = ''
for netbios_data_split_entry in pido_10150_split:
if 'Computer name' in netbios_data_split_entry:
netbios_computer_name = netbios_data_split_entry.split('=')[0].strip().lower()

if 'Workgroup / Domain name' in netbios_data_split_entry:
netbios_domain_name = netbios_data_split_entry.split('=')[0].strip().lower()

return {'netbios_computer_name': netbios_computer_name,
'netbios_domain_name': netbios_domain_name}


def detected_os(report_host):
"""
Function returns information about Operating System for given target.
Expand Down
4 changes: 4 additions & 0 deletions nessus_file_reader/scan/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ def list_of_target_hosts(root):
address_range = utilities.ip_range_split(target)
for address in address_range:
target_hosts_final_list.append(str(address))
elif re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}', target):
address_range = utilities.ip_range_split(target)
for address in address_range:
target_hosts_final_list.append(str(address))
else:
target_hosts_final_list.append(target)
else:
Expand Down
8 changes: 8 additions & 0 deletions nessus_file_reader/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ def ip_range_split(ip_range):
ip_addresses.append(first_address)
first_address += 1

elif re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}', ip_range):
ip_network_hosts = ipaddress.ip_network(ip_range).hosts()
ip_network_hosts_list = list(ip_network_hosts)

for ip in ip_network_hosts_list:
# print(ip)
ip_addresses.append(ip)

return ip_addresses
3 changes: 3 additions & 0 deletions nfr_example_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def nfr_example_simple():
pidos_14272 = nfr.plugin.plugin_outputs(root, report_host, '14272')
print(f'All findings for Netstat Portscanner (SSH): \n{pidos_14272}')

netbios_network_name = nfr.host.netbios_network_name(root, report_host)
print(f'Netbios network name {netbios_network_name}')

except Exception as e:
print(f'\nUps... ERROR occurred. \n\n {str(e)}')
traceback.print_exc()
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="nessus_file_reader",
version="0.2.0",
version="0.3.0",
author="Damian Krawczyk",
author_email="damian.krawczyk@limberduck.org",
description="nessus file reader by LimberDuck (pronounced *ˈlɪm.bɚ dʌk*) is a python module "
Expand All @@ -16,7 +16,7 @@
url="https://github.com/LimberDuck/nessus-file-reader",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
Expand Down

0 comments on commit dd80dbe

Please sign in to comment.