Skip to content

Instantly share code, notes, and snippets.

@xcaptain
Created June 27, 2018 10:52
Show Gist options
  • Save xcaptain/0e7d3c1da5fa8f9076532c72acdfd032 to your computer and use it in GitHub Desktop.
Save xcaptain/0e7d3c1da5fa8f9076532c72acdfd032 to your computer and use it in GitHub Desktop.
破解网页js加密,把js语法转为php语法 http://www.lzkan.com/k/212509/61798041.html 中的fid
<?php
function transform($s)
{
$s0 = preg_replace('#String#', 'strval', $s);
$s1 = preg_replace('#!!\[\]#', 1, $s0);
$s2 = preg_replace('#!\[\]#', 0, $s1);
$s3 = preg_replace('#\[\]#', 0, $s2);
$s4 = preg_replace('#\)\)\)\+\(\(#', '))).((', $s3);
$s5 = preg_replace('#\)\)\+\(#', ')).(', $s4);
// $s5 = eval('echo ' . $s4 . ';');
return $s5;
}
function dec($code)
{
$e = eval('return '.$code.';');
echo "decing...{$e}\n";
return sha1($e);
}
$s1 = transform('String(((!![]+!![]+!![]+![])-(+![]+[]+[])+(!![]+!![]+!![]+![])))+((!![]+!![]+!![]+![])-(+![]+[]+[]))');
echo $s1 . "\n";
echo dec($s1) . "\n";
$s2 = transform('String(((+!![]+[])-(![]+![])))+(-(![]+!![]+!![])+(!![]+!![]))');
echo $s2 . "\n";
echo dec($s2) . "\n";
@xcaptain
Copy link
Author

String(((!![]+!![]+!![]+![])-(+![]+[]+[])+(!![]+!![]+!![]+![])))+(((+!![]+[])+(![]+![]))-(+!![]+[]+[]))
这个特例现在的实现没法处理,需要有更先进的技术来做

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment