From 2be4f79496ec05bc5143a28e3389c058154f9aaa Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 15 Mar 2024 13:44:26 +0100 Subject: initial package --- encryption.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 encryption.php (limited to 'encryption.php') diff --git a/encryption.php b/encryption.php new file mode 100644 index 0000000..be9d18b --- /dev/null +++ b/encryption.php @@ -0,0 +1,68 @@ + $file){ + $excludes[ $key ] = $src.'/'.$file; +} + +$rec = new RecursiveIteratorIterator(new RecursiveDirectoryIterator( $src )); +$require_funcs = array('include_once', 'include', 'require', 'require_once'); + + +foreach ($rec as $file) { + + if ($file->isDir()) { + $newDir = str_replace( 'src', 'encrypted', $file->getPath() ); + if( !is_dir( $newDir ) ) mkdir( $newDir ); + continue; + }; + + $filePath = $file->getPathname(); + + if( pathinfo($filePath, PATHINFO_EXTENSION) != 'php' || + in_array( $filePath, $excludes ) ) { + $newFile = str_replace('src', 'encrypted', $filePath ); + copy( $filePath, $newFile ); + continue; + } + + $contents = file_get_contents( $filePath ); + $preppand = ' ".$contents, $php_blot_key );*/ + $cipher = bolt_encrypt( $contents, $php_blot_key ); + $newFile = str_replace('src', 'encrypted', $filePath ); + $fp = fopen( $newFile, 'w'); + fwrite($fp, $preppand.$cipher); + fclose($fp); + + unset( $cipher ); + unset( $contents ); +} + +$out_str = substr_replace($src, '', 0, 4); +$file_location = __DIR__."/encrypted/".$out_str; +echo "Successfully Encrypted... Please check in " .$file_location." folder."; + + + -- cgit