class ARPScan::ScanReport
This class abstracts the string output from arp-scan into an Object
. A ScanReports are usually created through the ScanResultProcessor
module.
Attributes
The argument string passed to ARPScan
Information about the interface type.
Array of Host
objects.
Name of the interface used for the scan.
Size of the scan range ( # of hosts scanned ).
The number of hosts that replied to the scan, returns a Fixnum
The rate of the scan in hosts per second, returns a Float.
Duration of the scan in seconds, returns a Float.
`arp-scan` version number.
Public Class Methods
Create a new scan report, passing in every attribute. The best way to do this is with the ScanResultProcessor
module.
# File lib/arp_scan/scan_report.rb, line 45 def initialize(hash) @hosts = hash[:hosts] @interface = hash[:interface] @datalink = hash[:datalink] @version = hash[:version] @range_size = Integer(hash[:range_size]) @scan_time = Float(hash[:scan_time]) @scan_rate = Float(hash[:scan_rate]) @reply_count = Integer(hash[:reply_count]) @arguments = hash[:arguments] end
Public Instance Methods
Returns an array representation of the ScanReport
. Metadata about the scan, and an array of Host
arrays comprise the array.
# File lib/arp_scan/scan_report.rb, line 60 def to_array instance_variables.map do |var| if var == :@hosts instance_variable_get(var).map(&:to_array) else instance_variable_get(var) end end end
Returns a hash representation of the ScanReport
. Metadata about the scan, and array of Host
hashes comprise the hash.
# File lib/arp_scan/scan_report.rb, line 73 def to_hash { hosts: @hosts.map(&:to_hash), interface: @interface, datalink: @datalink, version: @version, range_size: @range_size, scan_time: @scan_time, scan_rate: @scan_rate, reply_count: @reply_count, arguments: @arguments } end