hwid 0.3.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hwid/base.rb +17 -1
  3. metadata +1 -5
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +0 -32
  6. data/README.md +0 -19
  7. data/hwid.gemspec +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ca05851f024c6658b2155a006897f92f02375c82d157f9c328c7f34cf5367f4
4
- data.tar.gz: 82d85fdf8a37df99c581340bdf642e7d1a737128215915d2dfb05d8fd9027fef
3
+ metadata.gz: f1ddba97eb04afa0e369f6ea6bb0d7fead646b6c659e9248ed199ba32b1d2d51
4
+ data.tar.gz: f1b3efe3f416d71a3bb80febb9106cd04d2259f9d8b966e310e46e3e13df042c
5
5
  SHA512:
6
- metadata.gz: 71d25a01a2901a51772f635e0a4606b4f3da3fcabd932d59473485e7cfaef5a788ab2ea9fd6b2c5297a7ec0995d86bfdde0a18eafc23453069a8d572ec96df45
7
- data.tar.gz: 11617776ad81ae9349f4df2e2e150ab92014ae848c3bbe0aa488df99d464efb534f33d9e440d6a71a53ca17ab89f48cfec7ee6ac316eebdc21276b0a97aa6dc2
6
+ metadata.gz: f1dcabb6f5ef8adb5281cdae85a96902b2eb67cf8a882ba242b862d1ad44612b476408f610e061912c1ea6d61d85bfd7aaf5d5cdb19af3d3004aaaad2887b974
7
+ data.tar.gz: e87d5b4d3524d5d02afffc2d4a0ebe01f3fe9553703f30e724f69a6bad924f2d8c232f056b0fc75722b6da21f6a07fafc5c65be7200e245992f6b763cfa1e00e
@@ -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
- # puts "platform is #{platform} #{RUBY_PLATFORM}"
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.3.4
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
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
- ruby '2.6.6'
3
- gem "codeclimate-test-reporter"
4
- gem "minitest"
5
- #gem "minitest-rails"
6
- gemspec
@@ -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
-
@@ -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