d2d.emegrendeles.hu/public/phpBolt-encrypt/index.php
E98Developer 68b7c35bef git init
2026-02-28 06:53:05 +01:00

74 lines
2.1 KiB
PHP

<?php
/**
* phpBolt Titkosító Script - Javított verzió
*/
$src = __DIR__ . '/src';
$php_blot_key = "kyc7fh";
// Kimeneti mappa létrehozása
if (!is_dir(__DIR__ . '/encrypted')) {
mkdir(__DIR__ . '/encrypted', 0777, true);
}
$excludes = array();
foreach($excludes as $key => $file) {
$excludes[$key] = $src . '/' . $file;
}
$rec = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($src));
foreach ($rec as $file) {
if ($file->isDir()) {
$newDir = str_replace('src', 'encrypted', $file->getPath());
if (!is_dir($newDir)) {
mkdir($newDir, 0777, true);
}
continue;
}
$filePath = $file->getPathname();
// Csak a PHP fájlokat titkosítjuk
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);
// 1. Namespace kinyerése
$namespace = '';
if (preg_match('/namespace\s+([^;]+);/', $contents, $matches)) {
$namespace = $matches[0];
// Kivesszük az eredeti szövegből a névteret
$contents = str_replace($namespace, '', $contents);
}
// 2. PHP címkék eltávolítása a titkosítandó részből
$pure_code = str_replace(['<?php', '?>'], '', $contents);
// 3. Titkosítás (csak a tiszta kódot)
$cipher = bolt_encrypt($pure_code, $php_blot_key);
// 4. Új fájl összeállítása
$header = "<?php\n";
if (!empty($namespace)) {
$header .= $namespace . "\n";
}
// Fontos: a bolt_decrypt után rögtön jön a titkosított tartalom
//$header .= "bolt_decrypt(__FILE__, '" . $php_blot_key . "'); return 0;";
$header .= "bolt_decrypt(__FILE__, '" . $php_blot_key . "'); return 0; ?>##!!!##";
$newFile = str_replace('src', 'encrypted', $filePath);
$fp = fopen($newFile, 'w');
fwrite($fp, $header . $cipher);
fclose($fp);
unset($cipher);
unset($contents);
}
echo "Sikeres titkosítás! A zárójelek a helyükön vannak, a névterek pedig kívül.\n";