pwn 0.5.70 → 0.5.71
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/README.md +3 -3
- data/etc/pwn.yaml.EXAMPLE +2 -3
- data/lib/pwn/plugins/ollama.rb +2 -32
- data/lib/pwn/plugins/repl.rb +6 -13
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 677f7ef65de4483663672b6b2006281e018c9d9c91755f0d0d632bd35206ece1
|
|
4
|
+
data.tar.gz: d8210c6c330cd488410abb098809685ab68636b455d36779e6dd96d9247b1b6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4998737e42a14a97bb9abd13130fcd9dea70f32b061f22c895839a993545ad3703690de76507c0b01dcd952e1576cb9349aebaf2e9403af210b9bb7a0088ad3
|
|
7
|
+
data.tar.gz: 2145a9689d3174b5b3864ffb3079045e459e736f8594eae7667c56f35a81063b1c91b7ec6f504abaa9295ff1aeb3d25336273f7906b303a3fc310cd154538cef
|
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
|
37
37
|
$ ./install.sh
|
|
38
38
|
$ ./install.sh ruby-gem
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.5.
|
|
40
|
+
pwn[v0.5.71]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.3.0@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.5.
|
|
55
|
+
pwn[v0.5.71]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
|
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
|
64
64
|
$ pwn
|
|
65
|
-
pwn[v0.5.
|
|
65
|
+
pwn[v0.5.71]:001 >>> PWN.help
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
data/etc/pwn.yaml.EXAMPLE
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
ai_engine: 'openai'
|
|
4
4
|
|
|
5
5
|
openai:
|
|
6
|
-
key: '
|
|
6
|
+
key: 'OpenAI API Key'
|
|
7
7
|
|
|
8
8
|
ollama:
|
|
9
9
|
fqdn: 'FQDN for Open WebUI - e.g. https://ollama.local'
|
|
10
|
-
|
|
11
|
-
pass: 'Open WebUI password'
|
|
10
|
+
key: 'Open WebUI API Key Under Settings >> Account >> JWT Token'
|
|
12
11
|
model: 'Ollama model to use'
|
data/lib/pwn/plugins/ollama.rb
CHANGED
|
@@ -100,36 +100,6 @@ module PWN
|
|
|
100
100
|
spinner.stop
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
-
# Supported Method Parameters::
|
|
104
|
-
# response = PWN::Plugins::Ollama.get_key(
|
|
105
|
-
# fqdn: 'required - base URI for the Ollama API',
|
|
106
|
-
# user: 'required - ollama user',
|
|
107
|
-
# pass: 'required - ollama password',
|
|
108
|
-
# )
|
|
109
|
-
|
|
110
|
-
public_class_method def self.get_key(opts = {})
|
|
111
|
-
fqdn = opts[:fqdn]
|
|
112
|
-
user = opts[:user]
|
|
113
|
-
pass = opts[:pass]
|
|
114
|
-
|
|
115
|
-
http_body = {
|
|
116
|
-
email: user,
|
|
117
|
-
password: pass
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
response = ollama_rest_call(
|
|
121
|
-
fqdn: fqdn,
|
|
122
|
-
http_method: :post,
|
|
123
|
-
rest_call: 'api/v1/auths/signin',
|
|
124
|
-
http_body: http_body
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
json_resp = JSON.parse(response, symbolize_names: true)
|
|
128
|
-
json_resp[:token]
|
|
129
|
-
rescue StandardError => e
|
|
130
|
-
raise e
|
|
131
|
-
end
|
|
132
|
-
|
|
133
103
|
# Supported Method Parameters::
|
|
134
104
|
# response = PWN::Plugins::Ollama.get_models(
|
|
135
105
|
# token: 'required - Bearer token',
|
|
@@ -169,10 +139,10 @@ module PWN
|
|
|
169
139
|
request = opts[:request]
|
|
170
140
|
|
|
171
141
|
model = opts[:model]
|
|
172
|
-
|
|
142
|
+
raise 'ERROR: Model is required. Call #get_models method for details' if model.nil?
|
|
173
143
|
|
|
174
144
|
temp = opts[:temp].to_f
|
|
175
|
-
temp =
|
|
145
|
+
temp = 1 if temp.zero?
|
|
176
146
|
|
|
177
147
|
rest_call = 'ollama/v1/chat/completions'
|
|
178
148
|
|
data/lib/pwn/plugins/repl.rb
CHANGED
|
@@ -186,17 +186,9 @@ module PWN
|
|
|
186
186
|
when :openai
|
|
187
187
|
pi.config.pwn_ai_key = yaml_config[:openai][:key]
|
|
188
188
|
when :ollama
|
|
189
|
-
|
|
190
|
-
Pry.config.pwn_ai_fqdn =
|
|
191
|
-
|
|
192
|
-
ollama_user = yaml_config[:ollama][:user]
|
|
193
|
-
ollama_pass = yaml_config[:ollama][:pass]
|
|
194
|
-
ollama_ai_key = PWN::Plugins::Ollama.get_key(
|
|
195
|
-
fqdn: ollama_fqdn,
|
|
196
|
-
user: ollama_user,
|
|
197
|
-
pass: ollama_pass
|
|
198
|
-
)
|
|
199
|
-
pi.config.pwn_ai_key = ollama_ai_key
|
|
189
|
+
pi.config.pwn_ai_key = yaml_config[:ollama][:key]
|
|
190
|
+
Pry.config.pwn_ai_fqdn = yaml_config[:ollama][:fqdn]
|
|
191
|
+
Pry.config.pwn_ai_model = yaml_config[:ollama][:model]
|
|
200
192
|
else
|
|
201
193
|
raise "ERROR: Unsupported AI Engine: #{ai_engine} in #{yaml_config_path}"
|
|
202
194
|
end
|
|
@@ -252,11 +244,13 @@ module PWN
|
|
|
252
244
|
case ai_engine
|
|
253
245
|
when :ollama
|
|
254
246
|
fqdn = pi.config.pwn_ai_fqdn
|
|
247
|
+
model = pi.config.pwn_ai_model
|
|
248
|
+
|
|
255
249
|
response = PWN::Plugins::Ollama.chat(
|
|
256
250
|
fqdn: fqdn,
|
|
257
251
|
token: ai_key,
|
|
252
|
+
model: model,
|
|
258
253
|
request: request.chomp,
|
|
259
|
-
temp: 1,
|
|
260
254
|
response_history: response_history,
|
|
261
255
|
speak_answer: speak_answer
|
|
262
256
|
)
|
|
@@ -264,7 +258,6 @@ module PWN
|
|
|
264
258
|
response = PWN::Plugins::OpenAI.chat(
|
|
265
259
|
token: ai_key,
|
|
266
260
|
request: request.chomp,
|
|
267
|
-
temp: 1,
|
|
268
261
|
response_history: response_history,
|
|
269
262
|
speak_answer: speak_answer
|
|
270
263
|
)
|
data/lib/pwn/version.rb
CHANGED