pwn 0.5.444 → 0.5.446

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: ec6df63c1b99b28c53063a7a55160e3daf1b961fb5c9c65b13e522bb1011f54d
4
- data.tar.gz: 384514b0c8e2fe6d11696a55e5e9fc04a3cf5af85218b6643a2009401da50188
3
+ metadata.gz: a44431b941955353c7b0926e584ee754f3ef4cf02a22590dddf0613e4436545e
4
+ data.tar.gz: d7f6286a33c71a051ac1f06e688c4e81974e0dbac83fca90834945df08e1de6a
5
5
  SHA512:
6
- metadata.gz: 679c8b0262e600ae206e713ceec79d60de9ce91bf39b0eebb420c76316fd0cb7816a9bf96390bf5545e5c6063697809354fb52aa55aad962cd0b2c9c5373d123
7
- data.tar.gz: f14604cb417bd26b745a4c311ed8614cc8ec3f13e07f622497efbb4037fda26ed767dc017ff2fa1e92eee4f47a731d4646ea76e05cf05628d4377a23e7cef460
6
+ metadata.gz: d7b633237440b907fa46d66526d80b403c5e30649aa8411d5e39d1dcabe24f7fe5db4010c120994daef10b5ff6ae61c28865d9327bfd27c29d2987add8bf6b07
7
+ data.tar.gz: 01f0763257fd3e7f8404d0d5d2eadb08b5a50c5eb539f8d2eed70fe104b2f54c6cca65c46c2da2a55152a5c6fed5ca2acfc7a497b55c1d9eaa02e412495bb039
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-09-11 18:09:38 UTC using RuboCop version 1.80.2.
3
+ # on 2025-10-08 18:25:54 UTC using RuboCop version 1.81.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -13,7 +13,7 @@ Layout/TrailingWhitespace:
13
13
  Exclude:
14
14
  - 'lib/pwn/banner/radare2_ai.rb'
15
15
 
16
- # Offense count: 9
16
+ # Offense count: 10
17
17
  # Configuration parameters: AllowedMethods, AllowedPatterns.
18
18
  Lint/NestedMethodDefinition:
19
19
  Exclude:
@@ -30,7 +30,7 @@ Lint/RedundantTypeConversion:
30
30
  - 'lib/pwn/plugins/jenkins.rb'
31
31
  - 'lib/pwn/plugins/repl.rb'
32
32
 
33
- # Offense count: 320
33
+ # Offense count: 276
34
34
  # This cop supports safe autocorrection (--autocorrect).
35
35
  Lint/UselessAssignment:
36
36
  Enabled: false
@@ -60,13 +60,11 @@ Metrics/MethodLength:
60
60
  Exclude:
61
61
  - 'lib/pwn/banner/code_cave.rb'
62
62
 
63
- # Offense count: 3
63
+ # Offense count: 1
64
64
  # Configuration parameters: CountComments, Max, CountAsOne.
65
65
  Metrics/ModuleLength:
66
66
  Exclude:
67
- - 'lib/pwn/banner/code_cave.rb'
68
67
  - 'lib/pwn/plugins/android.rb'
69
- - 'lib/pwn/plugins/msr206.rb'
70
68
 
71
69
  # Offense count: 2
72
70
  Naming/AccessorMethodName:
@@ -81,7 +79,7 @@ Style/Alias:
81
79
  Exclude:
82
80
  - 'lib/pwn/plugins/monkey_patch.rb'
83
81
 
84
- # Offense count: 163
82
+ # Offense count: 119
85
83
  Style/ClassVars:
86
84
  Enabled: false
87
85
 
@@ -98,6 +96,13 @@ Style/ExplicitBlockArgument:
98
96
  Exclude:
99
97
  - 'lib/pwn/plugins/nmap_it.rb'
100
98
 
99
+ # Offense count: 1
100
+ # This cop supports safe autocorrection (--autocorrect).
101
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
102
+ Style/GuardClause:
103
+ Exclude:
104
+ - 'lib/pwn/plugins/monkey_patch.rb'
105
+
101
106
  # Offense count: 1
102
107
  # This cop supports safe autocorrection (--autocorrect).
103
108
  Style/IfUnlessModifier:
@@ -116,25 +121,14 @@ Style/MapIntoArray:
116
121
  - 'lib/pwn/plugins/char.rb'
117
122
  - 'lib/pwn/plugins/nexpose_vuln_scan.rb'
118
123
 
119
- # Offense count: 7
124
+ # Offense count: 2
120
125
  # This cop supports safe autocorrection (--autocorrect).
121
126
  # Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
122
127
  Style/MultipleComparison:
123
128
  Exclude:
124
- - 'lib/pwn/sast/banned_function_calls_c.rb'
125
- - 'lib/pwn/sast/cmd_execution_python.rb'
126
- - 'lib/pwn/sast/cmd_execution_ruby.rb'
127
- - 'lib/pwn/sast/deserial_java.rb'
128
- - 'lib/pwn/sast/factory.rb'
129
129
  - 'lib/pwn/www/duckduckgo.rb'
130
130
  - 'lib/pwn/www/twitter.rb'
131
131
 
132
- # Offense count: 1
133
- # This cop supports safe autocorrection (--autocorrect).
134
- Style/RedundantAssignment:
135
- Exclude:
136
- - 'lib/pwn/plugins/zaproxy.rb'
137
-
138
132
  # Offense count: 1
139
133
  # This cop supports safe autocorrection (--autocorrect).
140
134
  Style/RedundantBegin:
@@ -149,24 +143,6 @@ Style/RedundantCondition:
149
143
  Exclude:
150
144
  - 'lib/pwn/plugins/packet.rb'
151
145
 
152
- # Offense count: 13
153
- # This cop supports safe autocorrection (--autocorrect).
154
- Style/RedundantParentheses:
155
- Exclude:
156
- - 'lib/pwn/sast/banned_function_calls_c.rb'
157
- - 'lib/pwn/sast/cmd_execution_java.rb'
158
- - 'lib/pwn/sast/cmd_execution_python.rb'
159
- - 'lib/pwn/sast/cmd_execution_ruby.rb'
160
- - 'lib/pwn/sast/cmd_execution_scala.rb'
161
- - 'lib/pwn/sast/deserial_java.rb'
162
- - 'lib/pwn/sast/factory.rb'
163
- - 'lib/pwn/sast/log4j.rb'
164
- - 'lib/pwn/sast/logger.rb'
165
- - 'lib/pwn/sast/php_input_mechanisms.rb'
166
- - 'lib/pwn/sast/php_type_juggling.rb'
167
- - 'lib/pwn/sast/throw_errors.rb'
168
- - 'lib/pwn/sast/type_script_type_juggling.rb'
169
-
170
146
  # Offense count: 12
171
147
  # This cop supports safe autocorrection (--autocorrect).
172
148
  Style/RedundantStringEscape:
@@ -177,7 +153,19 @@ Style/RedundantStringEscape:
177
153
  - 'lib/pwn/sast/redos.rb'
178
154
  - 'vagrant/provisioners/kali_customize.rb'
179
155
 
180
- # Offense count: 62
156
+ # Offense count: 19
181
157
  # This cop supports unsafe autocorrection (--autocorrect-all).
182
158
  Style/SlicingWithRange:
183
- Enabled: false
159
+ Exclude:
160
+ - 'lib/pwn/ai/grok.rb'
161
+ - 'lib/pwn/ai/ollama.rb'
162
+ - 'lib/pwn/ai/open_ai.rb'
163
+ - 'lib/pwn/aws/iam.rb'
164
+ - 'lib/pwn/plugins/gqrx.rb'
165
+ - 'lib/pwn/plugins/irc.rb'
166
+ - 'lib/pwn/plugins/open_api.rb'
167
+ - 'lib/pwn/plugins/repl.rb'
168
+ - 'lib/pwn/plugins/serial.rb'
169
+ - 'lib/pwn/plugins/xxd.rb'
170
+ - 'lib/pwn/sast/pom_version.rb'
171
+ - 'lib/pwn/sast/test_case_engine.rb'
data/Gemfile CHANGED
@@ -18,6 +18,7 @@ gem 'aws-sdk', '3.3.0'
18
18
  # gem 'bettercap', '1.6.2'
19
19
  gem 'barby', '0.7.0'
20
20
  gem 'base32', '0.3.4'
21
+ gem 'bitcoin-ruby', '0.0.20'
21
22
  gem 'brakeman', '7.1.0'
22
23
  gem 'bson', '5.1.1'
23
24
  gem 'bundler', '>=2.7.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.444]:001 >>> PWN.help
40
+ pwn[v0.5.446]: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.444]:001 >>> PWN.help
55
+ pwn[v0.5.446]: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.444]:001 >>> PWN.help
65
+ pwn[v0.5.446]: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/etc/pwn.yaml.EXAMPLE CHANGED
@@ -34,6 +34,13 @@ asm:
34
34
  arch: 'x86_64'
35
35
  endian: 'little'
36
36
 
37
+ blockchain:
38
+ bitcoin:
39
+ rpc_host: '127.0.0.1'
40
+ rpc_port: 8332
41
+ rpc_user: 'bitcoin rpc user'
42
+ rpc_pass: 'bitcoin rpc password'
43
+
37
44
  irc:
38
45
  ui_nick: '_human_'
39
46
  shared_chan: '#pwn'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'bitcoin'
4
+ require 'base64'
3
5
  require 'json'
4
6
  require 'rest-client'
5
7
  require 'tty-spinner'
@@ -25,10 +27,20 @@ module PWN
25
27
  opts[:http_method].to_s.scrub.to_sym
26
28
  end
27
29
 
28
- base_uri = 'https://api.blockcypher.com/v1/btc/'
30
+ rpc_host = PWN::Env[:blockchain][:bitcoin][:rpc_host] ||= '127.0.0.1'
31
+ rpc_port = PWN::Env[:blockchain][:bitcoin][:rpc_port] ||= '8332'
32
+ base_uri = "http://#{rpc_host}:#{rpc_port}"
29
33
  rest_call = opts[:rest_call].to_s.scrub
30
34
  params = opts[:params]
31
- headers = { content_type: 'application/json; charset=UTF-8' }
35
+ rpc_user = PWN::Env[:blockchain][:bitcoin][:rpc_user] ||= PWN::Plugins::AuthenticationHelper.username(prompt: 'Bitcoin Node RPC Username')
36
+ rpc_pass = PWN::Env[:blockchain][:bitcoin][:rpc_pass] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Bitcoin Node RPC Password')
37
+
38
+ basic_auth = Base64.strict_encode64("#{rpc_user}:#{rpc_pass}")
39
+
40
+ headers = {
41
+ content_type: 'application/json; charset=UTF-8',
42
+ authorization: "Basic #{basic_auth}"
43
+ }
32
44
 
33
45
  http_body = opts[:http_body]
34
46
  http_body ||= {}
@@ -100,16 +112,20 @@ module PWN
100
112
  end
101
113
 
102
114
  # Supported Method Parameters::
103
- # latest_block = PWN::Blockchain::BTC.get_latest_block(
104
- # token: 'optional - API token for higher rate limits'
105
- # )
106
-
107
- public_class_method def self.get_latest_block(opts = {})
108
- params = {}
109
- params[:token] = opts[:token] if opts[:token]
110
-
111
- rest_call = 'main'
112
- response = btc_rest_call(rest_call: rest_call, params: params)
115
+ # latest_block = PWN::Blockchain::BTC.get_latest_block
116
+
117
+ public_class_method def self.get_latest_block
118
+ http_body = {
119
+ jsonrpc: '1.0',
120
+ id: self,
121
+ method: 'getblockchaininfo',
122
+ params: []
123
+ }
124
+
125
+ response = btc_rest_call(
126
+ http_method: :post,
127
+ http_body: http_body
128
+ )
113
129
 
114
130
  JSON.parse(response.body, symbolize_names: true)
115
131
  rescue StandardError => e
data/lib/pwn/config.rb CHANGED
@@ -51,6 +51,14 @@ module PWN
51
51
  }
52
52
  },
53
53
  asm: { arch: PWN::Plugins::DetectOS.arch, endian: PWN::Plugins::DetectOS.endian },
54
+ blockchain: {
55
+ bitcoin: {
56
+ rpc_host: 'localhost',
57
+ rpc_port: 8332,
58
+ rpc_user: 'bitcoin RPC Username',
59
+ rpc_pass: 'bitcoin RPC Password'
60
+ }
61
+ },
54
62
  irc: {
55
63
  ui_nick: '_human_',
56
64
  shared_chan: '#pwn',
@@ -10,10 +10,13 @@ module PWN
10
10
  # of other SP plugins/modules.
11
11
  module AuthenticationHelper
12
12
  # Supported Method Parameters::
13
- # PWN::Plugins::AuthenticationHelper.username
13
+ # PWN::Plugins::AuthenticationHelper.username(
14
+ # prompt: 'optional - string to display at prompt (Default: Username)'
15
+ # )
14
16
 
15
17
  public_class_method def self.username
16
- user = TTY::Prompt.new.ask('Username: ')
18
+ prompt = opts[:prompt] ||= 'Username'
19
+ user = TTY::Prompt.new.ask("#{prompt}: ")
17
20
  user.to_s.strip.chomp.scrub
18
21
  rescue StandardError => e
19
22
  raise e
@@ -21,11 +24,11 @@ module PWN
21
24
 
22
25
  # Supported Method Parameters::
23
26
  # PWN::Plugins::AuthenticationHelper.mask_password(
24
- # prompt: 'optional - string to display at prompt'
27
+ # prompt: 'optional - string to display at prompt (Default: Password)'
25
28
  # )
26
29
 
27
30
  public_class_method def self.mask_password(opts = {})
28
- opts[:prompt].nil? ? prompt = 'Password' : prompt = opts[:prompt].to_s.scrub.strip.chomp
31
+ prompt = opts[:prompt] ||= 'Password'
29
32
 
30
33
  pass = TTY::Prompt.new.mask("#{prompt}: ")
31
34
  pass.to_s.strip.chomp.scrub
@@ -37,11 +40,11 @@ module PWN
37
40
 
38
41
  # Supported Method Parameters::
39
42
  # PWN::Plugins::AuthenticationHelper.mfa(
40
- # prompt: 'optional - string to display at prompt'
43
+ # prompt: 'optional - string to display at prompt (Default: MFA Token)'
41
44
  # )
42
45
 
43
46
  public_class_method def self.mfa(opts = {})
44
- opts[:prompt].nil? ? prompt = 'MFA Token' : prompt = opts[:prompt].to_s.scrub.strip.chomp
47
+ prompt = opts[:prompt] ||= 'MFA Token'
45
48
 
46
49
  mfa = TTY::Prompt.new.ask("#{prompt}: ")
47
50
  mfa.to_s.strip.chomp.scrub
@@ -63,9 +66,13 @@ module PWN
63
66
 
64
67
  public_class_method def self.help
65
68
  puts "USAGE:
66
- #{self}.username
69
+ #{self}.username(
70
+ prompt: 'optional - string to display at prompt'
71
+ )
67
72
 
68
- #{self}.mask_password
73
+ #{self}.mask_password(
74
+ prompt: 'optional - string to display at prompt'
75
+ )
69
76
 
70
77
  #{self}.mfa(
71
78
  prompt: 'optional - string to display at prompt'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module PWN
4
4
  module Plugins
5
- # This module provides the abilty to centralize monkey patches used in PWN
5
+ # This module provides the ability to centralize monkey patches used in PWN
6
6
  module MonkeyPatch
7
7
  # Supported Method Parameters::
8
8
  # PWN::Plugins::MonkeyPatch.pry
@@ -31,6 +31,21 @@ module PWN
31
31
  alias << push
32
32
  end
33
33
 
34
+ require 'method_source'
35
+ MethodSource::CodeHelpers.module_eval do
36
+ alias_method :original_complete_expression?, :complete_expression?
37
+
38
+ def complete_expression?(expression)
39
+ original_complete_expression?(expression)
40
+ rescue SyntaxError => e
41
+ if e.message =~ /expected a `.*` to close the .* literal/ || e.message =~ /unterminated list/
42
+ false
43
+ else
44
+ raise e
45
+ end
46
+ end
47
+ end
48
+
34
49
  Pry.class_eval do
35
50
  def handle_line(line, options)
36
51
  if line.nil?
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.444'
4
+ VERSION = '0.5.446'
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.444
4
+ version: 0.5.446
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -93,6 +93,20 @@ dependencies:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
95
  version: 0.3.4
96
+ - !ruby/object:Gem::Dependency
97
+ name: bitcoin-ruby
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '='
101
+ - !ruby/object:Gem::Version
102
+ version: 0.0.20
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.20
96
110
  - !ruby/object:Gem::Dependency
97
111
  name: brakeman
98
112
  requirement: !ruby/object:Gem::Requirement