PHP Classes

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

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 423 This week: 1All time: 6,368 This week: 571Up
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
  Performance   Level  
Name: Mike Gamble <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 58
All time rank: 3468268 in Brazil Brazil
Week rank: 420 Up38 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:423
This week:1
All time:6,368
This week:571Up