mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-11 21:54:56 +03:00
27c6414ca5
Complete skill folder anatomy across all cybersecurity skills: - scripts/agent.py: 80-150 line Python agents using real libraries (impacket, boto3, azure-mgmt-*, kubernetes, pefile, yara, scapy, shodan, stix2, etc.) - references/api-reference.md: real API documentation with method signatures - LICENSE: MIT license for all skill folders
2.0 KiB
2.0 KiB
API Reference: Scanning Network with Nmap Advanced
python-nmap Library
Installation
pip install python-nmap
Requires Nmap binary installed on the system (nmap must be in PATH).
Core Classes
nmap.PortScanner()
Main scanner class wrapping the Nmap command-line tool.
| Method | Parameters | Returns | Description |
|---|---|---|---|
scan() |
hosts, ports, arguments |
dict |
Execute Nmap scan with given arguments |
all_hosts() |
- | list[str] |
List of all scanned host IPs |
nmap_version() |
- | tuple |
Installed Nmap version |
command_line() |
- | str |
Nmap command that was executed |
Scanner Result Access
scanner[host].state() # Host state: 'up' or 'down'
scanner[host].all_protocols() # ['tcp', 'udp']
scanner[host][proto].keys() # List of port numbers
scanner[host][proto][port] # Port info dict with keys: state, name, product, version
scanner[host].hostnames() # [{'name': 'hostname', 'type': 'PTR'}]
scanner[host]['osmatch'] # OS detection results
Common Nmap Arguments
| Argument | Purpose |
|---|---|
-sS |
TCP SYN scan (half-open, requires root) |
-sV |
Service version detection |
-sC |
Run default NSE scripts |
-O |
OS fingerprinting |
-sn |
Host discovery only (no port scan) |
--script vuln |
Run vulnerability detection scripts |
-T0 to -T5 |
Timing templates (paranoid to insane) |
--min-rate N |
Minimum packets per second |
-PE -PP -PS |
ICMP echo, timestamp, TCP SYN discovery probes |
-oX file |
Output results in XML format |
Output Parsing
scanner.csv() # CSV-formatted scan results
scanner.scaninfo() # Scan metadata (type, services scanned)
scanner.scanstats() # Timing and host statistics
References
- python-nmap docs: https://pypi.org/project/python-nmap/
- Nmap Reference Guide: https://nmap.org/book/man.html
- NSE Script Categories: https://nmap.org/nsedoc/categories/