waps 0.0.1
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 +7 -0
- data/lib/waps.rb +83 -0
- metadata +59 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b0144fc4843d7ace0b6e2918eead475691f98d4846c6913951a70b366b3887e2
|
|
4
|
+
data.tar.gz: a6741ae43e7f6a8308af4808f92d1814b0b5a5eb7d44e7ccee8d092793f56f05
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fc7b7f2f02e02591b853d2ee134b9bc114237a974aceea345d700bce2e6566c9b06a7b9e3303adaae43473b17b902360377c87ede04e92d4a439be2088987b63
|
|
7
|
+
data.tar.gz: c433f42274dc9a46e8a7d8f5673e9b7dd7240e8ac728fcc709ded688c24aa98978e1953bfc8ef5bb7eb9b83d2f204fa8cff8eaae651394e097768b9cbacaa27a
|
data/lib/waps.rb
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
class Waps
|
|
2
|
+
|
|
3
|
+
def initialize(interface_name)
|
|
4
|
+
@interface_name = interface_name
|
|
5
|
+
@output = []
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def scan
|
|
9
|
+
raw_input = run_command
|
|
10
|
+
@output = parse(raw_input)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def parse(raw_input)
|
|
14
|
+
cells = raw_input.split("Cell")[1..-1]
|
|
15
|
+
|
|
16
|
+
cells.map { |cell| parse_cell(cell)}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run_command
|
|
20
|
+
`sudo iwlist #{@interface_name} scan`
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse_cell(cell)
|
|
25
|
+
raw_data = cell.split("\n")
|
|
26
|
+
result = {
|
|
27
|
+
address: paddress(raw_data[0]),
|
|
28
|
+
channel: pchannel(raw_data[1]),
|
|
29
|
+
frequency: pfrequency(raw_data[2]),
|
|
30
|
+
quality: pquality(raw_data[3]),
|
|
31
|
+
signal_level: psignal_level(raw_data[3]),
|
|
32
|
+
encryption_key: pencryption_key(raw_data[4]),
|
|
33
|
+
ssid: pssid(raw_data[5])
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
#Parse Values from the raw data. All methods below
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def paddress(data)
|
|
42
|
+
data.split("Address:")[-1].delete(" ")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def pchannel(data)
|
|
46
|
+
data.split(":")[-1]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def pfrequency(data)
|
|
50
|
+
data.split(":")[-1].split(" ")[0]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def pquality(data)
|
|
54
|
+
data.split(" ")[0].split("=")[-1]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def psignal_level(data)
|
|
58
|
+
data.split(" ")[2].split("=")[-1] + " dBm"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def pencryption_key(data)
|
|
62
|
+
data.split(":")[-1]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def pssid(data)
|
|
66
|
+
data.split('"').count == 1 ? "" : data.split('"')[-1]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
#Find methods
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def get(find)
|
|
75
|
+
result = []
|
|
76
|
+
if @output[0].keys.include? find.to_sym
|
|
77
|
+
result = @output.map { |cell| cell[find.to_sym] }
|
|
78
|
+
end
|
|
79
|
+
result
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
metadata
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: waps
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Gurjatn Singh
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rspec
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.7'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3.7'
|
|
27
|
+
description: Gem uses iwlist to scan and parse the response into ruby hash
|
|
28
|
+
email:
|
|
29
|
+
- waps@defensestation.ca
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- lib/waps.rb
|
|
35
|
+
homepage: https://rubygems.org/gem/waps
|
|
36
|
+
licenses:
|
|
37
|
+
- MIT
|
|
38
|
+
metadata: {}
|
|
39
|
+
post_install_message:
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubyforge_project:
|
|
55
|
+
rubygems_version: 2.7.6
|
|
56
|
+
signing_key:
|
|
57
|
+
specification_version: 4
|
|
58
|
+
summary: Gem to scan wirless access point
|
|
59
|
+
test_files: []
|