Overview
The Nmap scripts perform comprehensive network scanning and port enumeration. They support local Windows execution and remote Linux scanning via SSH, generating detailed HTML reports.nmap_scan.bat
Executes Nmap scans locally on Windows systems.Parameters
Project name for the scan
Target IP addresses (comma-separated for multiple targets)
Timestamp for unique file naming
Output directory for reports
Path to nmap.exe executable
Usage
Nmap Command
The script executes the following Nmap command:Scan Options Explained
| Option | Description |
|---|---|
-Pn | Skip host discovery (assume host is up) |
-O | Enable OS detection |
--system-dns | Use system DNS resolver |
-vv | Very verbose output |
-sS | TCP SYN scan (stealth scan) |
-sC | Run default NSE scripts |
-sV | Version detection for services |
-oA | Output in all formats (XML, nmap, gnmap) |
--webxml | Generate XML suitable for web display |
-iL - | Read targets from stdin |
Port Ranges
Comprehensive port scanning configuration: TCP Ports: Full range 1-65535 UDP Ports: Common service portsView complete UDP port list
View complete UDP port list
7 (Echo), 9 (Discard), 13 (Daytime), 17 (QOTD), 19 (CHARGEN), 21 (FTP), 37 (Time), 53 (DNS), 67-69 (DHCP/TFTP), 98 (Linuxconf), 111 (RPC), 121 (ERPC), 123 (NTP), 135 (MS RPC), 137-138 (NetBIOS), 161 (SNMP), 177 (XDMCP), 371 (ClearCase), 389 (LDAP), 407 (Timbuktu), 445 (SMB), 456 (MACON), 464 (Kerberos), 500 (ISAKMP), 512 (biff), 514 (syslog), 517-518 (talk), 520 (RIP), 555 (phAse Zero), 635 (RLZ DBase), 666 (Doom), 858 (pftp), 1001 (JtoMB), 1010-1011 (surf), 1015 (SUPDUP), 1024-1049 (Reserved), 1051-1055 (Kerberos), 1170 (AT&T MeTV), 1194 (OpenVPN), 1243 (SubSeven), 1245 (VoiceChat), 1434 (MS SQL Monitor), 1492 (Trojan), 1600 (issd), 1604 (DarkComet), 1645 (RADIUS), 1701 (L2TP), 1807 (FJI), 1812 (RADIUS), 1900 (SSDP), 1978 (UniSQL), 1981 (PersistentMQ), 1999 (SubSeven), 2001-2002 (DC), 2023 (xinuexpansion), 2049 (NFS), 2115 (KDM), 2140 (DeepThroat), 2801 (IGMP), 2967 (SSC-Agent), 3024 (NDS_SSS), 3129 (Master’s Paradise), 3150 (Deep Throat), 3283 (Net Assistant), 3527 (VERITAS), 3700 (Portal of Doom), 3801 (EAP over UDP), 4000 (ICQ), 4092 (WorkSpaceAudio), 4156 (Stat Scanner), 4569 (IAX), 4590 (RID), 4781 (Kazaa), 5000-5001 (UPnP), 5036 (MenandMice), 5060 (SIP), 5321 (Firewall), 5400-5402 (Excerpt), 5503 (fcp-addr-srvr1), 5569 (rdmnet-ctrl), 5632 (pcANYWHERE), 5742 (Netvision), 6051 (X11), 6073 (DirectPlay8), 6502 (BoKS), 6670 (VocalTec), 6771 (BackWeb), 6912 (Mach), 6969 (acmsoda), 7000 (AOL), 7111 (Somfy), 7222 (unknown), 7300-7301 (swx), 7306-7308 (swx), 7778 (Unreal), 7789 (office), 7938 (LGTOMAPPER), 9872-9875 (Session Announcement), 9989 (iNIC), 10067 (Portal of Doom), 10167 (Portal of Doom), 11000 (IRISA), 11223 (Prism Deploy), 12223 (TrustedWeb), 12345-12346 (NetBus), 12361-12362 (Whack-a-mole), 15253 (Hydap), 15345 (XPCom), 16969 (unknown), 17185 (Soundsvirtual), 20001 (Millennium), 20034 (NetBus 2 Pro), 21544 (Schxxob), 21862 (unknown), 22222 (Prosiak), 23456 (EvilFTP), 26274 (Delta Source), 26409 (unknown), 27444 (Trinoo), 30029 (AOL Admin), 31335 (Trinoo), 31337-31339 (Back Orifice), 31666 (BOWhack), 31785 (Hack’a’Tack), 31789 (Hack’a’Tack), 31791-31792 (Hack’a’Tack), 32771 (Solaris RPC), 33333 (Prosiak), 34324 (BigGluck), 40412 (The Spy), 40421-40423 (Master Paradise), 40426 (Master Paradise), 47262 (Delta), 50505 (Socket de Troie), 50766 (Fore), 51100-51101 (InfoMaN), 51109 (Adleman), 53001 (Remote Shutdown), 54321 (School Bus), 61466 (TeleCommando)
Report Generation
Nmap generates XML output which is transformed to HTML:nmap.xsl) to convert Nmap XML to formatted HTML.
Output Files
| File | Description |
|---|---|
NmapReport - {Timestamp}.xml | Raw XML scan results (deleted after conversion) |
NmapReport - {Timestamp}.html | Formatted HTML report |
NmapReport - {Timestamp}.nmap | Nmap native format |
NmapReport - {Timestamp}.gnmap | Grepable format |
IP Address Handling
The script processes IP addresses:nmap_scan_remote.bat
Executes Nmap scans on remote Linux servers via SSH.Parameters
Project name
Target IP addresses (comma-separated)
Unique timestamp
Local output directory
Remote Linux server hostname/IP
SSH username
SSH password
Usage
Prerequisites
Remote server requirements:Remote Execution Workflow
- SSH Connection - Connect to remote server via plink
- Execute Nmap - Run scan on remote server
- File Transfer - Download XML results via pscp
- Local Conversion - Transform XML to HTML locally
- Cleanup - Remove remote temporary files
SSH Command Execution
Run Nmap remotely:File Transfer
Download results:Local vs Remote Comparison
- Local (nmap_scan.bat)
- Remote (nmap_scan_remote.bat)
Execution:Advantages:
- Direct execution
- No network dependencies
- Faster for local networks
- Nmap installed on Windows
- Administrator privileges
- Direct network access to targets
SSH Tools Used
plink.exe - PuTTY Link (SSH client)-no-antispoof- Skip host key verification prompt-ssh- Use SSH protocol-P 22- SSH port-l username- Login username-pw password- Password authentication-C- Enable compression
HTML Report Display
Both scripts automatically open the HTML report:XSL Transformation
Thenmap.xsl stylesheet formats the XML into a styled HTML report with:
- Host discovery summary
- Open ports table
- Service versions
- OS detection results
- NSE script output
- Scan statistics