arpscanner 0.1.0 → 0.3.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 +41 -8
- metadata +48 -25
- 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: 79412d2b6cbd20c5aed889a22213156630d39bea4b69cba50810382ac7fd8e1a
|
4
|
+
data.tar.gz: 0f770e3e16c96f0a34454a21be2e7a50bca2867a40d609dd231a81c876169542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68d1bd4c340df4fd9463f6f13f60f14b2dd8e635d5f3f1aed665ba3aa10a4d6c589be63c725e00ea84a62b1323f4e72b141cac7c8face72e4b46c16f63e5c670
|
7
|
+
data.tar.gz: a268575887f08bccb4af0bed2fa668d4ca1d1f1a34f3a7feb5cf6a87d7192a3c209e088cd57581a98c1badd5185f198115790b3ff3ec60e7efd432d26b00226e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/arpscanner.rb
CHANGED
@@ -2,40 +2,73 @@
|
|
2
2
|
|
3
3
|
# file: arpscanner.rb
|
4
4
|
|
5
|
+
require 'resolv' # resolv is a built-in Ruby library
|
6
|
+
require 'dynarex'
|
7
|
+
|
5
8
|
|
6
9
|
class ArpScanner
|
7
|
-
|
8
|
-
|
10
|
+
using ColouredText
|
11
|
+
|
12
|
+
# options:
|
13
|
+
# nic: e.g. eth0, enp2s0f0
|
14
|
+
#
|
15
|
+
def initialize(nic: `ip addr`[/(?<=global )\w+/], vendors: {},
|
16
|
+
nameserver: nil)
|
9
17
|
|
10
18
|
package = 'arp-scan'
|
19
|
+
@vendors, @nameserver = vendors, nameserver
|
11
20
|
|
12
21
|
found = `dpkg --get-selections | grep #{package}`
|
13
22
|
|
14
23
|
if found.empty? then
|
15
|
-
raise 'ArpScanner: arp-
|
24
|
+
raise 'ArpScanner: arp-scan package not found'.error
|
16
25
|
end
|
17
26
|
|
18
|
-
@arpscan_cmd = "sudo #{package} --interface
|
27
|
+
@arpscan_cmd = "sudo #{package} --interface=#{nic} --localnet"
|
19
28
|
|
20
29
|
end
|
21
30
|
|
22
31
|
def scan()
|
23
32
|
|
24
33
|
a = `#{@arpscan_cmd}`.lines
|
25
|
-
|
26
|
-
a2 = a.map
|
34
|
+
|
35
|
+
a2 = a[2..-4].map do |x|
|
36
|
+
|
37
|
+
r = %i(ip mfr mac).zip(x.chomp.split("\t").values_at(0,2,1))
|
38
|
+
|
39
|
+
if @nameserver then
|
40
|
+
|
41
|
+
begin
|
42
|
+
hostname = Resolv::DNS.new(:nameserver => [@nameserver]).getname(r[0][1]).to_s
|
43
|
+
rescue
|
44
|
+
hostname = ''
|
45
|
+
puts ($!).to_s.warning
|
46
|
+
end
|
47
|
+
|
48
|
+
r.insert(1, [:hostname, hostname])
|
49
|
+
|
50
|
+
else
|
51
|
+
%i(ip mfr mac).zip(x.chomp.split("\t")).to_h
|
52
|
+
end
|
53
|
+
|
54
|
+
r.to_h
|
55
|
+
|
56
|
+
end
|
27
57
|
|
28
58
|
# Add additional vendors
|
29
|
-
h = {/^b8:27:eb:/ => 'Raspberry Pi Foundation'}
|
59
|
+
h = {/^b8:27:eb:/ => 'Raspberry Pi Foundation'}.merge(@vendors)
|
30
60
|
|
31
|
-
a2.map do |x|
|
61
|
+
a2.map! do |x|
|
32
62
|
|
33
63
|
_, vendor = h.detect {|mac, mfr| x[:mac] =~ mac }
|
34
64
|
x[:mfr] = vendor if vendor
|
35
65
|
x
|
36
66
|
|
37
67
|
end
|
68
|
+
|
69
|
+
Dynarex.new.import a2
|
38
70
|
|
39
71
|
end
|
72
|
+
|
40
73
|
|
41
74
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,29 +10,53 @@ 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/DuvFLREiYHMDX5BELUXwCGlgtHpa7KEkEfP+8B
|
21
|
+
EUYEz219k+9y+RcReWoiDUsHN0q6lbnmNAP7j3vyEulIvLFRNzpLXJ2Z6HjV9wOA
|
22
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FICATE-----
|
34
|
-
date:
|
35
|
-
dependencies:
|
38
|
+
date: 2020-08-22 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: dynarex
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.8'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.8.27
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.8'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.8.27
|
36
60
|
description:
|
37
61
|
email: james@jamesrobertson.eu
|
38
62
|
executables: []
|
@@ -59,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
83
|
- !ruby/object:Gem::Version
|
60
84
|
version: '0'
|
61
85
|
requirements: []
|
62
|
-
|
63
|
-
rubygems_version: 2.6.8
|
86
|
+
rubygems_version: 3.0.3
|
64
87
|
signing_key:
|
65
88
|
specification_version: 4
|
66
89
|
summary: A wrapper for the package arp-scan. It can detect if a found MAC address
|
metadata.gz.sig
CHANGED
Binary file
|