/', $code)) {
return 'php';
}
// Check for JavaScript
if (preg_match('/function\s+\w+\s*\(|var\s+\w+\s*=|const\s+\w+\s*=|let\s+\w+\s*=|document\.|\$\(|return\s+[\w\'"]+|if\s*\(|for\s*\(/', $code)) {
return 'javascript';
}
// Check for CSS
if (preg_match('/(\.|#|body|html)\s*{.*}|@media|@keyframes|@import|@font-face/', $code)) {
return 'css';
}
// Check for HTML
if (preg_match('/\n" .
"
Protected by $domain
\n";
}
/**
* Base64 encode HTML and create a self-decoding script
*/
function obfuscate_base64($html) {
global $domain;
$credit = get_domain_credit();
// Add credit after original HTML before encoding
$html_with_credit = $html . $credit;
$encoded = base64_encode($html_with_credit);
return "\n\n\n" .
"\n" .
"Obfuscated Code\n" .
"\n" .
"\n\n" .
"\n" .
"\n" .
"\n";
}
/**
* PHP code obfuscation
*/
function obfuscate_php($code) {
global $domain;
$credit = "/* Obfuscated by $domain */\n";
// Remove comments
$code = preg_replace('!/\*.*?\*/!s', '', $code);
$code = preg_replace('!//.*?$!m', '', $code);
// Remove whitespace
$code = preg_replace('/\s+/', ' ', $code);
// Obfuscate variable names
$vars = array();
preg_match_all('/\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/', $code, $matches);
if (!empty($matches[1])) {
$uniqueVars = array_unique($matches[1]);
foreach ($uniqueVars as $var) {
// Skip variables that shouldn't be replaced
if (in_array($var, array('_POST', '_GET', '_REQUEST', '_SERVER', '_SESSION', '_COOKIE'))) {
continue;
}
$replacement = '$_' . substr(md5($var), 0, 8);
$vars['$' . $var] = $replacement;
$code = preg_replace('/\$' . preg_quote($var, '/') . '([^a-zA-Z0-9_\x7f-\xff])/', $replacement . '$1', $code);
}
}
// Encode strings
preg_match_all('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/', $code, $matches);
if (!empty($matches[0])) {
foreach ($matches[0] as $key => $str) {
if (strlen($str) > 3 && $str[0] === $str[strlen($str)-1]) {
$quote = $str[0];
$content = substr($str, 1, -1);
// Skip already encoded strings
if (strpos($content, 'base64_decode') !== false) {
continue;
}
// Only encode non-empty strings
if (!empty($content)) {
$base64 = base64_encode($content);
$code = str_replace($str, $quote . 'base64_decode("' . $base64 . '")' . $quote, $code);
}
}
}
}
// Add domain credit at the top of the file
$code = $credit . $code;
// Add HTML credit at the bottom if it's a PHP/HTML file
if (strpos($code, '?>') !== false && (strpos($code, '', '?>' . $html_credit, $code);
}
return $code;
}
/**
* JavaScript obfuscation
*/
function obfuscate_javascript($js) {
global $domain;
$credit = "/* Obfuscated by $domain */\n";
// Remove comments and whitespace
$js = preg_replace('!/\*.*?\*/!s', '', $js);
$js = preg_replace('!//.*?$!m', '', $js);
$js = preg_replace('/\s+/', ' ', $js);
// Convert strings to character codes
preg_match_all('/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/', $js, $matches);
if (!empty($matches[0])) {
foreach ($matches[0] as $key => $str) {
if (strlen($str) > 3 && $str[0] === $str[strlen($str)-1] && strpos($str, 'fromCharCode') === false) {
$quote = $str[0];
$content = substr($str, 1, -1);
// Convert string to char codes
$chars = array();
for ($i = 0; $i < strlen($content); $i++) {
$chars[] = ord($content[$i]);
}
// Only encode strings longer than 3 characters
if (count($chars) > 3) {
$js = str_replace($str, 'String.fromCharCode(' . implode(',', $chars) . ')', $js);
}
}
}
}
// Generate a random function name for eval
$evalName = '_' . substr(md5(uniqid()), 0, 8);
// Add domain protection
$domainCheck = "if(window.location.hostname!=='$domain'){console.log('Protected by $domain');}";
// Wrap in eval function
$js = $credit . $domainCheck . "function " . $evalName . "(p){return eval(p);}" . $evalName . "(\"" .
str_replace('"', '\\"', $js) . "\");";
return $js;
}
/**
* CSS obfuscation
*/
function obfuscate_css($css) {
global $domain;
$credit = "/* Obfuscated by $domain */\n";
// Remove comments and whitespace
$css = preg_replace('!/\*.*?\*/!s', '', $css);
$css = preg_replace('/\s+/', ' ', $css);
$css = str_replace('; ', ';', $css);
$css = str_replace(': ', ':', $css);
$css = str_replace('{ ', '{', $css);
$css = str_replace(' }', '}', $css);
$css = str_replace('} ', '}', $css);
// Add domain credit at the top
$css = $credit . $css;
// Add hidden domain protection
$domainProtection = "body::after{content:'Protected by $domain';display:none;}";
// Wrap in a style tag if not already in one
if (strpos($css, '\n" . $html_credit;
} else {
// If already in a style tag, add HTML credit after it
$html_credit = get_domain_credit();
$css = preg_replace('/<\/style>/', '' . $html_credit, $css);
$css = str_replace('
This advanced tool automatically detects your code type (HTML, PHP, CSS, JavaScript) and applies the most appropriate obfuscation method.
Auto-Detection
Automatically detects code type and applies the best Lock method
Custom Algorithms
Specialized obfuscation techniques for each language type
Enhanced Protection
Advanced techniques to make your code harder to reverse-engineer