macaddr-steakknife 1.8.5 → 1.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/macaddr.rb +9 -17
- data/lib/macaddr/version.rb +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57cbf6a8fbd425c5474e8e958b5dcea95802ee7
|
4
|
+
data.tar.gz: 2e56b45828bd7a85a3a9eda3be164dea4a08b349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce447a031629700c73c79c65c4cd5c55b570eb8c10524dcb9870c8793af458d0d87b780373773fc3e5436127ed34b1d8332b0a5602dd80ca912d1a2c22e6d8b3
|
7
|
+
data.tar.gz: 0fb9a3c0378464c8a98dd6d458b31ce4cf61482bac75b6c275fbc1ed52a75b548cc4ea53f33aa04ca6532f7e91dee4a307238e14a02cf953ab083dd1ede1f617
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/macaddr.rb
CHANGED
@@ -112,15 +112,15 @@ module Mac
|
|
112
112
|
.scan(LOOSE_MAC_REGEX) # mac address(es)
|
113
113
|
end
|
114
114
|
|
115
|
-
def
|
115
|
+
def from_cmd(cmd, name_regex, mac_regex=nil)
|
116
116
|
name = nil
|
117
|
-
%x{
|
117
|
+
%x{#{cmd}}
|
118
118
|
.split(/\n/)
|
119
119
|
.collect do |line|
|
120
|
-
if line =~
|
120
|
+
if line =~ name_regex
|
121
121
|
name = clean($1)
|
122
122
|
nil
|
123
|
-
elsif line =~
|
123
|
+
elsif mac_regex.nil? || line =~ mac_regex
|
124
124
|
mac = filter_mac(line)
|
125
125
|
[name, mac.first] if !name.nil? && !mac.empty?
|
126
126
|
end
|
@@ -128,20 +128,12 @@ module Mac
|
|
128
128
|
.compact
|
129
129
|
end
|
130
130
|
|
131
|
+
def from_ifconfig
|
132
|
+
from_cmd('ifconfig', /\A([^:\s]+):.*\z/, /(?:ether|HWaddr)\s+/)
|
133
|
+
end
|
134
|
+
|
131
135
|
def from_ipconfig
|
132
|
-
|
133
|
-
%x{ipconfig /all}
|
134
|
-
.split(/\n/)
|
135
|
-
.collect do |line|
|
136
|
-
if line =~ /\A[^:]+\s*adapter\s*([^:]+):\z/
|
137
|
-
name = clean($1)
|
138
|
-
nil
|
139
|
-
else
|
140
|
-
mac = filter_mac(line)
|
141
|
-
[name, mac.first] if !name.nil? && !mac.empty?
|
142
|
-
end
|
143
|
-
end
|
144
|
-
.compact
|
136
|
+
from_cmd('ipconfig /all', /\A[^:]+\s*adapter\s*([^:]+):\z/)
|
145
137
|
end
|
146
138
|
|
147
139
|
def from_getnameinfo
|
data/lib/macaddr/version.rb
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|