oui-offline 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0186bcd1fbaf8902a189bfa41da73427e0b7df7
4
- data.tar.gz: b553fb418502ad5d9028eafdd24d308c64814b4e
3
+ metadata.gz: ef710b1686ae31c0fd80f1f364280b877b262a14
4
+ data.tar.gz: 97802c5b54fcfe26df0654382a5943b860292eef
5
5
  SHA512:
6
- metadata.gz: 687a5cf5e2e9bc2d6de4613be2d44444bab75cf4535bb7072997fed38fb1dac71fbd8970918457dbec2c6973dba32423e7d7193a54a8429e0393abaf042cf5d4
7
- data.tar.gz: 09313a9cf06a123afa7e5bba35ea40968f8761dc0255ff8d1d51462edc0372b502bc6f75ae13601c94e71a5fa40efddc81a047afa2bf86c82c736862444ea878
6
+ metadata.gz: 1c72a04ee773060a2d3923456a4fe50b3c467066a313262025b3b05ba7da40317754b1d7d51dbd51076fd283d942f28d6407c6eaefa1114f8ba48deac81d9142
7
+ data.tar.gz: edfd1c36ed5b737bd8a88136bcd00333752fef82e30b588ce71ec50c930d0a10b9119dbade4febb574c42a644f6d7f930ddb35e281ad2927791039458704c15e
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -14,10 +14,24 @@
14
14
  }
15
15
 
16
16
  ## Installation
17
+ ### Gem (insecure installation)
18
+
19
+ ```shell
20
+ [sudo] gem install oui-offline
21
+ ```
22
+ ### Gem (secure installation)
23
+
24
+ ```shell
25
+ [sudo] gem cert --add <(curl -L https://gist.github.com/steakknife/5333881/raw/gem-public_cert.pem) # add my cert (do once)
26
+ [sudo] gem install -P HighSecurity oui-offline
27
+ ```
28
+
29
+ See also: [waxseal](https://github.com/steakknife/waxseal)
30
+
17
31
  ### Bundler Installation
18
32
 
19
33
  ```ruby
20
- gem 'oui', git: 'https://github.com/steakknife/oui.git'
34
+ gem 'oui-offline', git: 'https://github.com/steakknife/oui.git'
21
35
  ```
22
36
 
23
37
  ### Manual Installation
@@ -29,9 +43,13 @@ gem 'oui', git: 'https://github.com/steakknife/oui.git'
29
43
  gem install *.gem
30
44
 
31
45
 
46
+ ## Lookup an OUI from CLI
47
+
48
+ `oui lookup ABCDEF`
49
+
32
50
  ## Data
33
51
 
34
- Database sourced from the public IEEE list, but it can be rebuilt anytime by running `bin/update_db` or `OUI.update_db`
52
+ Database sourced from the public IEEE list, but it can be rebuilt anytime by running `oui update` or `OUI.update_db`
35
53
 
36
54
  ## License
37
55
 
data/lib/oui.rb CHANGED
@@ -85,7 +85,7 @@ module OUI
85
85
  if IN_MEMORY_ONLY
86
86
  Sequel.sqlite # in-memory sqlite database
87
87
  else
88
- $stderr.puts "Connecting to db file #{LOCAL_DB}"
88
+ debug "Connecting to db file #{LOCAL_DB}"
89
89
  connect_file_db LOCAL_DB
90
90
  end
91
91
  end
@@ -188,7 +188,7 @@ module OUI
188
188
  end
189
189
 
190
190
  def fetch
191
- $stderr.puts "Fetching #{OUI_URL}"
191
+ debug "Fetching #{OUI_URL}"
192
192
  open(OUI_URL).read
193
193
  end
194
194
 
@@ -208,9 +208,9 @@ module OUI
208
208
  lines = fetch.split("\n").map { |x| x.sub(/\r$/, '') }
209
209
  parse_lines_into_groups(lines).each_with_index do |group, idx|
210
210
  create_from_line_group(group)
211
- $stderr.print "#{ERASE_LINE}Created records #{idx}" if idx % 1000 == 0
211
+ debug "#{ERASE_LINE}Created records #{idx}" if idx % 1000 == 0
212
212
  end.count
213
- $stderr.puts "#{ERASE_LINE}#{BLANK_LINE}"
213
+ debug "#{ERASE_LINE}#{BLANK_LINE}"
214
214
  end
215
215
 
216
216
  # Expected duplicates are 00-01-C8 (2x) and 08-00-30 (3x)
@@ -223,11 +223,15 @@ module OUI
223
223
  @added ||= {}
224
224
  end
225
225
 
226
+ def debug(*args)
227
+ $stderr.puts(*args) if $DEBUG
228
+ end
229
+
226
230
  def create_unless_present(opts)
227
231
  id = opts[:id]
228
232
  if added[id]
229
233
  unless expected_duplicate? id
230
- $stderr.puts "OUI unexpected duplicate #{opts}"
234
+ debug "OUI unexpected duplicate #{opts}"
231
235
  end
232
236
  else
233
237
  table.insert(opts)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification::new do |s|
2
2
  s.name = 'oui-offline'
3
- s.version = '1.0.0'
3
+ s.version = '1.0.1'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = 'Organizationally Unique Idenitfiers (OUI)'
6
6
  s.description = 'Organizationally Unique Idenitfiers (OUI) offline database'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oui-offline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barry Allard
metadata.gz.sig CHANGED
Binary file