pex.net

Package Contents

class pex.net.Net

Bases: object

Main of pex.net module.

This main of pex.net module is intended for providing some implementations of various network tools.

static get_hosts() list

Get all hosts available on the system.

Return list:

network hosts available on the system.

static get_gateways() list

Get all network interfaces available on the system.

Return list:

network gateways available on the system

static get_gateway_hosts(gateway: str) list

Get all hosts from gateway.

Parameters:

gateway (str) – gateway

Return list:

hosts

get_host_alive(host: str, method: str = 'arp') scapy.all.Union[str, bool, None]

Check if host is alive.

Parameters:

host (str) – host to check

Return Union[str, bool, None]:

mac address for arp, True for icmp, None for error

get_top_ports(host: str) dict

Scan host for top opened ports.

Parameters:

host (str) – host to scan

Return dict:

port and service

get_host_port(host: str, port: int) bool

Check if port is opened on host.

Parameters:
  • host (str) – host

  • port (int) – port

Return bool:

True if opened, False if closed or filtered

get_ports(host: str, start: int = 0, end: int = 65535) dict

Scan host for opened ports.

Parameters:
  • host (str) – host to scan for opened ports

  • start (int) – first port

  • end (int) – final port

Return dict:

dictionary of port and service name

get_vendor(mac: str) str

Get vendor by MAC address.

Parameters:

mac (str) – MAC address

Return str:

vendor name

static get_dns(host: str) str

Get local DNS name by host.

Parameters:

host (str) – host to get local DNS name by

Return str:

local DNS name

get_platform(host: str, port: int) scapy.all.Tuple[str, str]

Detect platform by host.

Parameters:
  • host (str) – host to detect platform by

  • port (int) – port to detect platform by

Return Tuple[str, str]:

platform name and version

get_platform_by_ports(host: str, ports: list) scapy.all.Tuple[str, str]

Detect platform by a list of ports.

Parameters:
  • host (str) – host

  • ports (list) – list of ports

Return Tuple[str, str]:

platform name and version