Introduction to Nmap
• • Network Mapper (Nmap) is an open-source
tool for network exploration and security
auditing.
• • Developed by Gordon Lyon (Fyodor) and first
released in 1997.
• • Widely used for network inventory,
managing service upgrade schedules, and
monitoring host or service uptime.
What is the Nmap Scripting Engine
(NSE)?
• • NSE is a powerful feature of Nmap that
allows users to write and share simple scripts
to automate a wide variety of networking
tasks.
• • Introduced in Nmap version 4.50.
• • Scripts are written in Lua, a lightweight
programming language.
Benefits of Using NSE
• • Enhances Nmap's capabilities beyond simple
port scanning.
• • Automates complex network reconnaissance
and exploitation tasks.
• • Extensible: Users can write custom scripts
for specific needs.
• • Community-driven: Many scripts are shared
and improved by the security community.
How NSE Works
• • NSE scripts are stored in the 'scripts'
directory of Nmap.
• • Scripts are executed in parallel with Nmap's
core scanning functions.
• • Each script can specify its own arguments
and categories.
Script Categories
• • Auth: Authentication bypass and brute force
attacks.
• • Broadcast: Network discovery using
broadcast and multicast.
• • Default: Basic scripts that run with the '-sC'
option.
• • Discovery: Network discovery tasks.
• • Dos: Denial of Service attacks.
• • Exploit: Exploit vulnerabilities.
Example Scripts
• • http-enum: Enumerates directories used by
web servers.
• • smb-os-discovery: Attempts to determine
the OS of a remote SMB server.
• • ftp-anon: Checks for anonymous FTP logins.
• • ssl-heartbleed: Checks for the Heartbleed
vulnerability in SSL/TLS.
Running NSE Scripts
• • Use the '--script' option followed by the
script name(s):
• ```
• nmap --script <script-name> <target>
• ```
• • Run multiple scripts by specifying a comma-
separated list or using wildcards:
• ```
• nmap --script script1,script2 <target>
Writing Your Own NSE Scripts
• • Scripts are written in Lua and typically have
four main sections:
• - Head: Metadata about the script.
• - Rule: When the script should run.
• - Action: Main logic of the script.
• - Post: (Optional) Clean up actions.
• • Example skeleton:
• ```lua
• description = [[
Use Cases
• • Network inventory and monitoring.
• • Vulnerability assessment and penetration
testing.
• • Compliance auditing.
• • Security research and incident response.
• • Custom automation for specific network
tasks.
Conclusion
• • The Nmap Scripting Engine extends Nmap's
capabilities far beyond basic scanning.
• • NSE scripts are versatile, allowing for
complex network tasks to be automated.
• • Community contributions keep NSE relevant
and up-to-date with emerging security
threats.

Nmap_Scripting_Engine_Presentations.pptx

  • 1.
    Introduction to Nmap •• Network Mapper (Nmap) is an open-source tool for network exploration and security auditing. • • Developed by Gordon Lyon (Fyodor) and first released in 1997. • • Widely used for network inventory, managing service upgrade schedules, and monitoring host or service uptime.
  • 2.
    What is theNmap Scripting Engine (NSE)? • • NSE is a powerful feature of Nmap that allows users to write and share simple scripts to automate a wide variety of networking tasks. • • Introduced in Nmap version 4.50. • • Scripts are written in Lua, a lightweight programming language.
  • 3.
    Benefits of UsingNSE • • Enhances Nmap's capabilities beyond simple port scanning. • • Automates complex network reconnaissance and exploitation tasks. • • Extensible: Users can write custom scripts for specific needs. • • Community-driven: Many scripts are shared and improved by the security community.
  • 4.
    How NSE Works •• NSE scripts are stored in the 'scripts' directory of Nmap. • • Scripts are executed in parallel with Nmap's core scanning functions. • • Each script can specify its own arguments and categories.
  • 5.
    Script Categories • •Auth: Authentication bypass and brute force attacks. • • Broadcast: Network discovery using broadcast and multicast. • • Default: Basic scripts that run with the '-sC' option. • • Discovery: Network discovery tasks. • • Dos: Denial of Service attacks. • • Exploit: Exploit vulnerabilities.
  • 6.
    Example Scripts • •http-enum: Enumerates directories used by web servers. • • smb-os-discovery: Attempts to determine the OS of a remote SMB server. • • ftp-anon: Checks for anonymous FTP logins. • • ssl-heartbleed: Checks for the Heartbleed vulnerability in SSL/TLS.
  • 7.
    Running NSE Scripts •• Use the '--script' option followed by the script name(s): • ``` • nmap --script <script-name> <target> • ``` • • Run multiple scripts by specifying a comma- separated list or using wildcards: • ``` • nmap --script script1,script2 <target>
  • 8.
    Writing Your OwnNSE Scripts • • Scripts are written in Lua and typically have four main sections: • - Head: Metadata about the script. • - Rule: When the script should run. • - Action: Main logic of the script. • - Post: (Optional) Clean up actions. • • Example skeleton: • ```lua • description = [[
  • 9.
    Use Cases • •Network inventory and monitoring. • • Vulnerability assessment and penetration testing. • • Compliance auditing. • • Security research and incident response. • • Custom automation for specific network tasks.
  • 10.
    Conclusion • • TheNmap Scripting Engine extends Nmap's capabilities far beyond basic scanning. • • NSE scripts are versatile, allowing for complex network tasks to be automated. • • Community contributions keep NSE relevant and up-to-date with emerging security threats.