Skip to content

Commit 37ee284

Browse files
committed
pwn_chat Driver - add a --voice parameter to speak answers via PWN::Plugins::Voice module
1 parent 7e9d774 commit 37ee284

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
3737
$ rvm list gemsets
3838
$ gem install --verbose pwn
3939
$ pwn
40-
pwn[v0.4.641]:001 >>> PWN.help
40+
pwn[v0.4.642]:001 >>> PWN.help
4141
```
4242

4343
[![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
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.4.641]:001 >>> PWN.help
55+
pwn[v0.4.642]:001 >>> PWN.help
5656
```
5757

5858

bin/pwn_chat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ OptionParser.new do |options|
2323
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|
2424
opts[:system_role_content] = s
2525
end
26+
27+
options.on('-v', '--voice', '<Options - Voice Activate Responses (Defaults to false)>') do |v|
28+
opts[:voice] = v
29+
end
2630
end.parse!
2731

2832
if opts.empty?
@@ -89,6 +93,8 @@ begin
8993

9094
system_role_content = opts[:system_role_content]
9195

96+
@voice = true if opts[:voice]
97+
9298
# Define Custom REPL Commands
9399
Pry::Commands.create_command 'welcome-banner' do
94100
description 'Display the random welcome banner, including basic usage.'
@@ -124,6 +130,12 @@ begin
124130
)
125131
puts "\n\n\n#{response[:choices].last[:content]}\n\n\n"
126132

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
138+
127139
@response_history = {
128140
id: response[:id],
129141
object: response[:object],

lib/pwn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PWN
4-
VERSION = '0.4.641'
4+
VERSION = '0.4.642'
55
end

0 commit comments

Comments
 (0)