updraftplus
Last commit date
central
3 weeks ago
css
3 weeks ago
images
1 month ago
includes
3 weeks ago
js
3 weeks ago
languages
3 weeks ago
methods
3 weeks ago
templates
1 month ago
vendor
3 weeks ago
SECURITY.md
1 year ago
admin.php
3 weeks ago
backup.php
3 weeks ago
changelog-old.txt
2 years ago
class-updraftplus.php
3 weeks ago
example-decrypt.php
1 month ago
index.html
4 years ago
options.php
3 weeks ago
readme.txt
3 weeks ago
restorer.php
3 weeks ago
updraftplus.php
3 weeks ago
example-decrypt.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | if (!defined('ABSPATH')) die('No direct access allowed'); |
| 4 | // @codingStandardsIgnoreStart |
| 5 | /* |
| 6 | To dump the decrypted file using the given key on stdout, call: |
| 7 | |
| 8 | rijndael_decrypt_file('../path/to/file.crypt' , 'mykey'); |
| 9 | |
| 10 | Thus, here are the easy instructions: |
| 11 | |
| 12 | 1) Add a line like the above into this PHP file (not inside these comments, but outside) |
| 13 | e.g. |
| 14 | rijndael_decrypt_file('/home/myself/myfile.crypt' , 'MYKEY'); |
| 15 | |
| 16 | 2) Run this file (and make sure that includes/Rijndael.php is available, if you are moving this file around) |
| 17 | e.g. |
| 18 | php /home/myself/example-decrypt.php >output.sql.gz |
| 19 | |
| 20 | 3) You may then want to gunzip the resulting file to have a standard SQL file. |
| 21 | e.g. |
| 22 | gunzip output.sql.gz |
| 23 | |
| 24 | */ |
| 25 | // @codingStandardsIgnoreEnd |
| 26 | |
| 27 | /** |
| 28 | * An example of how to decrypt a file |
| 29 | * |
| 30 | * @param String $file Full path to file to decrypt |
| 31 | * @param String $key Key or salting to be used |
| 32 | */ |
| 33 | function rijndael_decrypt_file($file, $key) { |
| 34 | |
| 35 | include_once(dirname(__FILE__).'/vendor/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php'); |
| 36 | |
| 37 | $rijndael = new Crypt_Rijndael(); |
| 38 | |
| 39 | $rijndael->setKey($key); |
| 40 | |
| 41 | $ciphertext = file_get_contents($file); |
| 42 | |
| 43 | print $rijndael->decrypt($ciphertext);// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- intentional binary output |
| 44 | |
| 45 | } |
| 46 |