pwn 0.5.470 → 0.5.472
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/blockchain/btc.rb +9 -1
- data/lib/pwn/config.rb +4 -2
- data/lib/pwn/plugins/monkey_patch.rb +8 -5
- data/lib/pwn/plugins/repl.rb +86 -0
- data/lib/pwn/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 64d838c2244b031f0d4c1aa74a55697e0a759f41af3acba22658cd819948e9c7
|
|
4
|
+
data.tar.gz: f2ff0e54c0d14a57090f5bde376cbad4c26a89283446154da5771c624b7905f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0aa2798d611fc5a118ead2077604d6843e455feee5befd4a9167a47085c284e7b439ac4863d303adc5b0260598dc38befeec08ea32aa3e6156913cc109d14719
|
|
7
|
+
data.tar.gz: cb58d8b8191715306cf8e1892dc3bd6bce6611a751e335e4ead6d115c08088237b287fc65a39c0ac40d98f1c15041c841542745107b4aca2289cccfde0603f0d
|
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.472]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@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.472]: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.4@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.472]: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:
|
data/lib/pwn/blockchain/btc.rb
CHANGED
|
@@ -181,7 +181,15 @@ module PWN
|
|
|
181
181
|
# latest_block = PWN::Blockchain::BTC.get_latest_block
|
|
182
182
|
|
|
183
183
|
public_class_method def self.get_latest_block
|
|
184
|
-
btc_rpc_call(method: 'getblockchaininfo', params: [])
|
|
184
|
+
latest_block = btc_rpc_call(method: 'getblockchaininfo', params: [])
|
|
185
|
+
system_role_content = 'Provide a useful summary of this latest bitcoin block returned from a bitcoin node via getblockchaininfo.'
|
|
186
|
+
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
187
|
+
request: latest_block.to_s,
|
|
188
|
+
system_role_content: system_role_content
|
|
189
|
+
)
|
|
190
|
+
puts ai_analysis
|
|
191
|
+
|
|
192
|
+
latest_block
|
|
185
193
|
rescue StandardError => e
|
|
186
194
|
raise e
|
|
187
195
|
end
|
data/lib/pwn/config.rb
CHANGED
|
@@ -100,20 +100,22 @@ module PWN
|
|
|
100
100
|
mqtt: {
|
|
101
101
|
host: 'mqtt.meshtastic.org',
|
|
102
102
|
port: 1883,
|
|
103
|
+
tls: false,
|
|
103
104
|
user: 'meshdev',
|
|
104
105
|
pass: 'large4cats'
|
|
105
106
|
},
|
|
106
107
|
channel: {
|
|
108
|
+
active: 'LongFast',
|
|
107
109
|
LongFast: {
|
|
108
110
|
psk: 'AQ==',
|
|
109
111
|
region: 'US/<STATE>',
|
|
110
|
-
|
|
112
|
+
topic: '2/e/#',
|
|
111
113
|
channel_num: 8
|
|
112
114
|
},
|
|
113
115
|
PWN: {
|
|
114
116
|
psk: 'required - PSK for pwn channel',
|
|
115
117
|
region: 'US/<STATE>',
|
|
116
|
-
|
|
118
|
+
topic: '2/e/PWN/#',
|
|
117
119
|
channel_num: 99
|
|
118
120
|
}
|
|
119
121
|
}
|
|
@@ -81,8 +81,8 @@ module PWN
|
|
|
81
81
|
exec_hook :after_read, eval_string, self
|
|
82
82
|
|
|
83
83
|
begin
|
|
84
|
-
complete_expr = true if config.pwn_ai || config.pwn_asm
|
|
85
|
-
complete_expr = Pry::Code.complete_expression?(@eval_string) unless config.pwn_ai || config.pwn_asm
|
|
84
|
+
complete_expr = true if config.pwn_ai || config.pwn_asm || config.pwn_mesh
|
|
85
|
+
complete_expr = Pry::Code.complete_expression?(@eval_string) unless config.pwn_ai || config.pwn_asm || config.pwn_mesh
|
|
86
86
|
rescue SyntaxError => e
|
|
87
87
|
output.puts e.message.gsub(/^.*syntax error, */, 'SyntaxError: ')
|
|
88
88
|
reset_eval_string
|
|
@@ -93,7 +93,8 @@ module PWN
|
|
|
93
93
|
@eval_string.empty? ||
|
|
94
94
|
@eval_string =~ /\A *#.*\n\z/ ||
|
|
95
95
|
config.pwn_ai ||
|
|
96
|
-
config.pwn_asm
|
|
96
|
+
config.pwn_asm ||
|
|
97
|
+
config.pwn_mesh
|
|
97
98
|
|
|
98
99
|
# A bug in jruby makes java.lang.Exception not rescued by
|
|
99
100
|
# `rescue Pry::RescuableException` clause.
|
|
@@ -116,10 +117,12 @@ module PWN
|
|
|
116
117
|
reset_eval_string
|
|
117
118
|
|
|
118
119
|
result = evaluate_ruby(eval_string) unless config.pwn_ai ||
|
|
119
|
-
config.pwn_asm
|
|
120
|
+
config.pwn_asm ||
|
|
121
|
+
config.pwn_mesh
|
|
120
122
|
|
|
121
123
|
result = eval_string if config.pwn_ai ||
|
|
122
|
-
config.pwn_asm
|
|
124
|
+
config.pwn_asm ||
|
|
125
|
+
config.pwn_mesh
|
|
123
126
|
rescue Pry::RescuableException, *jruby_exceptions => e
|
|
124
127
|
# Eliminate following warning:
|
|
125
128
|
# warning: singleton on non-persistent Java type X
|
data/lib/pwn/plugins/repl.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'fileutils'
|
|
4
|
+
require 'meshtastic'
|
|
4
5
|
require 'pry'
|
|
5
6
|
require 'tty-prompt'
|
|
6
7
|
require 'yaml'
|
|
@@ -62,6 +63,18 @@ module PWN
|
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
66
|
+
if pi.config.pwn_mesh
|
|
67
|
+
active_channel = PWN::Env[:plugins][:meshtastic][:channel][:active].to_s.to_sym
|
|
68
|
+
region = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:region]
|
|
69
|
+
topic = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:topic]
|
|
70
|
+
channel_num = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:channel_num]
|
|
71
|
+
|
|
72
|
+
pi.config.prompt_name = "pwn.mesh:#{region}/#{topic}:#{channel_num}"
|
|
73
|
+
name = "\001\e[1m\002\001\e[32m\002#{pi.config.prompt_name}\001\e[0m\002"
|
|
74
|
+
dchars = "\001\e[32m\002>>>\001\e[33m\002"
|
|
75
|
+
dchars = "\001\e[33m\002***\001\e[33m\002" if mode == :splat
|
|
76
|
+
end
|
|
77
|
+
|
|
65
78
|
"#{name}[#{version}]:#{line_count} #{dchars} ".to_s.scrub
|
|
66
79
|
end
|
|
67
80
|
rescue StandardError => e
|
|
@@ -416,6 +429,40 @@ module PWN
|
|
|
416
429
|
end
|
|
417
430
|
end
|
|
418
431
|
|
|
432
|
+
Pry::Commands.create_command 'pwn-mesh' do
|
|
433
|
+
description 'Communicate with Meshtastic network within pwn REPL.'
|
|
434
|
+
|
|
435
|
+
def process
|
|
436
|
+
pi = pry_instance
|
|
437
|
+
pi.config.pwn_mesh = true
|
|
438
|
+
meshtastic_env = PWN::Env[:plugins][:meshtastic]
|
|
439
|
+
|
|
440
|
+
mqtt_env = meshtastic_env[:mqtt]
|
|
441
|
+
host = mqtt_env[:host]
|
|
442
|
+
port = mqtt_env[:port]
|
|
443
|
+
tls = mqtt_env[:tls]
|
|
444
|
+
username = mqtt_env[:user]
|
|
445
|
+
password = mqtt_env[:pass]
|
|
446
|
+
|
|
447
|
+
mqtt_obj = Meshtastic::MQTT.connect(
|
|
448
|
+
host: host,
|
|
449
|
+
port: port,
|
|
450
|
+
tls: tls,
|
|
451
|
+
username: username,
|
|
452
|
+
password: password
|
|
453
|
+
)
|
|
454
|
+
PWN.const_set(:MqttObj, mqtt_obj)
|
|
455
|
+
|
|
456
|
+
active_channel = meshtastic_env[:channel][:active].to_s.to_sym
|
|
457
|
+
channel_env = meshtastic_env[:channel][active_channel]
|
|
458
|
+
psk = channel_env[:psk]
|
|
459
|
+
region = channel_env[:region]
|
|
460
|
+
topic = channel_env[:topic]
|
|
461
|
+
rescue StandardError => e
|
|
462
|
+
raise e
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
|
|
419
466
|
Pry::Commands.create_command 'pwn-vault' do
|
|
420
467
|
description 'Edit the pwn.yaml configuration file.'
|
|
421
468
|
|
|
@@ -476,6 +523,8 @@ module PWN
|
|
|
476
523
|
pi.config.pwn_ai_debug = false if pi.config.pwn_ai_debug
|
|
477
524
|
pi.config.pwn_ai_speak = false if pi.config.pwn_ai_speak
|
|
478
525
|
pi.config.completer = Pry::InputCompleter
|
|
526
|
+
PWN.send(:remove_const, :MqttObj) if PWN.const_defined?(:MqttObj)
|
|
527
|
+
pi.config.pwn_mesh = false if pi.config.pwn_mesh
|
|
479
528
|
end
|
|
480
529
|
end
|
|
481
530
|
rescue StandardError => e
|
|
@@ -593,6 +642,43 @@ module PWN
|
|
|
593
642
|
PWN::Env[:ai][engine][:response_history] = response_history
|
|
594
643
|
end
|
|
595
644
|
end
|
|
645
|
+
|
|
646
|
+
Pry.config.hooks.add_hook(:after_read, :pwn_mesh_hook) do |request, pi|
|
|
647
|
+
if pi.config.pwn_mesh && !request.chomp.empty?
|
|
648
|
+
mqtt_obj = PWN.const_get(:MqttObj)
|
|
649
|
+
from = "!#{mqtt_obj.client_id}"
|
|
650
|
+
active_channel = PWN::Env[:plugins][:meshtastic][:channel][:active].to_s.to_sym
|
|
651
|
+
topic = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:topic]
|
|
652
|
+
channel_num = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:channel_num]
|
|
653
|
+
psk = PWN::Env[:plugins][:meshtastic][:channel][active_channel][:psk]
|
|
654
|
+
|
|
655
|
+
psks = {}
|
|
656
|
+
psks[active_channel] = psk
|
|
657
|
+
|
|
658
|
+
text = pi.input.line_buffer
|
|
659
|
+
to = '!ffffffff'
|
|
660
|
+
# If text include @! with 8 byte length OR
|
|
661
|
+
if text.include?('@!')
|
|
662
|
+
to_raw = text.split('@').last.chomp[0..8]
|
|
663
|
+
# If to_raw[1..-1] is hex than set to = to_raw
|
|
664
|
+
to = to_raw if to_raw[1..-1].match?(/^[a-fA-F0-9]{8}$/)
|
|
665
|
+
end
|
|
666
|
+
puts "\nFrom: #{from}"
|
|
667
|
+
puts "To: #{to}"
|
|
668
|
+
puts "Topic: #{topic}"
|
|
669
|
+
puts "Channel: #{channel_num}"
|
|
670
|
+
puts "Text: #{text}\n\n"
|
|
671
|
+
Meshtastic::MQTT.send_text(
|
|
672
|
+
mqtt_obj: mqtt_obj,
|
|
673
|
+
from: from,
|
|
674
|
+
to: to,
|
|
675
|
+
topic: topic,
|
|
676
|
+
channel: channel_num,
|
|
677
|
+
text: text,
|
|
678
|
+
psks: psks
|
|
679
|
+
)
|
|
680
|
+
end
|
|
681
|
+
end
|
|
596
682
|
rescue StandardError => e
|
|
597
683
|
raise e
|
|
598
684
|
end
|
data/lib/pwn/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pwn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.472
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- 0day Inc.
|
|
@@ -519,14 +519,14 @@ dependencies:
|
|
|
519
519
|
requirements:
|
|
520
520
|
- - '='
|
|
521
521
|
- !ruby/object:Gem::Version
|
|
522
|
-
version: 0.0.
|
|
522
|
+
version: 0.0.129
|
|
523
523
|
type: :runtime
|
|
524
524
|
prerelease: false
|
|
525
525
|
version_requirements: !ruby/object:Gem::Requirement
|
|
526
526
|
requirements:
|
|
527
527
|
- - '='
|
|
528
528
|
- !ruby/object:Gem::Version
|
|
529
|
-
version: 0.0.
|
|
529
|
+
version: 0.0.129
|
|
530
530
|
- !ruby/object:Gem::Dependency
|
|
531
531
|
name: metasm
|
|
532
532
|
requirement: !ruby/object:Gem::Requirement
|