hwid 0.2.7 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/hwid.gemspec +14 -0
- data/lib/hwid/base.rb +6 -2
- data/test/test_helper.rb +2 -6
- data/test/test_hwid.rb +6 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 435704cced440b14a5acd917ee320fd80d7554158678b714d6677912049f3920
|
4
|
+
data.tar.gz: e84f5730ad744e0e40d11897f08ee57ad1b4de5cd17e485d4337f061a46c4527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e06d03aa7342f371497921396d8275a5dd7eab3074f22bf4caa93974e41c4cfac9ea01600db286054d890fdef59efc16ea8212986a8c5507b4fefbd3e0434331
|
7
|
+
data.tar.gz: 4798b145ba45655c3bbbf42fcd800e12ec022c440f1c3609978aa5ca9d5ce57ae7a415adc985f18044174468ddb812e0ecaa84a03df59eba3502cf0ea42ae4d2
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hwid (0.2
|
4
|
+
hwid (0.3.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
codeclimate-test-reporter (0.
|
10
|
-
simplecov (
|
9
|
+
codeclimate-test-reporter (1.0.9)
|
10
|
+
simplecov (<= 0.13)
|
11
11
|
docile (1.1.5)
|
12
|
-
|
13
|
-
|
14
|
-
simplecov (0.
|
12
|
+
json (2.3.1)
|
13
|
+
minitest (5.14.1)
|
14
|
+
simplecov (0.13.0)
|
15
15
|
docile (~> 1.1.0)
|
16
|
-
|
17
|
-
simplecov-html (~> 0.
|
18
|
-
simplecov-html (0.
|
16
|
+
json (>= 1.8, < 3)
|
17
|
+
simplecov-html (~> 0.10.0)
|
18
|
+
simplecov-html (0.10.2)
|
19
19
|
|
20
20
|
PLATFORMS
|
21
21
|
ruby
|
@@ -26,7 +26,7 @@ DEPENDENCIES
|
|
26
26
|
minitest
|
27
27
|
|
28
28
|
RUBY VERSION
|
29
|
-
ruby 2.
|
29
|
+
ruby 2.6.6p146
|
30
30
|
|
31
31
|
BUNDLED WITH
|
32
|
-
1.
|
32
|
+
1.17.3
|
data/hwid.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "hwid"
|
3
|
+
s.version = "0.3.2"
|
4
|
+
s.author = "Scott Sproule"
|
5
|
+
s.email = "scott.sproule@ficonab.com"
|
6
|
+
s.homepage = "http://github.com/semdinsp/hwid"
|
7
|
+
s.summary = "Hardware id for mac and rasp pi (not secure)"
|
8
|
+
s.description = "Get a rough hardware id of the system that the gem is running on"
|
9
|
+
s.executables = ['hwid.rb'] #should be "name.rb"
|
10
|
+
s.files = Dir["{lib,test}/**/*"] +Dir["bin/*.rb"] + Dir["[A-Z]*"] # + ["init.rb"]
|
11
|
+
s.require_path = "lib"
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.required_rubygems_version = ">= 1.3.4"
|
14
|
+
end
|
data/lib/hwid/base.rb
CHANGED
@@ -30,6 +30,7 @@ module Hwid
|
|
30
30
|
platform << "x86" if (/x86/ =~ RUBY_PLATFORM) != nil
|
31
31
|
platform << "i686" if (/i686/ =~ RUBY_PLATFORM) != nil
|
32
32
|
platform << "debian" if `uname -a`.include?('Debian')
|
33
|
+
platform << "ubuntu" if `uname -a`.include?('Ubuntu')
|
33
34
|
platform << "linux" if (/linux/ =~ RUBY_PLATFORM) != nil
|
34
35
|
platform
|
35
36
|
end
|
@@ -40,6 +41,7 @@ module Hwid
|
|
40
41
|
return get_rasp_id if platform.include?("raspberry 2")
|
41
42
|
return get_mac_id if platform.include?("mac")
|
42
43
|
return get_linuxdebian_id if platform.include?("debian") #virtaul box ??
|
44
|
+
return get_linuxdebian_id if platform.include?("ubuntu") #virtaul box ??
|
43
45
|
return get_linux_id if platform.include?("linux")
|
44
46
|
end
|
45
47
|
def run_cmd(cmd)
|
@@ -62,8 +64,10 @@ module Hwid
|
|
62
64
|
def get_linuxdebian_id
|
63
65
|
res="Serial: unknown"
|
64
66
|
# lshw -quiet -class cpu -disable usb -disable network -disable pci -disable cpuinfo -disable dmi -disable memory -disable isapnp -disable ide -disable device-tree -disable spd | grep -oP '(serial: )\K.*
|
65
|
-
res=run_cmd("lshw -quiet -class cpu -disable usb -disable network -disable pci -disable cpuinfo -disable dmi -disable memory -disable isapnp -disable ide -disable device-tree -disable spd | grep -oP '(serial: )\\K.*'")
|
66
|
-
|
67
|
+
# res=run_cmd("lshw -quiet -class cpu -disable usb -disable network -disable pci -disable cpuinfo -disable dmi -disable memory -disable isapnp -disable ide -disable device-tree -disable spd | grep -oP '(serial: )\\K.*'")
|
68
|
+
res=run_cmd("lshw -quiet -class cpu -class network -disable usb -disable pci -disable cpuinfo -disable dmi -disable memory -disable isapnp -disable ide -disable device-tree -disable spd | grep -oP '(serial: )\\K.*'")
|
69
|
+
res=res.gsub("0000-","")
|
70
|
+
res=res.gsub("\n","")
|
67
71
|
#res=run_cmd("lshw | grep -A 10 '*-cpu' | grep -oP '(serial: )\\K.*'")
|
68
72
|
#puts "Interim result is #{res.inspect}"
|
69
73
|
res=res.chomp
|
data/test/test_helper.rb
CHANGED
@@ -1,16 +1,12 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
1
3
|
puts "in test helper"
|
2
4
|
require 'rubygems'
|
3
5
|
require 'bundler/setup'
|
4
6
|
require "codeclimate-test-reporter"
|
5
|
-
CodeClimate::TestReporter.start
|
6
7
|
require 'stringio'
|
7
8
|
require 'minitest/autorun'
|
8
9
|
require 'minitest/unit'
|
9
|
-
SimpleCov.command_name 'test'
|
10
|
-
#SimpleCov.profiles.define 'mygem' do
|
11
|
-
# add_group "Gem", '/lib/' # additional config here
|
12
|
-
#end
|
13
|
-
SimpleCov.start
|
14
10
|
|
15
11
|
require File.dirname(__FILE__) + '/../lib/hwid'
|
16
12
|
|
data/test/test_hwid.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
puts File.dirname(__FILE__)
|
2
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
#require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'rubygems'
|
4
|
+
require File.expand_path("../test_helper", __FILE__)
|
5
|
+
#require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
#require 'test_helper.rb'
|
3
7
|
|
4
8
|
|
5
9
|
class HwidTest < Minitest::Test
|
@@ -38,4 +42,4 @@ class HwidTest < Minitest::Test
|
|
38
42
|
end
|
39
43
|
|
40
44
|
|
41
|
-
|
45
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hwid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Sproule
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Get a rough hardware id of the system that the gem is running on
|
14
14
|
email: scott.sproule@ficonab.com
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- Gemfile.lock
|
22
22
|
- README.md
|
23
23
|
- bin/hwid.rb
|
24
|
+
- hwid.gemspec
|
24
25
|
- lib/hwid.rb
|
25
26
|
- lib/hwid/base.rb
|
26
27
|
- test/coverage/assets/0.7.1/application.css
|
@@ -94,7 +95,7 @@ homepage: http://github.com/semdinsp/hwid
|
|
94
95
|
licenses:
|
95
96
|
- MIT
|
96
97
|
metadata: {}
|
97
|
-
post_install_message:
|
98
|
+
post_install_message:
|
98
99
|
rdoc_options: []
|
99
100
|
require_paths:
|
100
101
|
- lib
|
@@ -109,9 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
110
|
- !ruby/object:Gem::Version
|
110
111
|
version: 1.3.4
|
111
112
|
requirements: []
|
112
|
-
|
113
|
-
|
114
|
-
signing_key:
|
113
|
+
rubygems_version: 3.0.8
|
114
|
+
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Hardware id for mac and rasp pi (not secure)
|
117
117
|
test_files: []
|