pwn 0.5.515 → 0.5.517
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/Gemfile +1 -1
- data/README.md +3 -3
- data/lib/pwn/sdr/decoder/rds.rb +123 -0
- data/lib/pwn/sdr/decoder.rb +1 -0
- data/lib/pwn/sdr/frequency_allocation.rb +81 -161
- data/lib/pwn/sdr/gqrx.rb +184 -228
- data/lib/pwn/sdr.rb +13 -0
- data/lib/pwn/version.rb +1 -1
- data/spec/lib/pwn/sdr/decoder/rds_spec.rb +15 -0
- data/third_party/pwn_rdoc.jsonl +8 -4
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d403ac56d5b24ec9f22bf2b773ce83f4902230cbd2d5b75407186f0ffad9f7a3
|
|
4
|
+
data.tar.gz: 74a0da9916beaa43083e5d8b72e5418ce8d5ded33d941fbe8b4d7fa1d43daa62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: baa8a16fb23ee21bb239fe7aed8285a9b987faf5fe874f8ec383b156690f60cc5e3a0f57865f0f7bedd926d4052015a60329b3ec4a5741b2498aef3b304092d8
|
|
7
|
+
data.tar.gz: 13d7d16fae2271e71e53f8b06ef20c5c493b7ffc956aad3848098d8c42d1354cf11645bdd5d18636671d569b6f4f56e2a7fc0d8871bf64b4e6566f2e76c42fae
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
|
37
37
|
$ ./install.sh
|
|
38
38
|
$ ./install.sh ruby-gem
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.5.
|
|
40
|
+
pwn[v0.5.517]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.7@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.5.
|
|
55
|
+
pwn[v0.5.517]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.7@pwn
|
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
|
64
64
|
$ pwn
|
|
65
|
-
pwn[v0.5.
|
|
65
|
+
pwn[v0.5.517]:001 >>> PWN.help
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PWN
|
|
4
|
+
module SDR
|
|
5
|
+
module Decoder
|
|
6
|
+
# RDS Decoder Module for FM Radio Signals
|
|
7
|
+
module RDS
|
|
8
|
+
# Supported Method Parameters::
|
|
9
|
+
# rds_resp = PWN::SDR::GQRX.decode_rds(
|
|
10
|
+
# gqrx_sock: 'required - GQRX socket object returned from #connect method'
|
|
11
|
+
# )
|
|
12
|
+
|
|
13
|
+
# private_class_method def self.rds(opts = {})
|
|
14
|
+
public_class_method def self.rds(opts = {})
|
|
15
|
+
gqrx_sock = opts[:gqrx_sock]
|
|
16
|
+
|
|
17
|
+
# We toggle RDS off and on to reset the decoder
|
|
18
|
+
rds_resp = gqrx_cmd(
|
|
19
|
+
gqrx_sock: gqrx_sock,
|
|
20
|
+
cmd: 'U RDS 0',
|
|
21
|
+
resp_ok: 'RPRT 0'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
rds_resp = gqrx_cmd(
|
|
25
|
+
gqrx_sock: gqrx_sock,
|
|
26
|
+
cmd: 'U RDS 1',
|
|
27
|
+
resp_ok: 'RPRT 0'
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
rds_resp = {}
|
|
31
|
+
attempts = 0
|
|
32
|
+
max_attempts = 120
|
|
33
|
+
skip_rds = "\n"
|
|
34
|
+
print 'INFO: Decoding FM radio RDS data (Press ENTER to skip)...'
|
|
35
|
+
max_attempts.times do
|
|
36
|
+
attempts += 1
|
|
37
|
+
rds_resp[:rds_pi] = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'p RDS_PI')
|
|
38
|
+
rds_resp[:rds_ps_name] = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'p RDS_PS_NAME')
|
|
39
|
+
rds_resp[:rds_radiotext] = gqrx_cmd(gqrx_sock: gqrx_sock, cmd: 'p RDS_RADIOTEXT')
|
|
40
|
+
|
|
41
|
+
# Break if ENTER key pressed
|
|
42
|
+
# This is useful if no RDS data is available
|
|
43
|
+
# on the current frequency (e.g. false+)
|
|
44
|
+
break if $stdin.ready? && $stdin.read_nonblock(1) == skip_rds
|
|
45
|
+
|
|
46
|
+
break if rds_resp[:rds_pi] != '0000' && !rds_resp[:rds_ps_name].empty? && !rds_resp[:rds_radiotext].empty?
|
|
47
|
+
|
|
48
|
+
print '.'
|
|
49
|
+
sleep 0.1
|
|
50
|
+
end
|
|
51
|
+
puts 'complete.'
|
|
52
|
+
rds_resp
|
|
53
|
+
rescue StandardError => e
|
|
54
|
+
raise e
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Starts the live decoding thread.
|
|
58
|
+
def self.start(opts = {})
|
|
59
|
+
freq_obj = opts[:freq_obj]
|
|
60
|
+
raise ':ERROR: :freq_obj is required' unless freq_obj.is_a?(Hash)
|
|
61
|
+
|
|
62
|
+
gqrx_sock = freq_obj[:gqrx_sock]
|
|
63
|
+
freq = freq_obj[:freq]
|
|
64
|
+
bandwidth = freq_obj[:bandwidth].to_i
|
|
65
|
+
record_path = freq_obj[:record_path]
|
|
66
|
+
|
|
67
|
+
sleep 0.1 until File.exist?(record_path)
|
|
68
|
+
|
|
69
|
+
header = File.binread(record_path, HEADER_SIZE)
|
|
70
|
+
raise 'Invalid WAV header' unless header.start_with?('RIFF') && header.include?('WAVE')
|
|
71
|
+
|
|
72
|
+
bytes_read = HEADER_SIZE
|
|
73
|
+
|
|
74
|
+
puts "GSM Decoder started for freq: #{freq}, bandwidth: #{bandwidth}"
|
|
75
|
+
|
|
76
|
+
Thread.new do
|
|
77
|
+
loop do
|
|
78
|
+
sleep 1
|
|
79
|
+
end
|
|
80
|
+
rescue StandardError => e
|
|
81
|
+
puts "Decoder error: #{e.message}"
|
|
82
|
+
ensure
|
|
83
|
+
cleanup(record_path: record_path)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Stops the decoding thread.
|
|
88
|
+
def self.stop(opts = {})
|
|
89
|
+
freq_obj = opts[:freq_obj]
|
|
90
|
+
raise 'ERROR: :freq_obj is required' unless freq_obj.is_a?(Hash)
|
|
91
|
+
|
|
92
|
+
decoder_thread = freq_obj[:decoder_thread]
|
|
93
|
+
decoder_thread.kill if decoder_thread.is_a?(Thread)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Author(s):: 0day Inc. <support@0dayinc.com>
|
|
97
|
+
|
|
98
|
+
public_class_method def self.authors
|
|
99
|
+
"AUTHOR(S):
|
|
100
|
+
0day Inc. <support@0dayinc.com>
|
|
101
|
+
"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Display Usage for this Module
|
|
105
|
+
|
|
106
|
+
public_class_method def self.help
|
|
107
|
+
puts "USAGE:
|
|
108
|
+
gsm_decoder_thread = #{self}.start(
|
|
109
|
+
freq_obj: 'required - freq_obj returned from PWN::SDR::Receiver::GQRX.init_freq method'
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# To stop the decoder thread:
|
|
113
|
+
#{self}.stop(
|
|
114
|
+
freq_obj: 'required - freq_obj returned from PWN::SDR::Receiver::GQRX.init_freq method'
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
#{self}.authors
|
|
118
|
+
"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|