Login   Register  
PHP Classes
elePHPant
Icontem

PHP Token Parser Engine: Parse PHP code to check if it matches syntax rules

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-01-28 (7 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 370 All time: 6,069 This week: 1,538Up
Version License PHP version Categories  
token-engine 1.0BSD License5PHP 5, Language, Security
Description Author  

This class can parse PHP code to check if it matches given syntax rules.

It can parse PHP scripts in a given directory or from a given PHP code string and obtain the PHP tokens that represent the parsed code.

The class check if the code matches given syntax rules defined as sequences of tokens read from a separate configuration file.

The rules may be used to detect if the parsed code is using malicious code hidden as function calls with names defined as variables.

It can also reformat the parsed PHP code and generate a new code version that may be more readable than the original.

Innovation Award  
PHP Programming Innovation award nominee
February 2014
Number 3


Prize: One copy of DWebPro Standard License
PHP provides built-in means to parse PHP code into tokens.

However, if you want to analyze eventual security problems in a PHP script, you need to resort to a more complex approach.

This class provides a sophisticated solution to detect malicious code in PHP scripts.

It can detect the presence of sequences of tokens defined by configurable expressions that may be the pattern of malicious code.

Manuel Lemos
Picture of Mike Gamble
Name: Mike Gamble <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 49
All time rank: 3205251 in Brazil Brazil
Week rank: 1763 Up138 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file token_engine.php Class Main class
Accessible without login Plain text file config.ini.php Conf. Configuration file required by class
Accessible without login Plain text file rules.ini.php Conf. Configuration file required by class
Accessible without login HTML file documentation.html Doc. Documentation
Accessible without login Plain text file index.php Example Example scanner script
Accessible without login Plain text file view.php Example Example script to be used with index.php
Accessible without login Plain text file example.php Data Example code to be scanned

 Version Control Unique User Downloads Download Rankings  
 0%Total:370All time:6,069
 This week:0This week:1,538Up