pyplugins.actuation.nmap module

Nmap Plugin (nmap.py) for Penguin

This module provides the Nmap plugin, which automatically performs service and vulnerability scans on guest services exposed to the host via the VPN plugin. It listens for ‘on_bind’ events published by the VPN plugin and launches nmap scans against the corresponding host ports.

Features

  • Subscribes to VPN ‘on_bind’ events to detect new guest services exposed to the host.

  • Launches nmap scans (in a separate thread) for each new TCP service, storing results as XML files in the output directory.

  • Supports custom nmap configurations if present.

  • Manages and cleans up subprocesses for running nmap scans.

Arguments

  • None

Plugin Interface

  • Subscribes to the VPN plugin’s ‘on_bind’ event to trigger scans.

  • Does not provide a direct interface for other plugins, but writes scan results to files in the output directory.

Overall Purpose

The Nmap plugin automates the discovery and analysis of guest services exposed to the host, aiding in security assessment and service enumeration during emulation.

class pyplugins.actuation.nmap.Nmap[source]

Bases: Plugin

cleanup_subprocesses()[source]

Terminate and clean up all running nmap subprocesses.

Return type:

None

nmap_on_bind(proto, guest_ip, guest_port, host_port, host_ip, procname)[source]

Handle a new bind event from the VPN plugin and launch an nmap scan if appropriate.

Args:

proto (str): Protocol (e.g., ‘tcp’). guest_ip (str): Guest IP address. guest_port (int): Guest port. host_port (int): Host port mapped to the guest service. host_ip (str): Host IP address. procname (str): Name of the process binding the port.

Parameters:
  • proto (str)

  • guest_ip (str)

  • guest_port (int)

  • host_port (int)

  • host_ip (str)

  • procname (str)

Return type:

None

scan_thread(host_ip, guest_port, host_port, log_file_name)[source]

Run an nmap scan against the specified host port and save results.

Args:

host_ip (str): Host IP address. guest_port (int): Guest port. host_port (int): Host port. log_file_name (str): Path to the XML log file for scan results.

Parameters:
  • host_ip (str)

  • guest_port (int)

  • host_port (int)

  • log_file_name (str)

Return type:

None

uninit()[source]

Cleanup subprocesses on plugin unload.

Return type:

None