pwn 0.4.618 → 0.4.619

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: 46b245ad4f639c970cf5840e137c9d55deb5d6d79d46b423a9cec6c84048237d
4
- data.tar.gz: '082bff94ad45ee0891caaab8ce17b0e17e9f95180eacfaedb7ea8f62800e901b'
3
+ metadata.gz: 58a6651edf4d2111509bbfbace1caa37b7a5676e4324546264b0314ce0c8922c
4
+ data.tar.gz: dffc41ac0228ac773889e33bc9a903c8a636bcd6b59d166b55e2b3e14fe6770c
5
5
  SHA512:
6
- metadata.gz: 6aadac951190c38f228965ccff85b3af1c7e87053173ba0965ed39df4a96143ec398a45eeaad9cfc5ba1a064dab349a0f6965c6e1a2d4cdc0593df95662aa374
7
- data.tar.gz: e0b8483c95d6c1717dcce9127f5575aabd88aeb5bfad5760a920f559f0b50cc7135c358da2e827db7b6e8ff16cbfec702e09cd21488e597db16101a0185598dd
6
+ metadata.gz: 931533d6769fb90d3f44c2f08f5159066fdf58a80fc6d9cd5418c2d5e0831a2933c99c6c93ae4b5a200406dfa919753a5772a457004276ca428155ea23a2d77a
7
+ data.tar.gz: 4444938711c6afe3a8cae7ad2892c5ae6ad97548e85172c2533d884acfd47acfccfaa995091eb000b79eec45e7f7c036583c2089638bb5f1b3aac94c036bca47
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.2'
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.618]:001 >>> PWN.help
40
+ pwn[v0.4.619]: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-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.618]:001 >>> PWN.help
55
+ pwn[v0.4.619]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -91,15 +91,15 @@ module PWN
91
91
  end
92
92
 
93
93
  # Supported Method Parameters::
94
- # response = PWN::Plugins::OpenAI.default_chat(
94
+ # response = PWN::Plugins::OpenAI.legacy_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 text-davinci-003)',
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.default_chat(opts = {})
102
+ public_class_method def self.legacy_chat(opts = {})
103
103
  token = opts[:token]
104
104
  request = opts[:request]
105
105
  model = opts[:model]
@@ -112,12 +112,63 @@ module PWN
112
112
 
113
113
  rest_call = 'completions'
114
114
 
115
- http_body = {
116
- model: model,
117
- prompt: request,
118
- temperature: temp,
119
- max_tokens: max_tokens
120
- }
115
+ response = open_ai_rest_call(
116
+ http_method: :post,
117
+ token: token,
118
+ rest_call: rest_call,
119
+ http_body: http_body.to_json
120
+ )
121
+
122
+ JSON.parse(response, symbolize_names: true)
123
+ rescue StandardError => e
124
+ raise e
125
+ end
126
+
127
+ # Supported Method Parameters::
128
+ # response = PWN::Plugins::OpenAI.chat(
129
+ # token: 'required - Bearer token',
130
+ # request: 'required - message to ChatGPT'
131
+ # model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
132
+ # temp: 'optional - creative response float (deafults to 0)',
133
+ # max_tokens: 'optional - integer (defaults to 4_097 - request.length || 300)'
134
+ # )
135
+
136
+ public_class_method def self.chat(opts = {})
137
+ token = opts[:token]
138
+ request = opts[:request]
139
+ model = opts[:model]
140
+ model ||= 'gpt-3.5-turbo'
141
+ temp = opts[:temp].to_f
142
+ temp = 0 unless temp.positive?
143
+ max_tokens = opts[:max_tokens].to_i
144
+ max_tokens = 4_097 - request.to_s.length
145
+ max_tokens = 300 unless max_tokens.positive?
146
+
147
+ rest_call = 'chat/completions'
148
+
149
+ case model
150
+ when 'text-davinci-002',
151
+ 'text-davinci-003'
152
+ http_body = {
153
+ model: model,
154
+ prompt: request,
155
+ temperature: temp,
156
+ max_tokens: max_tokens
157
+ }
158
+ when 'gpt-3.5-turbo',
159
+ 'gpt-4'
160
+ http_body = {
161
+ model: model,
162
+ messages: [
163
+ role: 'system',
164
+ content: request
165
+ ],
166
+ temperature: temp,
167
+ max_tokens: max_tokens
168
+ }
169
+ else
170
+ raise "ERROR: #{model} not supported."
171
+ end
121
172
 
122
173
  response = open_ai_rest_call(
123
174
  http_method: :post,
@@ -179,11 +230,11 @@ module PWN
179
230
 
180
231
  public_class_method def self.help
181
232
  puts "USAGE:
182
- response = #{self}.default_chat(
233
+ response = #{self}.chat(
183
234
  token: 'required - Bearer token',
184
235
  request: 'required - message to ChatGPT',
185
- model: 'optional - model to use for text generation (defaults to text-davinci-003)',
186
- temp: 'optional - creative response float (deafults to 0)',
236
+ model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
237
+ temp: 'optional - creative response float (defaults to 0)',
187
238
  max_tokens: 'optional - integer (deafults to 4_097 - request.length || 300)'
188
239
  )
189
240
 
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.618'
4
+ VERSION = '0.4.619'
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.618
4
+ version: 0.4.619
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-13 00:00:00.000000000 Z
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.2
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.2
26
+ version: 7.0.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: anemone
29
29
  requirement: !ruby/object:Gem::Requirement