=PHP-5.0 Edit Configuration settings php shadowbugchecker.php /* Set valid file extensions to scan */ $types = array("log"); /* Set to path of log files */ DEFINE('PATH', 'd:/documents and settings/nheinen/my documents/1/'); /* Set keywords to parse log files for */ $keywords = array("null", "Box", "Jewel", "Invisible", "Blood", "Rena", "Devil"); /* Set prekey and/or postkey to narrow search */ DEFINE('PREKEY', 'Before using Jewel of Bless : ['); DEFINE('POSTKEY', ''); /* #################################################### */ /* DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING */ /* #################################################### */ if(!defined('PATH') || !defined('PREKEY') || !defined('POSTKEY')) { echo 'ERROR CONFIG: Please make sure PATH PREKEY and POSTKEY are defined'; exit(); } if(!is_array($types) || !is_array($keywords)) { echo 'ERROR CONFIG: Please make sure both $types and $keywords are arrays'; exit(); } if(!$files = @scandir(PATH)) { echo 'ERROR: Failed to find any files in set path'; exit(); } foreach($files as $file) { foreach($types as $type) { $pos = strrpos($file, '.'); if(substr($file, $pos + 1, strlen($type)) == $type) $logs[] = $file; } } if(!is_array($logs)) { echo "Error: No files found with file type specificed"; exit(); } echo "====================\n"; echo "Shadow Bug Checker\n"; echo "Version 0.1.0\n"; echo "Copyright (C) 2006 Muaddict.com\n"; echo "====================\n"; foreach($logs as $log) { if($handle = @fopen(PATH.$log, 'r')) { $i = 1; $l = 1; $start = time(); while(!feof($handle)) { $line = fgets($handle, 4096); foreach($keywords as $keyword) { $pos = strpos($line, PREKEY.$keyword.POSTKEY); if(!$pos === false) { list($time, $account, $char) = preg_split("/\s\[|\]\[|\].+/", $line); $data[$log]['infections'][] = array ( 'time' => $time, 'line' => $i, 'account' => $account, 'char' => $char ); } } if($i / $l == 25000) { $l++; echo '.'; } $i++; } fclose($handle); $end = time(); $data[$log]['run'] = $end - $start; echo "\n"; } else { echo "ERROR: Failed to open ".PATH.$log; exit(); } } foreach($data as $key_data => $value_data) { echo "\n====================\n"; echo "Scanned file ".$key_data." in ".$value_data['run']." seconds.\n"; echo "====================\n"; if(!isset($value_data['infections'])) { echo "0 infections found.\n"; } else { echo count($value_data['infections'])." infections found.\n"; foreach($value_data['infections'] as $value_infect) { echo "@".$value_infect['time']." on line ".$value_infect['line']."\n"; echo "Account: ".$value_infect['account']."\n"; echo "Char: ".$value_infect['char']."\n"; } } } echo "====================\n"; echo "END OF SCAN\n"; echo "====================\n"; ?>