hwid 0.3.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hwid/base.rb +17 -1
- metadata +1 -5
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -32
- data/README.md +0 -19
- data/hwid.gemspec +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1ddba97eb04afa0e369f6ea6bb0d7fead646b6c659e9248ed199ba32b1d2d51
|
4
|
+
data.tar.gz: f1b3efe3f416d71a3bb80febb9106cd04d2259f9d8b966e310e46e3e13df042c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1dcabb6f5ef8adb5281cdae85a96902b2eb67cf8a882ba242b862d1ad44612b476408f610e061912c1ea6d61d85bfd7aaf5d5cdb19af3d3004aaaad2887b974
|
7
|
+
data.tar.gz: e87d5b4d3524d5d02afffc2d4a0ebe01f3fe9553703f30e724f69a6bad924f2d8c232f056b0fc75722b6da21f6a07fafc5c65be7200e245992f6b763cfa1e00e
|
data/lib/hwid/base.rb
CHANGED
@@ -30,16 +30,18 @@ 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 << "microsoft" if `uname -a`.include?('Microsoft')
|
33
34
|
platform << "ubuntu" if `uname -a`.include?('Ubuntu')
|
34
35
|
platform << "linux" if (/linux/ =~ RUBY_PLATFORM) != nil
|
35
36
|
platform
|
36
37
|
end
|
37
38
|
def systemid
|
38
39
|
platform=get_platform
|
39
|
-
|
40
|
+
puts "debug: platform is #{platform} #{RUBY_PLATFORM}"
|
40
41
|
return get_rasp_id if platform.include?("raspberry")
|
41
42
|
return get_rasp_id if platform.include?("raspberry 2")
|
42
43
|
return get_mac_id if platform.include?("mac")
|
44
|
+
return get_windows_id if platform.include?("microsoft")
|
43
45
|
return get_linuxdebian_id if platform.include?("debian") #virtaul box ??
|
44
46
|
return get_linuxdebian_id if platform.include?("ubuntu") #virtaul box ??
|
45
47
|
return get_linux_id if platform.include?("linux")
|
@@ -57,6 +59,20 @@ module Hwid
|
|
57
59
|
res=run_cmd('grep Serial /proc/cpuinfo')
|
58
60
|
self.parse(res)
|
59
61
|
end
|
62
|
+
def get_windows_id
|
63
|
+
puts "running windows linux sigh"
|
64
|
+
res=run_cmd("lshw -quiet -class network -disable usb -disable spd | grep -oP '(serial: )\\K.*'")
|
65
|
+
res=res.gsub("0000-","")
|
66
|
+
res=res.gsub(":","")
|
67
|
+
res=res.gsub("\n","")
|
68
|
+
res=res.gsub(" ","")
|
69
|
+
#res=run_cmd("lshw | grep -A 10 '*-cpu' | grep -oP '(serial: )\\K.*'")
|
70
|
+
#puts "Interim result is #{res.inspect}"
|
71
|
+
res=res.chomp
|
72
|
+
puts "windows command result: #{res}"
|
73
|
+
res
|
74
|
+
end
|
75
|
+
|
60
76
|
def get_mac_id
|
61
77
|
res=run_cmd('/usr/sbin/system_profiler SPHardwareDataType -timeout 5 | grep Serial')
|
62
78
|
self.parse(res)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hwid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Sproule
|
@@ -17,11 +17,7 @@ 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
|
-
- hwid.gemspec
|
25
21
|
- lib/hwid.rb
|
26
22
|
- lib/hwid/base.rb
|
27
23
|
- test/coverage/assets/0.7.1/application.css
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
hwid (0.3.2)
|
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.3.1)
|
13
|
-
minitest (5.14.1)
|
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.6.6p146
|
30
|
-
|
31
|
-
BUNDLED WITH
|
32
|
-
1.17.3
|
data/README.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
[![Build Status](https://travis-ci.org/semdinsp/hwid.svg?branch=master)](https://travis-ci.org/semdinsp/hwid)[![Code Climate](https://codeclimate.com/github/semdinsp/hwid/badges/gpa.svg)](https://codeclimate.com/github/semdinsp/hwid)
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/hwid.png)](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
|
-
|
data/hwid.gemspec
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "hwid"
|
3
|
-
s.version = "0.3.4"
|
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
|