Created
March 21, 2014 09:09
-
-
Save alexandernst/9682418 to your computer and use it in GitHub Desktop.
Detect eval calls using PHP's parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Usage: php detect.php /path/to/file.php | |
$data = file_get_contents($argv[1]); | |
$tokens = token_get_all($data); | |
foreach($tokens as $token){ | |
if($token[0]==T_EVAL){ | |
echo "Eval found in file " . $argv[1] . " on line: " . $token[2] . "\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment