pwn 0.5.439 → 0.5.440

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: 6754bb62346668c793d499dd95bf26e8fdda4eedc895ca50d471108eec8c3c95
4
- data.tar.gz: 8ffa2c66caf5b398578813c44279452b4beb13d439f2a793800d6751967170df
3
+ metadata.gz: c78cac3acda55f478eb71b17ab1a06d87b1b37c8e5cc260235043e505e8718d7
4
+ data.tar.gz: 2d852f2059b20e1cf732596d1e7860dfa7f6f1c40187bb3ab83518f24ea87364
5
5
  SHA512:
6
- metadata.gz: 015b510fcc0ab2e73430bab05c21f97b32993f9b4ea4aab418a367871184d91fbabc153ad078abd82031e0de3489827b597f85e53fe0e49958e1387c7e5d7f79
7
- data.tar.gz: 16ec47090606de2fcc40b10729feaf0d182a97f4b556e23ce72c1930d1abd4495e604c25d20dba9fdb80db2b3bee60042818786a7fbff6a51def3bb0016e33f9
6
+ metadata.gz: 3bf4baa2a80ca243341ca004aeaf0646abb8c334f1c5002950d094f96144fcd8d7c840a8f8875a68fe596604c7233eb8676a1a9f2d911d24efb04ea4d39db15f
7
+ data.tar.gz: f8acd123df9bbc1f055c70d8433717686ed8cd0ae467ba970b1d1594140e8112a7e6de5508d409215a3085816ab5f7af9123573ea24b25cbcae1415e22f88fe3
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.439]:001 >>> PWN.help
40
+ pwn[v0.5.440]: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.439]:001 >>> PWN.help
55
+ pwn[v0.5.440]: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.439]:001 >>> PWN.help
65
+ pwn[v0.5.440]: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/bin/pwn CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'optparse'
5
5
  require 'pwn'
6
6
 
7
- opts = {}
7
+ opts = PWN::Env[:driver_opts]
8
8
  OptionParser.new do |options|
9
9
  options.banner = "USAGE:
10
10
  #{File.basename($PROGRAM_NAME)} [opts]
data/lib/pwn/ai/grok.rb CHANGED
@@ -55,44 +55,53 @@ module PWN
55
55
  spin.auto_spin
56
56
  end
57
57
 
58
- case http_method
59
- when :delete, :get
60
- headers[:params] = params
61
- response = rest_client.execute(
62
- method: http_method,
63
- url: "#{base_uri}/#{rest_call}",
64
- headers: headers,
65
- verify_ssl: false,
66
- timeout: timeout
67
- )
68
-
69
- when :post
70
- if http_body.key?(:multipart)
71
- headers[:content_type] = 'multipart/form-data'
72
-
58
+ retry_count = 0
59
+ begin
60
+ case http_method
61
+ when :delete, :get
62
+ headers[:params] = params
73
63
  response = rest_client.execute(
74
64
  method: http_method,
75
65
  url: "#{base_uri}/#{rest_call}",
76
66
  headers: headers,
77
- payload: http_body,
78
67
  verify_ssl: false,
79
68
  timeout: timeout
80
69
  )
70
+
71
+ when :post
72
+ if http_body.key?(:multipart)
73
+ headers[:content_type] = 'multipart/form-data'
74
+
75
+ response = rest_client.execute(
76
+ method: http_method,
77
+ url: "#{base_uri}/#{rest_call}",
78
+ headers: headers,
79
+ payload: http_body,
80
+ verify_ssl: false,
81
+ timeout: timeout
82
+ )
83
+ else
84
+ response = rest_client.execute(
85
+ method: http_method,
86
+ url: "#{base_uri}/#{rest_call}",
87
+ headers: headers,
88
+ payload: http_body.to_json,
89
+ verify_ssl: false,
90
+ timeout: timeout
91
+ )
92
+ end
81
93
  else
82
- response = rest_client.execute(
83
- method: http_method,
84
- url: "#{base_uri}/#{rest_call}",
85
- headers: headers,
86
- payload: http_body.to_json,
87
- verify_ssl: false,
88
- timeout: timeout
89
- )
94
+ raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
90
95
  end
91
96
 
92
- else
93
- raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
97
+ response
98
+ rescue RestClient::TooManyRequests => e
99
+ retry_after = e.response.headers[:retry_after]&.to_i ||= (0.5 * (retry_count + 1))
100
+ sleep(retry_after + rand(0.3..5.0))
101
+ retry_count += 1
102
+
103
+ retry
94
104
  end
95
- response
96
105
  rescue RestClient::ExceptionWithResponse => e
97
106
  puts "ERROR: #{e.message}: #{e.response}"
98
107
  rescue StandardError => e
data/lib/pwn/ai/ollama.rb CHANGED
@@ -56,44 +56,53 @@ module PWN
56
56
  spin.auto_spin
57
57
  end
58
58
 
59
- case http_method
60
- when :delete, :get
61
- headers[:params] = params
62
- response = rest_client.execute(
63
- method: http_method,
64
- url: "#{base_uri}/#{rest_call}",
65
- headers: headers,
66
- verify_ssl: false,
67
- timeout: timeout
68
- )
69
-
70
- when :post
71
- if http_body.key?(:multipart)
72
- headers[:content_type] = 'multipart/form-data'
73
-
59
+ retry_count = 0
60
+ begin
61
+ case http_method
62
+ when :delete, :get
63
+ headers[:params] = params
74
64
  response = rest_client.execute(
75
65
  method: http_method,
76
66
  url: "#{base_uri}/#{rest_call}",
77
67
  headers: headers,
78
- payload: http_body,
79
68
  verify_ssl: false,
80
69
  timeout: timeout
81
70
  )
71
+
72
+ when :post
73
+ if http_body.key?(:multipart)
74
+ headers[:content_type] = 'multipart/form-data'
75
+
76
+ response = rest_client.execute(
77
+ method: http_method,
78
+ url: "#{base_uri}/#{rest_call}",
79
+ headers: headers,
80
+ payload: http_body,
81
+ verify_ssl: false,
82
+ timeout: timeout
83
+ )
84
+ else
85
+ response = rest_client.execute(
86
+ method: http_method,
87
+ url: "#{base_uri}/#{rest_call}",
88
+ headers: headers,
89
+ payload: http_body.to_json,
90
+ verify_ssl: false,
91
+ timeout: timeout
92
+ )
93
+ end
94
+
82
95
  else
83
- response = rest_client.execute(
84
- method: http_method,
85
- url: "#{base_uri}/#{rest_call}",
86
- headers: headers,
87
- payload: http_body.to_json,
88
- verify_ssl: false,
89
- timeout: timeout
90
- )
96
+ raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
91
97
  end
98
+ response
99
+ rescue RestClient::TooManyRequests => e
100
+ retry_after = e.response.headers[:retry_after]&.to_i ||= (0.5 * (retry_count + 1))
101
+ sleep(retry_after + rand(0.3..5.0))
102
+ retry_count += 1
92
103
 
93
- else
94
- raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
104
+ retry
95
105
  end
96
- response
97
106
  rescue RestClient::ExceptionWithResponse => e
98
107
  puts "ERROR: #{e.message}: #{e.response}"
99
108
  rescue StandardError => e
@@ -56,44 +56,53 @@ module PWN
56
56
  spin.auto_spin
57
57
  end
58
58
 
59
- case http_method
60
- when :delete, :get
61
- headers[:params] = params
62
- response = rest_client.execute(
63
- method: http_method,
64
- url: "#{base_uri}/#{rest_call}",
65
- headers: headers,
66
- verify_ssl: false,
67
- timeout: timeout
68
- )
69
-
70
- when :post
71
- if http_body.key?(:multipart)
72
- headers[:content_type] = 'multipart/form-data'
73
-
59
+ retry_count = 0
60
+ begin
61
+ case http_method
62
+ when :delete, :get
63
+ headers[:params] = params
74
64
  response = rest_client.execute(
75
65
  method: http_method,
76
66
  url: "#{base_uri}/#{rest_call}",
77
67
  headers: headers,
78
- payload: http_body,
79
68
  verify_ssl: false,
80
69
  timeout: timeout
81
70
  )
71
+
72
+ when :post
73
+ if http_body.key?(:multipart)
74
+ headers[:content_type] = 'multipart/form-data'
75
+
76
+ response = rest_client.execute(
77
+ method: http_method,
78
+ url: "#{base_uri}/#{rest_call}",
79
+ headers: headers,
80
+ payload: http_body,
81
+ verify_ssl: false,
82
+ timeout: timeout
83
+ )
84
+ else
85
+ response = rest_client.execute(
86
+ method: http_method,
87
+ url: "#{base_uri}/#{rest_call}",
88
+ headers: headers,
89
+ payload: http_body.to_json,
90
+ verify_ssl: false,
91
+ timeout: timeout
92
+ )
93
+ end
94
+
82
95
  else
83
- response = rest_client.execute(
84
- method: http_method,
85
- url: "#{base_uri}/#{rest_call}",
86
- headers: headers,
87
- payload: http_body.to_json,
88
- verify_ssl: false,
89
- timeout: timeout
90
- )
96
+ raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
91
97
  end
98
+ response
99
+ rescue RestClient::TooManyRequests => e
100
+ retry_after = e.response.headers[:retry_after]&.to_i ||= (0.5 * (retry_count + 1))
101
+ sleep(retry_after + rand(0.3..5.0))
102
+ retry_count += 1
92
103
 
93
- else
94
- raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
104
+ retry
95
105
  end
96
- response
97
106
  rescue RestClient::ExceptionWithResponse => e
98
107
  puts "ERROR: #{e.message}: #{e.response}"
99
108
  rescue StandardError => e
data/lib/pwn/config.rb CHANGED
@@ -88,6 +88,7 @@ module PWN
88
88
 
89
89
  env[:pwn_env_path] = pwn_env_path
90
90
  env[:pwn_dec_path] = pwn_dec_path
91
+ env[:driver_opts] = {}
91
92
 
92
93
  PWN::Plugins::Vault.create(
93
94
  file: pwn_env_path,
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.439'
4
+ VERSION = '0.5.440'
5
5
  end
data/lib/pwn.rb CHANGED
@@ -29,7 +29,7 @@ module PWN
29
29
  # PWN::Env is the constant that stores the configuration data
30
30
  # Only call this if the program name is not pwn
31
31
  driver = File.basename($PROGRAM_NAME)
32
- PWN::Config.refresh_env unless driver == 'pwn'
32
+ PWN::Config.refresh_env
33
33
  rescue StandardError => e
34
34
  puts e.backtrace
35
35
  raise e
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.439
4
+ version: 0.5.440
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.