How tekshteint/pmap works
Project type and purpose
• PMAP is an open-source, command-line network scanning tool implemented in PowerShell.
• It provides a multithreaded alternative to Nmap for environments where PowerShell is available but you lack elevated privileges or external binaries.
File structure
• Top-level scripts and module files:
• pmap.ps1 – the entry-point script that users invoke from the CLI.
• pmap.psm1 – the core PowerShell module containing the scanning functions.
• pmap.psd1 – the module manifest that declares metadata, exported functions, versioning.
• demos/ – example output and animated demo assets.
• README.md, LICENSE, .gitignore, .gitattributes – documentation and project metadata.
README for additional insights
• Core features: multithreading, flexible target specification, quick vs full scans, custom port ranges, verbose output, host discovery.
• No external dependencies; runs on PowerShell 5.0+.
• Flags and switches drive behavior—this implies a CLI parser component feeding into the scanning engine.
Main components and interactions
a. CLI Interface (pmap.ps1)
– Parses command-line parameters (targets, port ranges, flags).
– Validates inputs and invokes the module’s public functions.
b. Parameter/Config Manager
– Normalizes targets (single IP, comma list, CIDR).
– Determines port lists based on quick/full/custom flags.
c. Scanning Engine (pmap.psm1)
– Core function that receives a list of targets and ports.
– Delegates work to a thread manager for concurrency.
d. Thread Manager
– Spawns PowerShell runspaces or jobs to parallelize port checks.
– Balances workload across threads.
e. Network Connector
– Performs individual TCP connection attempts (socket open/close).
– Reports status (open/closed) back to the engine.
f. Output Formatter
– Aggregates results from all threads.
– Formats console output (table, verbose logs, discovery-only).
– Handles redirection to files if requested.
g. Module Manifest (pmap.psd1)
– Ensures proper export of public functions for import by the entry script.
Architectural patterns and design principles
• Modular separation: CLI parsing separated from scanning logic and threading.
• Concurrency via a thread (runspace/job) pool.
• Single-responsibility for each component (parsing, scanning, threading, output).
• No external dependencies ensures portability.