oui-offline 1.2.5-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 286617edad02d732f5d3934f3b6f293fda5e421d
4
+ data.tar.gz: af07a576875323684c9025177179204327572565
5
+ SHA512:
6
+ metadata.gz: 655a7b5b61d3eb2c16c4cf7b23d812c94a2464f3f936925a94e9e5843a6cb4aee69fb83dbca156e4771ab4840b179ec147ae2dc8c335943a6b7d9862c1cbc329
7
+ data.tar.gz: 3d0dd3c43705d172ebfc19376910d3f187bd01645a63d0d9e4e033d35057f858f388d808f9d5944b06035f15723bd9dc92785362740dfa268554de1258932240
checksums.yaml.gz.sig ADDED
Binary file
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+ gem 'rake'
4
+ if RUBY_PLATFORM == 'java'
5
+ gem 'jdbc-sqlite3'
6
+ else
7
+ gem 'sqlite3', '~> 1'
8
+ end
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ [![Build Status](https://travis-ci.org/steakknife/oui.svg)](https://travis-ci.org/steakknife/oui)
2
+ # OUI (Organizationally Unique Identifiers)
3
+
4
+ The 24-bit prefix of MAC / EUI-\* addresses.
5
+
6
+ This is a Ruby library and CLI tool `oui`
7
+
8
+ ## Usage
9
+
10
+ ```ruby
11
+ > OUI.find 'AA-BB-CC'
12
+ => nil
13
+ > OUI.find '00:0c:85'
14
+ => {
15
+ :id => 3205,
16
+ :organization => "CISCO SYSTEMS, INC.",
17
+ :address1 => "170 W. TASMAN DRIVE",
18
+ :address2 => "M/S SJA-2",
19
+ :address3 => "SAN JOSE CA 95134-1706",
20
+ :country => "UNITED STATES"
21
+ }
22
+ ```
23
+
24
+ ## CLI usage
25
+
26
+ ```text
27
+ Usage: oui lookup [options...] oui+ # get corp name, oui in 24-bit oui in hex format
28
+
29
+ -j JSON verbose output
30
+ -r Ruby verbose output
31
+ -y YAML verbose output
32
+
33
+ oui update # update oui internal db from ieee.org
34
+ ```
35
+
36
+ ## Installation
37
+ ### Gem (insecure installation)
38
+
39
+ ```shell
40
+ [sudo] gem install oui-offline
41
+ ```
42
+ ### Gem (secure installation)
43
+
44
+ ```shell
45
+ [sudo] gem cert --add <(curl -L https://gist.github.com/steakknife/5333881/raw/gem-public_cert.pem) # add my cert (do once)
46
+ [sudo] gem install -P MediumSecurity oui-offline
47
+ ```
48
+
49
+ See also: [waxseal](https://github.com/steakknife/waxseal)
50
+
51
+ ### Bundler Installation
52
+
53
+ ```ruby
54
+ gem 'oui-offline'
55
+ ```
56
+
57
+ ### Manual Installation
58
+
59
+ cd ${TMP_DIR-/tmp}
60
+ git clone https://github.com/steakknife/oui
61
+ cd oui
62
+ gem build *.gemspec
63
+ gem install *.gem
64
+
65
+
66
+ ## Lookup an OUI from CLI
67
+
68
+ `oui lookup ABCDEF`
69
+
70
+ ## Data source
71
+
72
+ Database sourced from the public IEEE list, but it can be rebuilt anytime by running `oui update` or `OUI.update_db`
73
+ The few duplicates that are of multiple entities per OUI instead choose the first registration.
74
+
75
+ ## Unregistered OUIs
76
+
77
+ Place custom/unregistered OUIs in `data/oui-manual.json` and re-run `oui update` or `OUI.update_db`. Feel free to submit a PR to update these permanently.
78
+
79
+ ## Return format
80
+
81
+ `OUI.find('00-00-00')` returns a hash like this:
82
+
83
+ ```ruby
84
+ {:id => 0,
85
+ :organization => "XEROX CORPORATION",
86
+ :address1 => "M/S 105-50C",
87
+ :address2 => "800 PHILLIPS ROAD",
88
+ :address3 => "WEBSTER NY 14580",
89
+ :country => "UNITED STATES"}
90
+
91
+
92
+ The `id` column is a stable, reversible conversion of the OUI as follows: the hexadecimal value of the OUI) to unsigned integer in network order (id).
93
+
94
+ - Use `OUI.oui_to_i('aa-bb-cc')` to obtain an `id` from an OUI
95
+ - Use `OUI.to_s(12345)` to do the inverse, obtain an OUI from an `id`
96
+
97
+ ## Supported Ruby Engines
98
+
99
+ - JRuby
100
+ - Ruby 1.9.3+ (until February 2015), 2.*
101
+
102
+ ## Tested Ruby Engines
103
+
104
+ - JRuby 1.7.*
105
+ - Ruby (MRI) 2.2.*
106
+
107
+ ## Thanks
108
+
109
+ [Your name here]
110
+
111
+ ## License
112
+
113
+ MIT
data/bin/oui ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+ root = File.dirname(File.expand_path('..', __FILE__))
3
+ lib_dir = File.join(root, 'lib')
4
+ $:.unshift lib_dir unless $:.include? lib_dir
5
+ require 'oui'
6
+ autoload :JSON, 'json'
7
+ autoload :YAML, 'yaml'
8
+
9
+
10
+ case ARGV.shift
11
+ when 'lookup'
12
+ def output(r)
13
+ if @yaml_output
14
+ YAML.dump r
15
+ elsif @json_output
16
+ JSON.dump r
17
+ elsif @ruby_output
18
+ r
19
+ else
20
+ r[:organization]
21
+ end
22
+ end
23
+
24
+ success = nil
25
+ # TODO: OptParse || thor
26
+ @json_output = ARGV.delete '-j'
27
+ @ruby_output = ARGV.delete '-r'
28
+ @yaml_output = ARGV.delete '-y'
29
+ formats = [@ruby_output, @json_output, @yaml_output].count { |x| x };
30
+ fail 'Only one format flag is allowed' if formats > 1
31
+ ARGV.map do |mac|
32
+ r = OUI.find(mac)
33
+ success &= !!r
34
+ r ||= {}
35
+ puts(output(r))
36
+ end
37
+ exit 1 unless success
38
+
39
+ when 'update'
40
+ if ARGV.delete '-l'
41
+ OUI.update_db(local = true)
42
+ else
43
+ OUI.update_db
44
+ end
45
+
46
+ else
47
+ $stderr.puts <<-EOS
48
+ Usage: oui lookup [options...] oui+ # get corp name, oui in 24-bit oui in hex format
49
+
50
+ -j JSON verbose output
51
+ -r Ruby verbose output
52
+ -y YAML verbose output
53
+
54
+ oui update [options...] # update oui internal db from ieee.org
55
+
56
+ -l dont connect to network, instead use data/oui.txt
57
+
58
+ EOS
59
+ exit 1
60
+ end
61
+
@@ -0,0 +1,7 @@
1
+ [
2
+ {"id": "00:D3:10", "organization": "Dell, Inc., for Dell Compellent Storage products"},
3
+ {"id": "0A:BB:CF", "organization": "Apple, Inc., Bluetooth PAN"},
4
+ {"id": "6A:5B:35", "organization": "Apple, Inc., Bridge and bond devices (virtual)"},
5
+ {"id": "CA:6F:1D", "organization": "Apple, Inc., iPhone USB"},
6
+ {"id": "D2:00:1A", "organization": "Apple, Inc., Thunderbolt"}
7
+ ]