hwid 0.3.1 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hwid/base.rb +15 -1
- data/test/test_helper.rb +2 -6
- data/test/test_hwid.rb +6 -2
- metadata +6 -9
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -32
- data/README.md +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df9b22d944cd80752570ecab0e5166e41346de4120ddb27f0bf9a52e9d5e4a43
|
4
|
+
data.tar.gz: b37f213684bf33c0c29e0ced30b4c7fd293e287df608f781812667c36d1c45f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cddbba729bbdfe16009db4847f01e897c24ec712666822a7bfe128105d45c090a527a5584001f33287038a9d457bc4356210ce2f1da70b80ffa062961e426e9
|
7
|
+
data.tar.gz: 6826a8ae18f63f7431c5ebc82b7bde80698d78139ded1e4179c175e22b1fb81484be59a2e5b62dfff6eea4f5ceb4c79b07f24c8f8bb02df09ae62282159455a3
|
data/lib/hwid/base.rb
CHANGED
@@ -40,6 +40,7 @@ module Hwid
|
|
40
40
|
return get_rasp_id if platform.include?("raspberry")
|
41
41
|
return get_rasp_id if platform.include?("raspberry 2")
|
42
42
|
return get_mac_id if platform.include?("mac")
|
43
|
+
return get_windows_id if platform.include?("Microsoft")
|
43
44
|
return get_linuxdebian_id if platform.include?("debian") #virtaul box ??
|
44
45
|
return get_linuxdebian_id if platform.include?("ubuntu") #virtaul box ??
|
45
46
|
return get_linux_id if platform.include?("linux")
|
@@ -57,8 +58,21 @@ module Hwid
|
|
57
58
|
res=run_cmd('grep Serial /proc/cpuinfo')
|
58
59
|
self.parse(res)
|
59
60
|
end
|
61
|
+
def get_windows_id
|
62
|
+
puts "running windows linux sigh"
|
63
|
+
res=run_cmd("lshw -quiet -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.*'")
|
64
|
+
res=res.gsub("0000-","")
|
65
|
+
res=res.gsum(":","")
|
66
|
+
res=res.gsub("\n","")
|
67
|
+
#res=run_cmd("lshw | grep -A 10 '*-cpu' | grep -oP '(serial: )\\K.*'")
|
68
|
+
#puts "Interim result is #{res.inspect}"
|
69
|
+
res=res.chomp
|
70
|
+
puts "windows command result: #{res}"
|
71
|
+
res
|
72
|
+
end
|
73
|
+
|
60
74
|
def get_mac_id
|
61
|
-
res=run_cmd('/usr/sbin/system_profiler SPHardwareDataType -timeout
|
75
|
+
res=run_cmd('/usr/sbin/system_profiler SPHardwareDataType -timeout 5 | grep Serial')
|
62
76
|
self.parse(res)
|
63
77
|
end
|
64
78
|
def get_linuxdebian_id
|
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.3.
|
4
|
+
version: 0.3.6
|
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-12-07 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
|
@@ -17,9 +17,6 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- Gemfile
|
21
|
-
- Gemfile.lock
|
22
|
-
- README.md
|
23
20
|
- bin/hwid.rb
|
24
21
|
- lib/hwid.rb
|
25
22
|
- lib/hwid/base.rb
|
@@ -94,7 +91,7 @@ homepage: http://github.com/semdinsp/hwid
|
|
94
91
|
licenses:
|
95
92
|
- MIT
|
96
93
|
metadata: {}
|
97
|
-
post_install_message:
|
94
|
+
post_install_message:
|
98
95
|
rdoc_options: []
|
99
96
|
require_paths:
|
100
97
|
- lib
|
@@ -109,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
106
|
- !ruby/object:Gem::Version
|
110
107
|
version: 1.3.4
|
111
108
|
requirements: []
|
112
|
-
rubygems_version: 3.0.
|
113
|
-
signing_key:
|
109
|
+
rubygems_version: 3.0.8
|
110
|
+
signing_key:
|
114
111
|
specification_version: 4
|
115
112
|
summary: Hardware id for mac and rasp pi (not secure)
|
116
113
|
test_files: []
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
hwid (0.3.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
codeclimate-test-reporter (1.0.9)
|
10
|
-
simplecov (<= 0.13)
|
11
|
-
docile (1.1.5)
|
12
|
-
json (2.2.0)
|
13
|
-
minitest (5.11.3)
|
14
|
-
simplecov (0.13.0)
|
15
|
-
docile (~> 1.1.0)
|
16
|
-
json (>= 1.8, < 3)
|
17
|
-
simplecov-html (~> 0.10.0)
|
18
|
-
simplecov-html (0.10.2)
|
19
|
-
|
20
|
-
PLATFORMS
|
21
|
-
ruby
|
22
|
-
|
23
|
-
DEPENDENCIES
|
24
|
-
codeclimate-test-reporter
|
25
|
-
hwid!
|
26
|
-
minitest
|
27
|
-
|
28
|
-
RUBY VERSION
|
29
|
-
ruby 2.4.0p0
|
30
|
-
|
31
|
-
BUNDLED WITH
|
32
|
-
1.17.3
|
data/README.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
[](https://travis-ci.org/semdinsp/hwid)[](https://codeclimate.com/github/semdinsp/hwid)
|
2
|
-
[](http://badge.fury.io/rb/hwid)
|
3
|
-
|
4
|
-
hwid gem
|
5
|
-
============
|
6
|
-
|
7
|
-
return the hardware id of the system the gem is running on.
|
8
|
-
|
9
|
-
Simple hwid id
|
10
|
-
=====================
|
11
|
-
THis is not secure but gives a simple way to identify the hardware from a particular client application.
|
12
|
-
|
13
|
-
It is a bit slow so perhaps only call it upon startup
|
14
|
-
|
15
|
-
Usage
|
16
|
-
=======
|
17
|
-
|
18
|
-
Hwid.systemid
|
19
|
-
|