meshtastic 0.0.12 → 0.0.14
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 +8 -0
- data/lib/meshtastic/mqtt.rb +56 -41
- data/lib/meshtastic/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f8be7f02d2c6825cf9252e52b92012f2dc908e3814ef1bcf298ef0821a55a1c
|
4
|
+
data.tar.gz: c2f4b52d0ec9f61092a6666d719d45ed54ba6666a1b25607dad306af0dbb0a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d1b55062fd360db1b956e132faff3fda49faa5e40d2c7632264e32655e6544910e471aa005050c57ef11ab0f783b8d6728f9f0ce5721b2b22e88a5ada950b5
|
7
|
+
data.tar.gz: 210c71c836f144389b9277b97c41cb7601140df70b5ea5ee2400286306b31bcc80978874eee600bc01bd22e522e7ae49cd694e0e181f2b35a41d9a1cd4c29627
|
data/Gemfile
CHANGED
@@ -16,7 +16,7 @@ gem 'bundler', '>=2.5.3'
|
|
16
16
|
gem 'bundle-audit', '0.1.0'
|
17
17
|
gem 'geocoder', '1.8.2'
|
18
18
|
gem 'google-protobuf', '3.21.12'
|
19
|
-
gem 'google-protobuf-z', '3.5.1'
|
19
|
+
# gem 'google-protobuf-z', '3.5.1'
|
20
20
|
gem 'mqtt', '0.6.0'
|
21
21
|
gem 'rake', '13.2.1'
|
22
22
|
gem 'rdoc', '6.6.3.1'
|
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Meshtastic
|
2
2
|
Ruby gem for interfacing with Meshtastic nodes.
|
3
3
|
|
4
|
+
# Settting Expectations
|
5
|
+
This gem was created to support alt-comm capabilities w/in a security research framework known as ('https://github.com/0dayInc/pwn')[PWN]. Contributors of this effort cannot guarantee full functionality or support for all Meshtastic features.
|
6
|
+
|
7
|
+
# Objectives
|
8
|
+
- Consume the ('https://github.com/meshtastic/protobufs')[Meshtastic Protobufs] and ('https://github.com/0dayInc/meshtastic/blob/master/AUTOGEN_meshtastic_protobufs.sh')[generate Ruby protobuf modules for Meshtastic] using the protoc command: Complete
|
9
|
+
- Integrate a working gem that can interface with the automatically generated Ruby protobuf modules: Complete
|
10
|
+
- Scale out Meshtastic Ruby Modules for their respective protobufs within the meshtastic gem (e.g. Meshtastic::MQTTPB is auto-generated based on latest Meshtastic protobuf specs and extended via Meshtastic::MQTT for more MQTT interaction as desired): Continued Effort
|
11
|
+
|
4
12
|
## Installation
|
5
13
|
|
6
14
|
Install the gem and add to the application's Gemfile by executing:
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -78,20 +78,31 @@ module Meshtastic
|
|
78
78
|
|
79
79
|
# cipher = OpenSSL::Cipher.new('AES-256-CTR')
|
80
80
|
cipher = OpenSSL::Cipher.new('AES-128-CTR')
|
81
|
-
mqtt_obj.get_packet do |
|
82
|
-
|
83
|
-
|
81
|
+
mqtt_obj.get_packet do |packet_bytes|
|
82
|
+
# puts "Packet Bytes: #{packet_bytes.public_methods}"
|
83
|
+
raw_packet = packet_bytes.to_s.b
|
84
|
+
raw_packet_len = raw_packet.to_s.b.length
|
85
|
+
raw_topic = packet_bytes.topic
|
86
|
+
raw_payload = packet_bytes.payload
|
87
|
+
raw_payload_len = raw_payload.length
|
88
|
+
|
84
89
|
begin
|
85
90
|
puts '-' * 80
|
86
91
|
|
92
|
+
payload = {}
|
87
93
|
if json
|
88
|
-
|
89
|
-
payload = Meshtastic::ServiceEnvelope.json_decode(
|
90
|
-
map_report = Meshtastic::MapReport.json_decode(
|
94
|
+
json_payload = JSON.parse(raw_payload, symbolize_names: true)
|
95
|
+
payload = Meshtastic::ServiceEnvelope.json_decode(json_payload)
|
96
|
+
map_report = Meshtastic::MapReport.json_decode(json_payload)
|
91
97
|
else
|
92
|
-
|
93
|
-
payload =
|
94
|
-
|
98
|
+
svc_envl= Meshtastic::ServiceEnvelope.decode(raw_payload)
|
99
|
+
payload = svc_envl.to_h[:packet]
|
100
|
+
# puts "STILL GOOD: #{payload.inspect}"
|
101
|
+
# puts "Public Methods: #{Meshtastic::MapReport.public_methods}"
|
102
|
+
# puts "Public Methods: #{Meshtastic::MapReport.class}"
|
103
|
+
# map_report_decode = Meshtastic::MapReport.decode(raw_payload)
|
104
|
+
# map_report = map_report_decode.to_h
|
105
|
+
# puts "STILL GOOD: #{map_report.inspect}"
|
95
106
|
end
|
96
107
|
|
97
108
|
puts "*** MESSAGE ***"
|
@@ -103,8 +114,7 @@ module Meshtastic
|
|
103
114
|
puts "Channel: #{channel}"
|
104
115
|
packet_id = payload[:id]
|
105
116
|
puts "Packet ID: #{packet_id}"
|
106
|
-
|
107
|
-
puts "\nTopic: #{topic}"
|
117
|
+
puts "\nTopic: #{raw_topic}"
|
108
118
|
|
109
119
|
decoded_payload = payload[:decoded]
|
110
120
|
if decoded_payload
|
@@ -149,44 +159,49 @@ module Meshtastic
|
|
149
159
|
end
|
150
160
|
puts '*' * 20
|
151
161
|
|
152
|
-
map_long_name = map_report[:long_name].b
|
153
|
-
puts "\n*** MAP STATS ***"
|
154
|
-
puts "Map Long Name: #{map_long_name.inspect}"
|
155
|
-
map_short_name = map_report[:short_name]
|
156
|
-
puts "Map Short Name: #{map_short_name}"
|
157
|
-
role = map_report[:role]
|
158
|
-
puts "Role: #{role}"
|
159
|
-
hw_model = map_report[:hw_model]
|
160
|
-
puts "Hardware Model: #{hw_model}"
|
161
|
-
firmware_version = map_report[:firmware_version]
|
162
|
-
puts "Firmware Version: #{firmware_version}"
|
163
|
-
region = map_report[:region]
|
164
|
-
puts "Region: #{region}"
|
165
|
-
modem_preset = map_report[:modem_preset]
|
166
|
-
puts "Modem Preset: #{modem_preset}"
|
167
|
-
has_default_channel = map_report[:has_default_channel]
|
168
|
-
puts "Has Default Channel: #{has_default_channel}"
|
169
|
-
latitiude_i = map_report[:latitude_i]
|
170
|
-
puts "Latitude: #{latitiude_i}"
|
171
|
-
longitude_i = map_report[:longitude_i]
|
172
|
-
puts "Longitude: #{longitude_i}"
|
173
|
-
altitude = map_report[:altitude]
|
174
|
-
puts "Altitude: #{altitude}"
|
175
|
-
position_precision = map_report[:position_precision]
|
176
|
-
puts "Position Precision: #{position_precision}"
|
177
|
-
num_online_local_nodes = map_report[:num_online_local_nodes]
|
178
|
-
puts "Number of Online Local Nodes: #{num_online_local_nodes}"
|
179
|
-
puts '*' * 20
|
162
|
+
# map_long_name = map_report[:long_name].b
|
163
|
+
# puts "\n*** MAP STATS ***"
|
164
|
+
# puts "Map Long Name: #{map_long_name.inspect}"
|
165
|
+
# map_short_name = map_report[:short_name]
|
166
|
+
# puts "Map Short Name: #{map_short_name}"
|
167
|
+
# role = map_report[:role]
|
168
|
+
# puts "Role: #{role}"
|
169
|
+
# hw_model = map_report[:hw_model]
|
170
|
+
# puts "Hardware Model: #{hw_model}"
|
171
|
+
# firmware_version = map_report[:firmware_version]
|
172
|
+
# puts "Firmware Version: #{firmware_version}"
|
173
|
+
# region = map_report[:region]
|
174
|
+
# puts "Region: #{region}"
|
175
|
+
# modem_preset = map_report[:modem_preset]
|
176
|
+
# puts "Modem Preset: #{modem_preset}"
|
177
|
+
# has_default_channel = map_report[:has_default_channel]
|
178
|
+
# puts "Has Default Channel: #{has_default_channel}"
|
179
|
+
# latitiude_i = map_report[:latitude_i]
|
180
|
+
# puts "Latitude: #{latitiude_i}"
|
181
|
+
# longitude_i = map_report[:longitude_i]
|
182
|
+
# puts "Longitude: #{longitude_i}"
|
183
|
+
# altitude = map_report[:altitude]
|
184
|
+
# puts "Altitude: #{altitude}"
|
185
|
+
# position_precision = map_report[:position_precision]
|
186
|
+
# puts "Position Precision: #{position_precision}"
|
187
|
+
# num_online_local_nodes = map_report[:num_online_local_nodes]
|
188
|
+
# puts "Number of Online Local Nodes: #{num_online_local_nodes}"
|
189
|
+
# puts '*' * 20
|
180
190
|
|
181
191
|
puts "\n*** PACKET DEBUGGING ***"
|
182
192
|
puts "Payload: #{payload.inspect}"
|
183
|
-
puts "\nMap Report: #{map_report.inspect}"
|
193
|
+
# puts "\nMap Report: #{map_report.inspect}"
|
184
194
|
puts "\nRaw Packet: #{raw_packet.inspect}"
|
185
195
|
puts "Length: #{raw_packet_len}"
|
186
196
|
puts '*' * 20
|
187
|
-
rescue Google::Protobuf::ParseError
|
197
|
+
rescue Google::Protobuf::ParseError => e
|
198
|
+
puts "ERROR: #{e.inspect}"
|
199
|
+
puts "\n*** PACKET DEBUGGING ***"
|
200
|
+
puts "Payload: #{payload.inspect}"
|
201
|
+
# puts "\nMap Report: #{map_report.inspect}"
|
188
202
|
puts "\nRaw Packet: #{raw_packet.inspect}"
|
189
203
|
puts "Length: #{raw_packet_len}"
|
204
|
+
puts '*' * 20
|
190
205
|
next
|
191
206
|
ensure
|
192
207
|
puts '-' * 80
|
data/lib/meshtastic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meshtastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.21.12
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: google-protobuf-z
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 3.5.1
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 3.5.1
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: mqtt
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|