Module: Ronin::Nmap::Mixin
- Defined in:
- lib/ronin/nmap/mixin.rb
Overview
Provides helper methods for running nmap.
Instance Method Summary collapse
-
#nmap(*targets, sudo: nil, **kwargs) {|nmap| ... } ⇒ ::Nmap::XML
Runs
nmapand parses the XML output.
Instance Method Details
#nmap(*targets, sudo: nil, **kwargs) {|nmap| ... } ⇒ ::Nmap::XML
Runs nmap and parses the XML output.
Examples:
xml = Nmap.scan('192.168.1.*', syn_scan: true, ports: [80, 443])
# => #<Nmap::XML: ...>
xml.hosts
# => [#<Nmap::XML::Host: 192.168.1.1>, ...]
Parameters:
-
targets
(Array<#to_s>)
—
The targets to scan.
-
sudo
(Hash{Symbol => Object}, Boolean, nil)
(defaults to: nil)
—
Controls whether the
nmapcommand should be ran undersudo. If thesudo:keyword argument is not given, thennmapwill automatically be ran undersudoifsync_scan,ack_scan,window_scan,maimon_scan,null_scan,fin_scan,xmas_scan,scan_flags,os_fingerprint, ortracerouteare enabled. -
kwargs
(Hash{Symbol => Object})
—
Additional keyword arguments for
nmap.
Options Hash (sudo:):
-
:askpass
(Boolean)
—
Enables the
--askpasssudooption. -
:background
(Boolean)
—
Enables the
--backgroundsudooption -
:bell
(Boolean)
—
Enables the
--bellsudooption -
:close_from
(Integer)
—
Enables the
--close-from=...sudooption -
:chdir
(String)
—
Enables the
--chdir=...sudooption -
:preserve_env
(String)
—
Enables the
--preseve-env=...sudooption -
:group
(String, Boolean)
—
Enables the
--preseve-env=...sudooption -
:set_home
(Boolean)
—
Enables the
--set-homesudooption -
:host
(String)
—
Enables the
--host=...sudooption -
:login
(Boolean)
—
Enables the
--loginsudooption -
:remove_timestamp
(Boolean)
—
Enables the
--remove-timestampsudooption -
:reset_timestamp
(Boolean)
—
Enables the
--reset-timestampsudooption -
:non_interactive
(Boolean)
—
Enables the
--non-interactivesudooption -
:preserve_groups
(Boolean)
—
Enables the
--preserve-groupssudooption -
:prompt
(String)
—
Enables the
--prompt=...sudooption -
:chroot
(String)
—
Enables the
--chroot=...sudooption -
:role
(String)
—
Enables the
--role=...sudooption -
:stdin
(Boolean)
—
Enables the
--stdinsudooption -
:shell
(Boolean)
—
Enables the
--shellsudooption -
:type
(String)
—
Enables the
--type=...sudooption -
:command_timeout
(Integer)
—
Enables the
--command-timeout=...sudooption -
:other_user
(String)
—
Enables the
--other-user=...sudooption -
:user
(String)
—
Enables the
--user=...sudooption
Yields:
-
(nmap)
—
If a block is given, it will be passed the new
nmapcommand object for additional configuration.
Yield Parameters:
-
nmap
(::Nmap::Command)
—
The
nmapcommand object.
Returns:
-
(::Nmap::XML)
—
The parsed nmap XML data.
See Also:
137 138 139 |
# File 'lib/ronin/nmap/mixin.rb', line 137 def nmap(*targets, sudo: nil, **kwargs,&block) Nmap.scan(*targets, sudo: sudo, **kwargs, &block) end |