arp_scan 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/arp_scan/arp_scanner.rb +2 -2
- data/lib/arp_scan/scan_report.rb +6 -1
- data/lib/arp_scan/scan_result_processor.rb +2 -1
- data/lib/arp_scan/version.rb +1 -1
- data/spec/scan_report_spec.rb +8 -1
- data/spec/scan_result_processor_spec.rb +6 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34dd3d80cf5837da8b1fbaba13bdf550e7ce1cb7
|
4
|
+
data.tar.gz: 1192b2fbba626243f283c26c86f86ae14c3d42dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12f73da6dd9d7e339ca33b02d334015d736e1be0b65355450e78feffce5154df927914e7cb4d1a491b908db697723ce484693c1e1650a7e389a7b71f52eac794
|
7
|
+
data.tar.gz: 4fdfbb69b73022af9ebda830a85ea58bff8a06fc876e21e439884cf53c1d0d99cd8ea36ac671fc5fa46b3dccbe02761904a78df9d2c3bf71194712be068bb5fa
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# ARPScan
|
2
2
|
|
3
|
+
[](https://www.omniref.com/ruby/gems/arp_scan)
|
5
|
+
|
3
6
|
Very simple wrapper for using and parsing output from `arp-scan`.
|
4
7
|
|
5
8
|
You will need to make sure `arp-scan` is installed. See the arp-scan homepage at http://www.nta-monitor.com/tools/arp-scan/
|
@@ -70,6 +73,7 @@ report.reply_count => 2
|
|
70
73
|
report.scan_rate => 169.99 # hosts/sec
|
71
74
|
report.scan_time => 1.586 # seconds
|
72
75
|
report.version => "1.8.1" # arp-scan version
|
76
|
+
report.arguments => "--localnet"
|
73
77
|
```
|
74
78
|
|
75
79
|
Each `ScanReport` also holds zero or more `Host` objects representing founds
|
data/lib/arp_scan/arp_scanner.rb
CHANGED
@@ -18,7 +18,7 @@ module ARPScan
|
|
18
18
|
return exe if File.executable?(exe) && !File.directory?(exe)
|
19
19
|
}
|
20
20
|
end
|
21
|
-
|
21
|
+
raise 'arp-scan binary not found, make sure it is installed'
|
22
22
|
end
|
23
23
|
|
24
24
|
# This method runs the actual scan by passing the arguments to the arp-scan
|
@@ -27,7 +27,7 @@ module ARPScan
|
|
27
27
|
#
|
28
28
|
def self.scan(argument_string = nil)
|
29
29
|
result_string = `#{which 'arp-scan'} #{argument_string}`
|
30
|
-
ScanResultProcessor.process(result_string)
|
30
|
+
ScanResultProcessor.process(result_string, argument_string)
|
31
31
|
end
|
32
32
|
|
33
33
|
private_class_method :which
|
data/lib/arp_scan/scan_report.rb
CHANGED
@@ -36,6 +36,9 @@ module ARPScan
|
|
36
36
|
# The number of hosts that replied to the scan, returns a Fixnum
|
37
37
|
attr_reader :reply_count
|
38
38
|
|
39
|
+
# The argument string passed to ARPScan
|
40
|
+
attr_reader :arguments
|
41
|
+
|
39
42
|
# Create a new scan report, passing in every attribute. The best way to do
|
40
43
|
# this is with the ScanResultProcessor module.
|
41
44
|
#
|
@@ -48,6 +51,7 @@ module ARPScan
|
|
48
51
|
@scan_time = Float(hash[:scan_time])
|
49
52
|
@scan_rate = Float(hash[:scan_rate])
|
50
53
|
@reply_count = Integer(hash[:reply_count])
|
54
|
+
@arguments = hash[:arguments]
|
51
55
|
end
|
52
56
|
|
53
57
|
# Returns an array representation of the ScanReport. Metadata about the
|
@@ -74,7 +78,8 @@ module ARPScan
|
|
74
78
|
:range_size => @range_size,
|
75
79
|
:scan_time => @scan_time,
|
76
80
|
:scan_rate => @scan_rate,
|
77
|
-
:reply_count => @reply_count
|
81
|
+
:reply_count => @reply_count,
|
82
|
+
:arguments => @arguments
|
78
83
|
}
|
79
84
|
end
|
80
85
|
|
@@ -24,7 +24,7 @@ module ARPScan
|
|
24
24
|
# uses the Regexes to capture data then passes the results to ScanRepor.new
|
25
25
|
# to return a ScanReport object.
|
26
26
|
#
|
27
|
-
def self.process(string)
|
27
|
+
def self.process(string, arguments)
|
28
28
|
results = {}
|
29
29
|
results[:hosts] = string.scan(Host_Entry_Regex).map {|entry| Host.new(*entry)}
|
30
30
|
results[:interface],
|
@@ -34,6 +34,7 @@ module ARPScan
|
|
34
34
|
results[:scan_time],
|
35
35
|
results[:scan_rate],
|
36
36
|
results[:reply_count] = string.scan(Scan_Summary_Regex)[0]
|
37
|
+
results[:arguments] = arguments
|
37
38
|
ScanReport.new(results)
|
38
39
|
end
|
39
40
|
end
|
data/lib/arp_scan/version.rb
CHANGED
data/spec/scan_report_spec.rb
CHANGED
@@ -11,7 +11,8 @@ module ARPScan
|
|
11
11
|
:range_size => 256,
|
12
12
|
:scan_time => 1.503,
|
13
13
|
:scan_rate => 170.33,
|
14
|
-
:reply_count => 1
|
14
|
+
:reply_count => 1,
|
15
|
+
:arguments => '-l'
|
15
16
|
}
|
16
17
|
|
17
18
|
scan_report = ScanReport.new(report_hash)
|
@@ -64,5 +65,11 @@ module ARPScan
|
|
64
65
|
expect(scan_report.reply_count).to eq(1)
|
65
66
|
end
|
66
67
|
end
|
68
|
+
|
69
|
+
describe "#arguments" do
|
70
|
+
it "returns the argument string used to scan" do
|
71
|
+
expect(scan_report.arguments).to eq('-l')
|
72
|
+
end
|
73
|
+
end
|
67
74
|
end
|
68
75
|
end
|
@@ -3,15 +3,15 @@ require_relative './spec_helper'
|
|
3
3
|
module ARPScan
|
4
4
|
describe ScanResultProcessor do
|
5
5
|
|
6
|
+
argument_string = '-l'
|
6
7
|
report_string = File.read './test_output.txt'
|
7
|
-
report = ARPScan::ScanResultProcessor.process(report_string)
|
8
|
+
report = ARPScan::ScanResultProcessor.process(report_string, argument_string)
|
8
9
|
|
9
10
|
describe "#process" do
|
10
11
|
it "processes arp-scan output to create a ScanReport object" do
|
11
12
|
expect(report.class).to eq(ARPScan::ScanReport)
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
15
|
it "builds an array of Host objects" do
|
16
16
|
expect(report.hosts[0].class).to eq(ARPScan::Host)
|
17
17
|
end
|
@@ -43,6 +43,10 @@ module ARPScan
|
|
43
43
|
it "parses the number of hosts that responded to the scan" do
|
44
44
|
expect(report.reply_count).to eq(1)
|
45
45
|
end
|
46
|
+
|
47
|
+
it "includes the argument string in the report" do
|
48
|
+
expect(report.arguments).to eq('-l')
|
49
|
+
end
|
46
50
|
end
|
47
51
|
end
|
48
52
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arp_scan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Rodrigues
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
description: Easily use the arp-scan utility from within your ruby programs.
|
@@ -72,17 +72,17 @@ require_paths:
|
|
72
72
|
- lib
|
73
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.4.
|
85
|
+
rubygems_version: 2.4.5
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: A ruby wrapper for the arp-scan utility.
|