Module: tests/test_network_scanner

tests.test_network_scanner.check_ports(device_ip, expected_nmap_scan)

Check if the open ports for a device match the expected open ports.

Parameters:
  • device_ip (str) – The IP address of the device.

  • expected_nmap_scan – The nmap scan fixture.

Returns:

True if the ports match, False otherwise.

Return type:

bool

tests.test_network_scanner.nmap_scan_ip_network(ip, netmask)

Perform an IP network Nmap scan on the provided IP address and netmask.

Parameters:
  • ip (str) – The IP address to be scanned.

  • netmask (str) – The netmask for the IP address.

Returns:

nmap.PortScanner

tests.test_network_scanner.nmap_scan_single_ip(single_ip)

Perform a single IP Nmap scan on the provided IP address.

Parameters:

single_ip (str) – The IP address to be scanned.

Returns:

nmap.PortScanner

tests.test_network_scanner.test_network_enum(nmap_scan_ip_network, ip, netmask)

Test the network_enum() with the scan() function from the network_scanner module.

Parameters:
  • nmap_scan_ip_network – The nmap_scan_ip_network fixture.

  • ip (str) – The IP address to be scanned.

  • netmask (str) – The netmask for the IP address.

Returns:

None

tests.test_network_scanner.test_scan_single_ip(nmap_scan_single_ip, single_ip)

Test the scan_single_ip() function from the network_scanner module.

Parameters:
  • nmap_scan_single_ip – The nmap_scan_single_ip fixture.

  • single_ip (str) – The IP address to be scanned.

Returns:

None