Common Nmap Commands in Nmapr
The following are some common Nmap commands that you can find with a simple google search, but built with Nmapr.
Scan a Single Target
Nmapr.scan :run do
target "196.168.0.3"
end
Scan Multiple IP Addresses or the Whole Subnet
Nmapr.scan :run do
targets "192.168.1.0/24"
# or
target "192.168.1.0/24"
# or
targets "192.168.0.*"
# or
targets [ "192.168.0.3", "192.168.0.4" ]
# or
targets "192.168.0.1-192.168.0.20"
end
Exclude Targets
Nmapr.scan :run do
targets "192.168.0.*"
exclude ["192.168.0.1", "192.168.0.3"]
# or
exclude "192.168.0.1"
end
Only Show Open Ports
Nmapr.scan :run do
targets "192.168.0.*"
open
# or
show_open
end
Aggressive Scan
Enables additional advanced and aggressive options.
Nmapr.scan :cmd do
targets "192.168.0.*"
aggressive
end
Get Past 'dat Firewall
Nmapr.scan :cmd do
targets "192.168.0.*"
ping :disable
end
Fast Scan
Nmapr.scan :cmd do
targets "192.168.0.*"
fast
end
Detect Remote Host's Operating System
Nmapr.scan :cmd do
detect :os
end
Detect Service Versions
Nmapr.scan :cmd do
detect :version
end