PluginProbe
UpdraftPlus: WP Backup & Migration Plugin / 1.26.5
UpdraftPlus: WP Backup & Migration Plugin v1.26.5
1.26.7 1.26.6 1.26.5 1.26.4 1.26.3 1.9.19 1.9.25 1.9.26 1.9.30 1.9.31 1.9.32 1.9.4 1.9.40 1.9.41 1.9.42 1.9.43 1.9.44 1.9.45 1.9.46 1.9.5 1.9.50 1.9.51 1.9.60 1.9.62 1.9.63 All 371 releases
updraftplus / example-decrypt.php

example-decrypt.php in UpdraftPlus: WP Backup & Migration Plugin 1.26.5, at example-decrypt.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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