pwn 0.5.471 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93a5c7a3a8bbb7534d1af6b0e7acb1a2f4468bd0a0dd1e613d85dfc051c8c839
4
- data.tar.gz: f65767723f2d0f6c90a97caae612d9e7806b9925b7277dbcf0eacb8f621c3a37
3
+ metadata.gz: 64d838c2244b031f0d4c1aa74a55697e0a759f41af3acba22658cd819948e9c7
4
+ data.tar.gz: f2ff0e54c0d14a57090f5bde376cbad4c26a89283446154da5771c624b7905f4
5
5
  SHA512:
6
- metadata.gz: 4f97be5a6be3e05223f8720ec0fd6619bba8c5bae1b814e4f90e746b0d5cf57814b9b2d6e6ae7657df5d7aa78a1c10f0f8e305ac657d9654cb58788099f32dbf
7
- data.tar.gz: '03809a0e80825ce97be5c82444a4370c94b663a8d5942e015ee4b88d81465e10a6b09d189c6abd43df823927b407eeb6d8244b3cb356ea2bd6598a695b3cab1f'
6
+ metadata.gz: 0aa2798d611fc5a118ead2077604d6843e455feee5befd4a9167a47085c284e7b439ac4863d303adc5b0260598dc38befeec08ea32aa3e6156913cc109d14719
7
+ data.tar.gz: cb58d8b8191715306cf8e1892dc3bd6bce6611a751e335e4ead6d115c08088237b287fc65a39c0ac40d98f1c15041c841542745107b4aca2289cccfde0603f0d
data/Gemfile CHANGED
@@ -48,7 +48,7 @@ gem 'jwt', '3.1.2'
48
48
  gem 'libusb', '0.7.2'
49
49
  gem 'luhn', '3.0.0'
50
50
  gem 'mail', '2.8.1'
51
- gem 'meshtastic', '0.0.126'
51
+ gem 'meshtastic', '0.0.129'
52
52
  gem 'metasm', '1.0.5'
53
53
  gem 'mongo', '2.21.3'
54
54
  gem 'msfrpc-client', '1.1.2'
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.471]:001 >>> PWN.help
40
+ pwn[v0.5.472]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](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.471]:001 >>> PWN.help
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.471]:001 >>> PWN.help
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/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
- channel_topic: '2/e/#',
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
- channel_topic: '2/e/PWN/#',
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
@@ -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
@@ -417,7 +430,37 @@ module PWN
417
430
  end
418
431
 
419
432
  Pry::Commands.create_command 'pwn-mesh' do
420
- description 'Initiate pwn.mesh network interface.'
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
421
464
  end
422
465
 
423
466
  Pry::Commands.create_command 'pwn-vault' do
@@ -480,6 +523,8 @@ module PWN
480
523
  pi.config.pwn_ai_debug = false if pi.config.pwn_ai_debug
481
524
  pi.config.pwn_ai_speak = false if pi.config.pwn_ai_speak
482
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
483
528
  end
484
529
  end
485
530
  rescue StandardError => e
@@ -597,6 +642,43 @@ module PWN
597
642
  PWN::Env[:ai][engine][:response_history] = response_history
598
643
  end
599
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
600
682
  rescue StandardError => e
601
683
  raise e
602
684
  end
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.471'
4
+ VERSION = '0.5.472'
5
5
  end
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.471
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.126
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.126
529
+ version: 0.0.129
530
530
  - !ruby/object:Gem::Dependency
531
531
  name: metasm
532
532
  requirement: !ruby/object:Gem::Requirement