pwn 0.4.642 → 0.4.643

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +2 -2
  4. data/bin/pwn_chat +56 -24
  5. data/lib/pwn/version.rb +1 -1
  6. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e64877191025eecb6ff055c5b5ef451cb52f01502aa50b0ee6ef6e8f3fef9a2a
4
- data.tar.gz: 557826a99958976edcd69803aef9fb73e88ccba55c919bf0854755b705b1a4cb
3
+ metadata.gz: bbf3fa66db2d9b1b7d8be45081cf1d2e733fb6b2caa0b3fe7c092790c2a4b43a
4
+ data.tar.gz: 3b70ba7c9096251aec921f1ed72d109c50ccaaaedea256bb0d700a69ea8fbd4b
5
5
  SHA512:
6
- metadata.gz: ec85372b9cebb045568c79593facdd7d1182dc700c0586acc32b2bc617f6c0dd18eeea6118032e8e63159601db36d97d103fd32e123380552558ebb909a05c88
7
- data.tar.gz: 66f5e4ca76b2ab383e85b501312139a0c53af1ba2f3218b8e1b0bbb73d416e9e56442ce3275e24b1045d922cbc3e2df902bbd355eb1c9639784c5410134a654f
6
+ metadata.gz: 0a738aa1e3c60bd364b50df32e25cbd34dcdc23e446fbf0f91f53fb2e310ea88ca0f36e986bbe2a51bb091ccf325e16cb2581e4ed75e8befaf42ae2671687ba0
7
+ data.tar.gz: 8e30cbbcb5dcc2a109df22e979ff6e013f578a7140d70ee9e17af0d9c0e9a4f869a7dc5da065543b2cd710751accbd5e11d172fca426a5b24f75052f62f5921d
data/Gemfile CHANGED
@@ -66,13 +66,13 @@ gem 'rspec', '3.12.0'
66
66
  gem 'rtesseract', '3.1.2'
67
67
  gem 'rubocop', '1.50.2'
68
68
  gem 'rubocop-rake', '0.6.0'
69
- gem 'rubocop-rspec', '2.19.0'
69
+ gem 'rubocop-rspec', '2.20.0'
70
70
  gem 'ruby-audio', '1.6.1'
71
71
  gem 'ruby-nmap', '1.0.1'
72
72
  gem 'ruby-saml', '1.15.0'
73
73
  gem 'rvm', '1.11.3.9'
74
74
  gem 'savon', '2.14.0'
75
- gem 'selenium-devtools', '0.111.0'
75
+ gem 'selenium-devtools', '0.112.0'
76
76
  gem 'serialport', '1.3.2'
77
77
  gem 'sinatra', '3.0.6'
78
78
  gem 'slack-ruby-client', '2.1.0'
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.642]:001 >>> PWN.help
40
+ pwn[v0.4.643]: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.642]:001 >>> PWN.help
55
+ pwn[v0.4.643]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn_chat CHANGED
@@ -119,36 +119,68 @@ begin
119
119
  end
120
120
 
121
121
  @response_history = nil
122
+ @keep_in_memory = 0
122
123
  Pry.config.hooks.add_hook(:after_eval, :open_ai_hook) do |request, _pry|
123
- response = PWN::Plugins::OpenAI.chat(
124
- token: token,
125
- system_role_content: system_role_content,
126
- request: request.to_s,
127
- temp: 1,
128
- max_tokens: 0,
129
- response_history: @response_history
130
- )
131
- puts "\n\n\n#{response[:choices].last[:content]}\n\n\n"
132
-
133
- if @voice
134
- text_path = "/tmp/#{File.basename($PROGRAM_NAME)}.response"
135
- File.write(text_path, response[:choices].last[:content])
136
- PWN::Plugins::Voice.text_to_speech(text_path: text_path)
137
- end
124
+ if request.instance_of?(String)
125
+ unless @response_history.nil?
126
+ choices_len = @response_history[:choices].length
127
+ @keep_in_memory = choices_len * -1
128
+ end
129
+
130
+ begin
131
+ response = PWN::Plugins::OpenAI.chat(
132
+ token: token,
133
+ system_role_content: system_role_content,
134
+ request: request.to_s,
135
+ temp: 1,
136
+ max_tokens: 0,
137
+ response_history: @response_history
138
+ )
139
+ puts "\n\n\n#{response[:choices].last[:content]}\n\n\n"
140
+
141
+ if @voice
142
+ text_path = "/tmp/#{File.basename($PROGRAM_NAME)}.response"
143
+ File.write(text_path, response[:choices].last[:content])
144
+ PWN::Plugins::Voice.text_to_speech(text_path: text_path)
145
+ end
138
146
 
139
- @response_history = {
140
- id: response[:id],
141
- object: response[:object],
142
- model: response[:model],
143
- usage: response[:usage]
144
- }
145
- @response_history[:choices] = response[:choices].slice(-6..)
146
- @response_history[:choices] ||= response[:choices]
147
+ @response_history = {
148
+ id: response[:id],
149
+ object: response[:object],
150
+ model: response[:model],
151
+ usage: response[:usage]
152
+ }
153
+ @response_history[:choices] ||= response[:choices]
154
+ rescue JSON::ParserError
155
+ max_tokens = 4097
156
+ if request.length > max_tokens
157
+ puts "Request Length Too Long: #{request.length}\n"
158
+ else
159
+ puts 'Token Length too long, trimming memory by 1 and retrying...'
160
+ @keep_in_memory += 1
161
+ @response_history[:choices] = @response_history[:choices].slice(@keep_in_memory..)
162
+
163
+ response = PWN::Plugins::OpenAI.chat(
164
+ token: token,
165
+ system_role_content: system_role_content,
166
+ request: "summarize what we've already discussed",
167
+ temp: 1,
168
+ max_tokens: 0,
169
+ response_history: @response_history
170
+ )
171
+ @response_history[:choices] = response[:choices].slice(@keep_in_memory..)
172
+
173
+ retry
174
+ end
175
+ end
176
+ end
147
177
  end
148
178
 
149
179
  if debug
150
180
  Pry.config.hooks.add_hook(:after_eval, :open_ai_hook_resp) do |_request, _pry|
151
- puts @response_history
181
+ puts 'DEBUG: @response_history = '
182
+ pp @response_history
183
+ puts "@response_history[:choices] Length: #{@response_history[:choices].length}\n" unless @response_history.nil?
152
184
  end
153
185
  end
154
186
 
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.642'
4
+ VERSION = '0.4.643'
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.642
4
+ version: 0.4.643
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-17 00:00:00.000000000 Z
11
+ date: 2023-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -786,14 +786,14 @@ dependencies:
786
786
  requirements:
787
787
  - - '='
788
788
  - !ruby/object:Gem::Version
789
- version: 2.19.0
789
+ version: 2.20.0
790
790
  type: :runtime
791
791
  prerelease: false
792
792
  version_requirements: !ruby/object:Gem::Requirement
793
793
  requirements:
794
794
  - - '='
795
795
  - !ruby/object:Gem::Version
796
- version: 2.19.0
796
+ version: 2.20.0
797
797
  - !ruby/object:Gem::Dependency
798
798
  name: ruby-audio
799
799
  requirement: !ruby/object:Gem::Requirement
@@ -870,14 +870,14 @@ dependencies:
870
870
  requirements:
871
871
  - - '='
872
872
  - !ruby/object:Gem::Version
873
- version: 0.111.0
873
+ version: 0.112.0
874
874
  type: :runtime
875
875
  prerelease: false
876
876
  version_requirements: !ruby/object:Gem::Requirement
877
877
  requirements:
878
878
  - - '='
879
879
  - !ruby/object:Gem::Version
880
- version: 0.111.0
880
+ version: 0.112.0
881
881
  - !ruby/object:Gem::Dependency
882
882
  name: serialport
883
883
  requirement: !ruby/object:Gem::Requirement