ruby_wifi_scanner 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/ruby_wifi_scanner/linux_scanner.rb +15 -7
- data/lib/ruby_wifi_scanner/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90daf1cf8fb63b5af08330c4685e5031792f730246a1579c4ca8f153ef48a5ec
|
4
|
+
data.tar.gz: 1dd0e27fe74cbe7a0e9ebb7ea7c94815ec79220569a442d350f0e7783c7f1285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0f46982d73459444588fb3eb40633f4b1efbac1d6bc93a92585825abe40679823546c185218dd7e43d59fd0662acdf540ad1964b707aa22feca99e2c510092a
|
7
|
+
data.tar.gz: 7b3b431f2a1cd63377d7b392ea99518f31e00e01ade356609b8215fc7cbbeaeb07c14edddff93dc79168524026771848d5c9a93cbbf009288593f42f310045c4
|
data/Gemfile.lock
CHANGED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_wifi_scanner"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -1,19 +1,27 @@
|
|
1
1
|
module RubyWifiScanner
|
2
2
|
class LinuxScanner < Scanner
|
3
|
-
|
4
3
|
protected
|
5
4
|
|
6
5
|
def parse
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
scan = raw_scan.scan(/
|
7
|
+
^BSS\s([a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2})
|
8
|
+
.+?
|
9
|
+
signal:\s([\d.-]+?)\sdBm$
|
10
|
+
.+?
|
11
|
+
SSID:\s(\w+?)$
|
12
|
+
/mx)
|
13
|
+
|
14
|
+
scan.map do |rssi,level,ssid|
|
15
|
+
WifiInfo.new(ssid, rssi, level)
|
11
16
|
end
|
12
17
|
end
|
13
18
|
|
14
19
|
def raw_scan
|
15
|
-
@raw_scan
|
16
|
-
|
20
|
+
return @raw_scan if @raw_scan
|
21
|
+
|
22
|
+
device = ENV["DEVICE"] || 'wlan0'
|
23
|
+
|
24
|
+
@raw_scan = %x{sudo iw dev #{device} scan}
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_wifi_scanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uri Gorelik
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- LICENSE.txt
|
83
83
|
- README.md
|
84
84
|
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
85
87
|
- exe/rws
|
86
88
|
- lib/ruby_wifi_scanner.rb
|
87
89
|
- lib/ruby_wifi_scanner/linux_scanner.rb
|