arpscanner 0.1.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/arpscanner.rb +45 -9
- metadata +51 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 48b68acf51dd79503e0d3db993c24eaa086b48014d953d0e14f3f0a9c905dff9
|
4
|
+
data.tar.gz: 78a39058f68d2b92bb1d57ed76c02d7a9ea4edfffb3ee6758c0e259fe2f14434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6865c71ad712163949fd2e32d348db89d0ccde01f4760ffae6e5bc4200c5f357a25bb200844f56e1f0cb6e250f1e682dde8046d397e8db87baf8188e6d5115
|
7
|
+
data.tar.gz: 5b6bd8004c5d133edea82813e2e60cd88c06967e5571afde520e73b3992ceb9502f5363b93da1742a52fe3e90beaebdb18c7b9a1dd0d0386193702c0ba9841ef
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/arpscanner.rb
CHANGED
@@ -2,32 +2,69 @@
|
|
2
2
|
|
3
3
|
# file: arpscanner.rb
|
4
4
|
|
5
|
+
require 'resolv' # resolv is a built-in Ruby library
|
5
6
|
require 'dynarex'
|
7
|
+
require 'mactovendor'
|
8
|
+
|
6
9
|
|
7
10
|
class ArpScanner
|
8
|
-
|
9
|
-
|
11
|
+
using ColouredText
|
12
|
+
|
13
|
+
# options:
|
14
|
+
# nic: e.g. eth0, enp2s0f0
|
15
|
+
#
|
16
|
+
def initialize(nic: `ip addr`[/(?<=global )\w+/], vendors: {},
|
17
|
+
nameserver: nil)
|
10
18
|
|
11
19
|
package = 'arp-scan'
|
20
|
+
@vendors, @nameserver = vendors, nameserver
|
12
21
|
|
13
22
|
found = `dpkg --get-selections | grep #{package}`
|
14
23
|
|
15
24
|
if found.empty? then
|
16
|
-
raise 'ArpScanner: arp-
|
25
|
+
raise 'ArpScanner: arp-scan package not found'.error
|
17
26
|
end
|
18
27
|
|
19
|
-
@arpscan_cmd = "sudo #{package} --interface
|
28
|
+
@arpscan_cmd = "sudo #{package} --interface=#{nic} --localnet"
|
20
29
|
|
21
30
|
end
|
22
31
|
|
23
32
|
def scan()
|
24
33
|
|
25
34
|
a = `#{@arpscan_cmd}`.lines
|
35
|
+
|
36
|
+
a2 = a[2..-4].map do |x|
|
26
37
|
|
27
|
-
|
38
|
+
r = %i(ip mfr mac).zip(x.chomp.split("\t").values_at(0,2,1))
|
39
|
+
|
40
|
+
if @nameserver then
|
41
|
+
|
42
|
+
begin
|
43
|
+
hostname = Resolv::DNS.new(:nameserver => [@nameserver]).getname(r[0][1]).to_s
|
44
|
+
rescue
|
45
|
+
hostname = ''
|
46
|
+
puts ($!).to_s.warning
|
47
|
+
end
|
48
|
+
|
49
|
+
r.insert(1, [:hostname, hostname])
|
50
|
+
|
51
|
+
else
|
52
|
+
%i(ip mfr mac).zip(x.chomp.split("\t")).to_h
|
53
|
+
end
|
54
|
+
|
55
|
+
h = r.to_h
|
56
|
+
|
57
|
+
if h[:mfr] == '(Unknown)' then
|
58
|
+
vendor = MacToVendor.find h[:mac]
|
59
|
+
h[:mfr] = vendor if vendor
|
60
|
+
end
|
61
|
+
|
62
|
+
h
|
63
|
+
|
64
|
+
end
|
28
65
|
|
29
66
|
# Add additional vendors
|
30
|
-
h = {/^b8:27:eb:/ => 'Raspberry Pi Foundation'}
|
67
|
+
h = {/^b8:27:eb:/ => 'Raspberry Pi Foundation'}.merge(@vendors)
|
31
68
|
|
32
69
|
a2.map! do |x|
|
33
70
|
|
@@ -37,10 +74,9 @@ class ArpScanner
|
|
37
74
|
|
38
75
|
end
|
39
76
|
|
40
|
-
|
41
|
-
@dx.import a2
|
77
|
+
Dynarex.new.import a2
|
42
78
|
|
43
79
|
end
|
44
80
|
|
45
81
|
|
46
|
-
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arpscanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwODIyMjE1MjI4WhcN
|
15
|
+
MjEwODIyMjE1MjI4WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC2yZsN
|
17
|
+
ZVizvyMG5JScuVhKSEJ9fv33KWpRkiCV7n2D/SUFxFvt/3zk77o7RsZ3cHD0a6P7
|
18
|
+
gTt+1HWxxUK4OwIgxpyOAVtg47+ns/e23OTmxBsPNyqp1up/3uNnkwwQQQTkBBqp
|
19
|
+
u6o+X6fiptHKIUh/WQF1i4uvhiGkf3BH0Kbvb1L1CSITZMlGuuasWZAwNyOn+rMk
|
20
|
+
mjylFhI5Un3cck7+L2iwAjFwR/DuvFLREiYHMDX5BELUXwCGl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yXjy1/2XJC9E3Ca9wr7MWld01vUdMbC0TZaqTGM+7+dejp
|
36
|
+
bCPG9KW8LldPMB4NjEePBmN1
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2020-08-22 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: dynarex
|
@@ -39,20 +43,40 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "~>"
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version: '1.
|
46
|
+
version: '1.8'
|
43
47
|
- - ">="
|
44
48
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.
|
49
|
+
version: 1.8.27
|
46
50
|
type: :runtime
|
47
51
|
prerelease: false
|
48
52
|
version_requirements: !ruby/object:Gem::Requirement
|
49
53
|
requirements:
|
50
54
|
- - "~>"
|
51
55
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
56
|
+
version: '1.8'
|
53
57
|
- - ">="
|
54
58
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
59
|
+
version: 1.8.27
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: mactovendor
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.1.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.1.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.1'
|
56
80
|
description:
|
57
81
|
email: james@jamesrobertson.eu
|
58
82
|
executables: []
|
@@ -79,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
103
|
- !ruby/object:Gem::Version
|
80
104
|
version: '0'
|
81
105
|
requirements: []
|
82
|
-
|
83
|
-
rubygems_version: 2.6.8
|
106
|
+
rubygems_version: 3.0.3
|
84
107
|
signing_key:
|
85
108
|
specification_version: 4
|
86
109
|
summary: A wrapper for the package arp-scan. It can detect if a found MAC address
|
metadata.gz.sig
CHANGED
Binary file
|