module ARPScan::ScanResultProcessor
This module is an interface for creating ScanReport
objects from arp-scan output.
Constants
- HOST_ENTRY_REGEX
Regex to capture IP address, MAC address, and OUI information
- INTERFACE_SUMMARY_REGEX
Regex to capture interface and datalink
- SCAN_SUMMARY_REGEX
Regex to capture arp-scan version, scan range size, scan time, scan rate, and the number of responding hosts.
Public Class Methods
process(string, arguments)
click to toggle source
This method does the actual processing of the arp-scan result string. It uses the Regexes to capture data then passes the results to ScanRepor.new to return a ScanReport
object.
# File lib/arp_scan/scan_result_processor.rb, line 28 def self.process(string, arguments) results = {} results[:hosts] = string.scan(HOST_ENTRY_REGEX).map { |entry| Host.new(*entry) } results[:interface], results[:datalink] = string.scan(INTERFACE_SUMMARY_REGEX)[0] results[:version], results[:range_size], results[:scan_time], results[:scan_rate], results[:reply_count] = string.scan(SCAN_SUMMARY_REGEX)[0] results[:arguments] = arguments ScanReport.new(results) end