pwn 0.4.655 → 0.4.657

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f7af8cb18c8f36419c44dd3b4617bf3b61565e48fc03d7801fb1b6530c6800b
4
- data.tar.gz: 3fe307e7bc617016528cbc1f8c9c3abdcb10f47339d654f43f9bc21328484563
3
+ metadata.gz: cccc9a73545d98c7ea358da6e2bfa4b1f559ea47bfc2c5508da928a3598f82e6
4
+ data.tar.gz: 96e8c671bbb5bf11e66ba57196eaccf052714d211f48bee30b99eb18bb14430a
5
5
  SHA512:
6
- metadata.gz: c13a613a2ec71b311b819660911bafdc98c54f5d09aea269ef3f88b22a22b6af0446d172bd3fa988f38a51bb74ab2998d198b5a8ae7260b28a168cd7b5693826
7
- data.tar.gz: 4326ba050a6572591520c5394576a2a8e3f00b996c523d313d8cf88c98a57a32754ade72bd1822b49e2ef1a3915f0ac46998015d45806812d2b2e5beeb18e199
6
+ metadata.gz: 52d89b0786494ce95a6584b15adb257b07deb281e92ad6dea318963f9bf9e7fc79fee106e2766b7f61b10069c0cab076b165cf199383f4a99b852fe60b2e6ce7
7
+ data.tar.gz: 322378b8f011f581deafdbfe62fa5a9a36cf028ec5acc1d30a1d9a7ef5d96d641e09c1fcb1bec2a12e19257aa3c66f2bae79a2a405f3773507733d1465a6d690
data/Gemfile CHANGED
@@ -52,7 +52,7 @@ gem 'oily_png', '1.2.1'
52
52
  gem 'os', '1.1.4'
53
53
  gem 'packetfu', '1.1.13'
54
54
  gem 'pdf-reader', '2.11.0'
55
- gem 'pg', '1.5.0'
55
+ gem 'pg', '1.5.2'
56
56
  gem 'pry', '0.14.2'
57
57
  gem 'pry-doc', '1.4.0'
58
58
  gem 'rake', '13.0.6'
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.655]:001 >>> PWN.help
40
+ pwn[v0.4.657]: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.2.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.655]:001 >>> PWN.help
55
+ pwn[v0.4.657]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -112,6 +112,34 @@ module PWN
112
112
  raise e
113
113
  end
114
114
 
115
+ # Supported Method Parameters::
116
+ # jira_resp = PWN::Plugins::JiraServer.manual_call(
117
+ # base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
118
+ # token: 'required - bearer token',
119
+ # path: 'required - API path to call, without beginning forward slash'
120
+ # )
121
+
122
+ public_class_method def self.manual_call(opts = {})
123
+ base_api_uri = opts[:base_api_uri]
124
+
125
+ token = opts[:token]
126
+ token ||= PWN::Plugins::AuthenticationHelper.mask_password(
127
+ prompt: 'Personal Access Token'
128
+ )
129
+
130
+ path = opts[:path]
131
+
132
+ raise 'ERROR: path cannot be nil.' if path.nil?
133
+
134
+ rest_call(
135
+ base_api_uri: base_api_uri,
136
+ token: token,
137
+ rest_call: path
138
+ )
139
+ rescue StandardError => e
140
+ raise e
141
+ end
142
+
115
143
  # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
116
144
 
117
145
  public_class_method def self.authors
@@ -124,12 +152,18 @@ module PWN
124
152
 
125
153
  public_class_method def self.help
126
154
  puts "USAGE:
127
- issue_resp = PWN::Plugins::JiraServer.get_issue(
155
+ issue_resp = #{self}.get_issue(
128
156
  base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
129
157
  token: 'required - bearer token',
130
158
  issue: 'required - issue to lookup'
131
159
  )
132
160
 
161
+ jira_resp = #{self}.manual_call(
162
+ base_api_uri: 'required - base URI for Jira (e.g. https:/corp.jira.com/rest/api/latest)',
163
+ token: 'required - bearer token',
164
+ path: 'required - API path to call, without beginning forward slash'
165
+ )
166
+
133
167
  #{self}.authors
134
168
  "
135
169
  end
@@ -102,7 +102,6 @@ module PWN
102
102
  # request: 'required - message to ChatGPT'
103
103
  # model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
104
104
  # temp: 'optional - creative response float (deafults to 0)',
105
- # max_tokens: 'optional - integer (defaults to 4_097 - request.length || 300)',
106
105
  # system_role_content: 'optional - context to set up the model behavior for conversation (Default: "You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.")',
107
106
  # response_history: 'optional - pass response back in to have a conversation',
108
107
  # speak_answer: 'optional speak answer using PWN::Plugins::Voice.text_to_speech (Default: nil)'
@@ -118,11 +117,6 @@ module PWN
118
117
  temp = opts[:temp].to_f
119
118
  temp = 0 unless temp.positive?
120
119
 
121
- # TODO: Accurately calculate max_tokens
122
- max_tokens = opts[:max_tokens].to_i
123
- max_tokens = 4_097 - request.to_s.length
124
- max_tokens = 300 unless max_tokens.positive?
125
-
126
120
  gpt = true if model.include?('gpt-3.5') || model.include?('gpt-4')
127
121
 
128
122
  if gpt
@@ -130,6 +124,12 @@ module PWN
130
124
 
131
125
  response_history = opts[:response_history]
132
126
 
127
+ max_tokens = response_history[:usage][:total_tokens] unless response_history.nil?
128
+ max_tokens ||= 4_096 - (request.to_s.length / 4)
129
+ max_tokens = 8_192 - (request.to_s.length / 4) if model.include?('gpt-4')
130
+ max_tokens = 32_768 - (request.to_s.length / 4) if model.include?('gpt-4-32k')
131
+ max_tokens = 300 unless max_tokens.positive?
132
+
133
133
  system_role_content = opts[:system_role_content]
134
134
  system_role_content ||= 'You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.'
135
135
  system_role_content = response_history[:choices].first[:content] if response_history
@@ -162,6 +162,11 @@ module PWN
162
162
 
163
163
  http_body[:messages].push(user_role)
164
164
  else
165
+ # Per https://openai.com/pricing:
166
+ # For English text, 1 token is approximately 4 characters or 0.75 words.
167
+ max_tokens = 4_097 - (request.to_s.length / 4)
168
+ max_tokens = 300 unless max_tokens.positive?
169
+
165
170
  rest_call = 'completions'
166
171
  http_body = {
167
172
  model: model,
@@ -212,7 +217,7 @@ module PWN
212
217
  system_role_content: system_role_content,
213
218
  request: "summarize what we've already discussed",
214
219
  temp: 1,
215
- max_tokens: 0,
220
+ max_tokens: max_tokens,
216
221
  response_history: response_history,
217
222
  speak_answer: speak_answer
218
223
  )
@@ -279,7 +284,6 @@ module PWN
279
284
  request: 'required - message to ChatGPT',
280
285
  model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
281
286
  temp: 'optional - creative response float (defaults to 0)',
282
- max_tokens: 'optional - integer (deafults to 4_097 - request.length || 300)',
283
287
  system_role_content: 'optional - context to set up the model behavior for conversation (Default: \"You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.\")',
284
288
  response_history: 'optional - pass response back in to have a conversation',
285
289
  speak_answer: 'optional speak answer using PWN::Plugins::Voice.text_to_speech (Default: nil)'
@@ -203,7 +203,7 @@ module PWN
203
203
  --gmp-username '#{username}' \
204
204
  --gmp-password '#{password}' \
205
205
  socket \
206
- --xml="<get_reports report_id='#{report_id}' format_id='#{format_id}'/>"
206
+ --xml="<get_reports report_id='#{report_id}' format_id='#{format_id}' details='1' />"
207
207
  `
208
208
  )
209
209
 
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.4.655'
4
+ VERSION = '0.4.657'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.655
4
+ version: 0.4.657
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-24 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -590,14 +590,14 @@ dependencies:
590
590
  requirements:
591
591
  - - '='
592
592
  - !ruby/object:Gem::Version
593
- version: 1.5.0
593
+ version: 1.5.2
594
594
  type: :runtime
595
595
  prerelease: false
596
596
  version_requirements: !ruby/object:Gem::Requirement
597
597
  requirements:
598
598
  - - '='
599
599
  - !ruby/object:Gem::Version
600
- version: 1.5.0
600
+ version: 1.5.2
601
601
  - !ruby/object:Gem::Dependency
602
602
  name: pry
603
603
  requirement: !ruby/object:Gem::Requirement