pwn 0.4.641 → 0.4.643
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 +2 -2
- data/README.md +2 -2
- data/bin/pwn_chat +63 -19
- data/lib/pwn/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf3fa66db2d9b1b7d8be45081cf1d2e733fb6b2caa0b3fe7c092790c2a4b43a
|
4
|
+
data.tar.gz: 3b70ba7c9096251aec921f1ed72d109c50ccaaaedea256bb0d700a69ea8fbd4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
40
|
+
pwn[v0.4.643]: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.643]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
data/bin/pwn_chat
CHANGED
@@ -23,6 +23,10 @@ OptionParser.new do |options|
|
|
23
23
|
options.on('-sSTAGE', '--system-role-content=STAGE', '<Optional - system Role Content Value to Define Behavior of assistant responses (Defaults to value in PWN::Plugins::OpenAI.chat method)>') do |s|
|
24
24
|
opts[:system_role_content] = s
|
25
25
|
end
|
26
|
+
|
27
|
+
options.on('-v', '--voice', '<Options - Voice Activate Responses (Defaults to false)>') do |v|
|
28
|
+
opts[:voice] = v
|
29
|
+
end
|
26
30
|
end.parse!
|
27
31
|
|
28
32
|
if opts.empty?
|
@@ -89,6 +93,8 @@ begin
|
|
89
93
|
|
90
94
|
system_role_content = opts[:system_role_content]
|
91
95
|
|
96
|
+
@voice = true if opts[:voice]
|
97
|
+
|
92
98
|
# Define Custom REPL Commands
|
93
99
|
Pry::Commands.create_command 'welcome-banner' do
|
94
100
|
description 'Display the random welcome banner, including basic usage.'
|
@@ -113,30 +119,68 @@ begin
|
|
113
119
|
end
|
114
120
|
|
115
121
|
@response_history = nil
|
122
|
+
@keep_in_memory = 0
|
116
123
|
Pry.config.hooks.add_hook(:after_eval, :open_ai_hook) do |request, _pry|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
146
|
+
|
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
|
135
177
|
end
|
136
178
|
|
137
179
|
if debug
|
138
180
|
Pry.config.hooks.add_hook(:after_eval, :open_ai_hook_resp) do |_request, _pry|
|
139
|
-
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?
|
140
184
|
end
|
141
185
|
end
|
142
186
|
|
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.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-
|
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.
|
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.
|
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.
|
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.
|
880
|
+
version: 0.112.0
|
881
881
|
- !ruby/object:Gem::Dependency
|
882
882
|
name: serialport
|
883
883
|
requirement: !ruby/object:Gem::Requirement
|