Skip to content

Commit 906e600

Browse files
committed
PWN::Plugins::Vault module - protect sensitive artifacts when presenting
1 parent 5e17984 commit 906e600

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ cd /opt/pwn
3737
$ ./install.sh
3838
$ ./install.sh ruby-gem
3939
$ pwn
40-
pwn[v0.5.73]:001 >>> PWN.help
40+
pwn[v0.5.74]: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.3.0@pwn
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.5.73]:001 >>> PWN.help
55+
pwn[v0.5.74]:001 >>> PWN.help
5656
```
5757

5858
If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.0@pwn
6262
$ rvmsudo gem uninstall --all --executables pwn
6363
$ rvmsudo gem install --verbose pwn
6464
$ pwn
65-
pwn[v0.5.73]:001 >>> PWN.help
65+
pwn[v0.5.74]:001 >>> PWN.help
6666
```
6767

6868
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:

lib/pwn/plugins/vault.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ def self.change_encryption_secrets(opts = {})
6767

6868
public_class_method def self.decrypt(opts = {})
6969
file = opts[:file].to_s.scrub if File.exist?(opts[:file].to_s.scrub)
70-
key = opts[:key]
71-
iv = opts[:iv]
72-
73-
raise 'ERROR: key and iv parameters are required.' if key.nil? || iv.nil?
70+
key = opts[:key] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Key')
71+
iv = opts[:iv] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'IV')
7472

7573
is_encrypted = file_encrypted?(file: file)
7674
raise 'ERROR: File is not encrypted.' unless is_encrypted
@@ -84,6 +82,8 @@ def self.change_encryption_secrets(opts = {})
8482
plain_text = cipher.update(b64_decoded_file_contents) + cipher.final
8583

8684
File.write(file, plain_text)
85+
rescue ArgumentError
86+
raise 'Invalid Key or IV.'
8787
rescue StandardError => e
8888
raise e
8989
end
@@ -168,10 +168,8 @@ def self.edit(opts = {})
168168

169169
public_class_method def self.encrypt(opts = {})
170170
file = opts[:file].to_s.scrub if File.exist?(opts[:file].to_s.scrub)
171-
key = opts[:key]
172-
iv = opts[:iv]
173-
174-
raise 'ERROR: key and iv parameters are required.' if key.nil? || iv.nil?
171+
key = opts[:key] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Key')
172+
iv = opts[:iv] ||= PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'IV')
175173

176174
cipher = OpenSSL::Cipher.new('aes-256-cbc')
177175
cipher.encrypt

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.5.73'
4+
VERSION = '0.5.74'
55
end

0 commit comments

Comments
 (0)