pwn 0.4.618 → 0.4.620
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 +37 -15
- 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: fafd153cff40ac71671f4350a1b00459b355b9648797f013c206272d42fa1d7e
|
4
|
+
data.tar.gz: 1915f04c0ee44c2e71a3b90208e3bffed04a2445a2bba3151900fb36fd46ad6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff8533d123cd6ba697cd452d8526d11c82bed093f28cb2d5146396ebbf4df8b56ffffe343e32770f36cd9a12627b7a174d8b6bac8cc4ca4c569039a60e7c7dba
|
7
|
+
data.tar.gz: c4d482bd29938edf14ca98510ebc3885563f55000127c8a01d252a744dc6b671d4419bf89876dd3bafcfc8779c92b925785faeb605139d22b5c5ddb8501afbf3
|
data/Gemfile
CHANGED
@@ -11,7 +11,7 @@ gemspec
|
|
11
11
|
# In some circumstances custom flags are passed to gems in order
|
12
12
|
# to build appropriately. Defer to ./reinstall_pwn_gemset.sh
|
13
13
|
# to review these custom flags (e.g. pg, serialport, etc).
|
14
|
-
gem 'activesupport', '7.0.4.
|
14
|
+
gem 'activesupport', '7.0.4.3'
|
15
15
|
gem 'anemone', '0.7.2'
|
16
16
|
gem 'authy', '3.0.1'
|
17
17
|
gem 'aws-sdk', '3.1.0'
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-ruby-3.2.1@pwn
|
|
37
37
|
$ rvm list gemsets
|
38
38
|
$ gem install --verbose pwn
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.4.
|
40
|
+
pwn[v0.4.620]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-ruby-3.2.1@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.620]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
data/lib/pwn/plugins/open_ai.rb
CHANGED
@@ -91,33 +91,55 @@ module PWN
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Supported Method Parameters::
|
94
|
-
# response = PWN::Plugins::OpenAI.
|
94
|
+
# response = PWN::Plugins::OpenAI.chat(
|
95
95
|
# token: 'required - Bearer token',
|
96
96
|
# request: 'required - message to ChatGPT'
|
97
|
-
# model: 'optional - model to use for text generation (defaults to
|
97
|
+
# model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
|
98
98
|
# temp: 'optional - creative response float (deafults to 0)',
|
99
99
|
# max_tokens: 'optional - integer (defaults to 4_097 - request.length || 300)'
|
100
100
|
# )
|
101
101
|
|
102
|
-
public_class_method def self.
|
102
|
+
public_class_method def self.chat(opts = {})
|
103
103
|
token = opts[:token]
|
104
104
|
request = opts[:request]
|
105
105
|
model = opts[:model]
|
106
|
-
model ||= '
|
106
|
+
model ||= 'gpt-3.5-turbo'
|
107
|
+
# model ||= 'text-davinci-003'
|
107
108
|
temp = opts[:temp].to_f
|
108
109
|
temp = 0 unless temp.positive?
|
109
110
|
max_tokens = opts[:max_tokens].to_i
|
110
111
|
max_tokens = 4_097 - request.to_s.length
|
111
112
|
max_tokens = 300 unless max_tokens.positive?
|
112
113
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
114
|
+
case model
|
115
|
+
when 'text-davinci-002',
|
116
|
+
'text-davinci-003'
|
117
|
+
|
118
|
+
rest_call = 'completions'
|
119
|
+
|
120
|
+
http_body = {
|
121
|
+
model: model,
|
122
|
+
prompt: request,
|
123
|
+
temperature: temp,
|
124
|
+
max_tokens: max_tokens
|
125
|
+
}
|
126
|
+
when 'gpt-3.5-turbo',
|
127
|
+
'gpt-4'
|
128
|
+
|
129
|
+
rest_call = 'chat/completions'
|
130
|
+
|
131
|
+
http_body = {
|
132
|
+
model: model,
|
133
|
+
messages: [
|
134
|
+
role: 'system',
|
135
|
+
content: request
|
136
|
+
],
|
137
|
+
temperature: temp,
|
138
|
+
max_tokens: max_tokens
|
139
|
+
}
|
140
|
+
else
|
141
|
+
raise "ERROR: #{model} not supported."
|
142
|
+
end
|
121
143
|
|
122
144
|
response = open_ai_rest_call(
|
123
145
|
http_method: :post,
|
@@ -179,11 +201,11 @@ module PWN
|
|
179
201
|
|
180
202
|
public_class_method def self.help
|
181
203
|
puts "USAGE:
|
182
|
-
response = #{self}.
|
204
|
+
response = #{self}.chat(
|
183
205
|
token: 'required - Bearer token',
|
184
206
|
request: 'required - message to ChatGPT',
|
185
|
-
model: 'optional - model to use for text generation (defaults to
|
186
|
-
temp: 'optional - creative response float (
|
207
|
+
model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
|
208
|
+
temp: 'optional - creative response float (defaults to 0)',
|
187
209
|
max_tokens: 'optional - integer (deafults to 4_097 - request.length || 300)'
|
188
210
|
)
|
189
211
|
|
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.620
|
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-03-
|
11
|
+
date: 2023-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 7.0.4.
|
19
|
+
version: 7.0.4.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 7.0.4.
|
26
|
+
version: 7.0.4.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: anemone
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|