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 +4 -4
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/lib/pwn/plugins/open_ai.rb +12 -8
- data/lib/pwn/plugins/openvas.rb +1 -1
- data/lib/pwn/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cccc9a73545d98c7ea358da6e2bfa4b1f559ea47bfc2c5508da928a3598f82e6
|
4
|
+
data.tar.gz: 96e8c671bbb5bf11e66ba57196eaccf052714d211f48bee30b99eb18bb14430a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52d89b0786494ce95a6584b15adb257b07deb281e92ad6dea318963f9bf9e7fc79fee106e2766b7f61b10069c0cab076b165cf199383f4a99b852fe60b2e6ce7
|
7
|
+
data.tar.gz: 322378b8f011f581deafdbfe62fa5a9a36cf028ec5acc1d30a1d9a7ef5d96d641e09c1fcb1bec2a12e19257aa3c66f2bae79a2a405f3773507733d1465a6d690
|
data/Gemfile
CHANGED
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.
|
40
|
+
pwn[v0.4.657]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](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.
|
55
|
+
pwn[v0.4.657]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
data/lib/pwn/plugins/open_ai.rb
CHANGED
@@ -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:
|
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)'
|
data/lib/pwn/plugins/openvas.rb
CHANGED
@@ -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
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.
|
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-
|
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.
|
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.
|
600
|
+
version: 1.5.2
|
601
601
|
- !ruby/object:Gem::Dependency
|
602
602
|
name: pry
|
603
603
|
requirement: !ruby/object:Gem::Requirement
|