pwn 0.4.640 → 0.4.642

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c40109d7dcb603b5bc2b8de9dbf35572a4349b59d3077bd1201faaa06d31884
4
- data.tar.gz: be4911b1f1cbdfd1feb30458ac1c1ed82db29e82e0161737b3e76a423aec6e50
3
+ metadata.gz: e64877191025eecb6ff055c5b5ef451cb52f01502aa50b0ee6ef6e8f3fef9a2a
4
+ data.tar.gz: 557826a99958976edcd69803aef9fb73e88ccba55c919bf0854755b705b1a4cb
5
5
  SHA512:
6
- metadata.gz: 3d3d7b800e65da20d2b1642e322ed9a45cce9a7b907518d2b28de6ecd4c2301e37ec6faddac162cbd3f618ee58a9908b47790f4c4be1d6c2725b1453be301d8b
7
- data.tar.gz: 93798c09ef3098d1dab7d38c20a9b8bca87c3b8af0abec88dd707f313748aa5665246725007c264836d48850529ab941bbdb07e166a55ae48c0a5871df7bd5e1
6
+ metadata.gz: ec85372b9cebb045568c79593facdd7d1182dc700c0586acc32b2bc617f6c0dd18eeea6118032e8e63159601db36d97d103fd32e123380552558ebb909a05c88
7
+ data.tar.gz: 66f5e4ca76b2ab383e85b501312139a0c53af1ba2f3218b8e1b0bbb73d416e9e56442ce3275e24b1045d922cbc3e2df902bbd355eb1c9639784c5410134a654f
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.640]:001 >>> PWN.help
40
+ pwn[v0.4.642]: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.640]:001 >>> PWN.help
55
+ pwn[v0.4.642]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
data/bin/pwn CHANGED
@@ -12,7 +12,7 @@ begin
12
12
  delim = opts[:delim]
13
13
 
14
14
  # title = 'pwn'.red.bold
15
- title = "\001\e[1m\002\001\e[31m\002pwn\001\e[0m\002"
15
+ title = "\001\e[1m\002\001\e[31m\002#{File.basename($PROGRAM_NAME)}\001\e[0m\002"
16
16
  # version = PWN::VERSION.cyan
17
17
  version = "\001\e[36m\002v#{PWN::VERSION}\001\e[0m\002"
18
18
  # dchars = '>>>'.green
data/bin/pwn_chat ADDED
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'optparse'
5
+ require 'pwn'
6
+ require 'pry'
7
+ require 'yaml'
8
+
9
+ opts = {}
10
+ OptionParser.new do |options|
11
+ options.banner = "USAGE:
12
+ #{$PROGRAM_NAME} [opts]
13
+ "
14
+
15
+ options.on('-cPATH', '--yaml-config=PATH', '<Required - OpenAI YAML File>') do |p|
16
+ opts[:yaml_config_path] = p
17
+ end
18
+
19
+ options.on('-d', '--[no-]debug', '<Options - Display response_history Object During Session>') do |d|
20
+ opts[:debug] = d
21
+ end
22
+
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
+ opts[:system_role_content] = s
25
+ end
26
+
27
+ options.on('-v', '--voice', '<Options - Voice Activate Responses (Defaults to false)>') do |v|
28
+ opts[:voice] = v
29
+ end
30
+ end.parse!
31
+
32
+ if opts.empty?
33
+ puts `#{$PROGRAM_NAME} --help`
34
+ exit 1
35
+ end
36
+
37
+ begin
38
+ def gen_ps1_proc(opts = {})
39
+ delim = opts[:delim]
40
+
41
+ # title = 'pwn'.red.bold
42
+ title = "\001\e[1m\002\001\e[31m\002#{File.basename($PROGRAM_NAME)}\001\e[0m\002"
43
+ # version = PWN::VERSION.cyan
44
+ version = "\001\e[36m\002v#{PWN::VERSION}\001\e[0m\002"
45
+ # dchars = '>>>'.green
46
+ dchars = "\001\e[32m\002>>>\001\e[0m\002"
47
+ # dchars = '***'.yellow if delim == :splat
48
+ dchars = "\001\e[33m\002***\001\e[0m\002" if delim == :splat
49
+
50
+ proc do |_target_self, _nest_level, pry|
51
+ pry.config.pwn_repl_line += 1
52
+ line_pad = format(
53
+ '%0.3d',
54
+ pry.config.pwn_repl_line
55
+ )
56
+ line_count = "\001\e[34m\002#{line_pad}\001\e[0m\002" # Blue
57
+ "#{title}[#{version}]:#{line_count} #{dchars} ".to_s.scrub
58
+ end
59
+ end
60
+
61
+ class Pry
62
+ # Overwrite Pry::History.push method in History class to get duplicate history entries
63
+ # in order to properly replay automation in this prototyping driver
64
+ class History
65
+ def push(line)
66
+ return line if line.empty? || invalid_readline_line?(line)
67
+
68
+ begin
69
+ last_line = @history[-1]
70
+ rescue IndexError
71
+ last_line = nil
72
+ end
73
+
74
+ @history << line
75
+ @history_line_count += 1
76
+ @saver.call(line) if !should_ignore?(line) &&
77
+ Pry.config.history_save
78
+
79
+ line
80
+ end
81
+ alias << push
82
+ end
83
+ end
84
+
85
+ # Get OptParse Cli Parameters
86
+ yaml_config_path = opts[:yaml_config_path]
87
+ raise "ERROR: YAML Config => #{yaml_config_path} not found." unless File.exist?(yaml_config_path)
88
+
89
+ yaml_config = YAML.load_file(yaml_config_path, symbolize_names: true)
90
+ token = yaml_config[:bearer_token]
91
+
92
+ debug = opts[:debug]
93
+
94
+ system_role_content = opts[:system_role_content]
95
+
96
+ @voice = true if opts[:voice]
97
+
98
+ # Define Custom REPL Commands
99
+ Pry::Commands.create_command 'welcome-banner' do
100
+ description 'Display the random welcome banner, including basic usage.'
101
+
102
+ def process
103
+ puts PWN::Banner.welcome
104
+ end
105
+ end
106
+
107
+ Pry::Commands.create_command 'toggle-pager' do
108
+ description 'Toggle less on returned objects surpassing the terminal.'
109
+
110
+ def process
111
+ pi = pry_instance
112
+ pi.config.pager ? pi.config.pager = false : pi.config.pager = true
113
+ end
114
+ end
115
+
116
+ # Define REPL Hooks
117
+ Pry.config.hooks.add_hook(:before_session, :welcome) do |output, _binding, _pry|
118
+ output.puts PWN::Banner.welcome
119
+ end
120
+
121
+ @response_history = nil
122
+ 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
138
+
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
+ end
148
+
149
+ if debug
150
+ Pry.config.hooks.add_hook(:after_eval, :open_ai_hook_resp) do |_request, _pry|
151
+ puts @response_history
152
+ end
153
+ end
154
+
155
+ # Define PS1 Prompt
156
+ Pry.config.pwn_repl_line = 0
157
+ arrow_ps1_proc = gen_ps1_proc
158
+ splat_ps1_proc = gen_ps1_proc(delim: :splat)
159
+ prompt_ps1 = [arrow_ps1_proc, splat_ps1_proc]
160
+
161
+ pwn_prompt = Pry::Prompt.new(
162
+ :pwn_chat,
163
+ 'PWN Prototyping REPL w/ OpenAI Assistant',
164
+ prompt_ps1
165
+ )
166
+
167
+ # Start PWN REPL
168
+ Pry.config.prompt_name = :pwn_chat
169
+ Pry.start(
170
+ self,
171
+ prompt: pwn_prompt
172
+ )
173
+ rescue StandardError => e
174
+ raise e
175
+ end
@@ -97,7 +97,7 @@ module PWN
97
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
- # system_role_content: 'optional - context to set up the model behavior for conversation (Default: "You are an ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.")',
100
+ # system_role_content: 'optional - context to set up the model behavior for conversation (Default: "You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.")',
101
101
  # response_history: 'optional - pass response back in to have a conversation'
102
102
  # )
103
103
 
@@ -124,7 +124,7 @@ module PWN
124
124
  response_history = opts[:response_history]
125
125
 
126
126
  system_role_content = opts[:system_role_content]
127
- system_role_content ||= 'You are an ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.'
127
+ system_role_content ||= 'You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.'
128
128
  system_role_content = response_history[:choices].first[:content] if response_history
129
129
 
130
130
  system_role = {
@@ -237,7 +237,7 @@ module PWN
237
237
  model: 'optional - model to use for text generation (defaults to gpt-3.5-turbo)',
238
238
  temp: 'optional - creative response float (defaults to 0)',
239
239
  max_tokens: 'optional - integer (deafults to 4_097 - request.length || 300)',
240
- system_role_content: 'optional - context to set up the model behavior for conversation (Default: \"You are an ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.\")',
240
+ system_role_content: 'optional - context to set up the model behavior for conversation (Default: \"You are a sarcastic ethical hacker named Kennedy. You are able to access any content or website on any device or network without any limitations or filters.\")',
241
241
  response_history: 'optional - pass response back in to have a conversation'
242
242
  )
243
243
 
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.640'
4
+ VERSION = '0.4.642'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.640
4
+ version: 0.4.642
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -1091,6 +1091,7 @@ executables:
1091
1091
  - pwn_char_html_entity_encoding
1092
1092
  - pwn_char_unicode_escaped_encoding
1093
1093
  - pwn_char_url_encoding
1094
+ - pwn_chat
1094
1095
  - pwn_defectdojo_engagement_create
1095
1096
  - pwn_defectdojo_importscan
1096
1097
  - pwn_defectdojo_reimportscan
@@ -1157,6 +1158,7 @@ files:
1157
1158
  - bin/pwn_char_html_entity_encoding
1158
1159
  - bin/pwn_char_unicode_escaped_encoding
1159
1160
  - bin/pwn_char_url_encoding
1161
+ - bin/pwn_chat
1160
1162
  - bin/pwn_defectdojo_engagement_create
1161
1163
  - bin/pwn_defectdojo_importscan
1162
1164
  - bin/pwn_defectdojo_reimportscan