pwn 0.4.656 → 0.4.657

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: 7467e6919286163bf5a06d165744365376f60350676a5f3e8cd3536321b70426
4
- data.tar.gz: e5336eae0eff19b8791e0ec559505a449eec7db3a13dee1fba2b6e18867e0bdf
3
+ metadata.gz: cccc9a73545d98c7ea358da6e2bfa4b1f559ea47bfc2c5508da928a3598f82e6
4
+ data.tar.gz: 96e8c671bbb5bf11e66ba57196eaccf052714d211f48bee30b99eb18bb14430a
5
5
  SHA512:
6
- metadata.gz: 493124cddad1d2a45b8f99572d3f856daaa6bbeec66cd3e932125ab6576c8485484b856c58b38f1c53f3ce6b9245bbddd311838db93b0910c3febcd1c62ddfcc
7
- data.tar.gz: c76a07fd7090ca844deb686a10d77b8ea732aa538fbae5fcffefad7ef5914e70a7a783ca1acf8054346b294e3f033737cd9bdc4ab34aac2bf5ed88251a093ce3
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.1'
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.656]: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.656]:001 >>> PWN.help
55
+ pwn[v0.4.657]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -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.656'
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.656
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.1
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.1
600
+ version: 1.5.2
601
601
  - !ruby/object:Gem::Dependency
602
602
  name: pry
603
603
  requirement: !ruby/object:Gem::Requirement