Hashes Generator
-
I was a bit bored today and given this plugin is often left a while without updated hashes when a new version of WordPress comes out I thought I’d see if I could write some PHP that parses the archive zip files and generates the hash file. This works:
/* Hash file generator for WordPress Exploit Scanner */ $file = 'latest.zip'; $hashes = "<" . '?php' . "\r\n" . '$filehashes = array(' . "\r\n"; $zip = zip_open(getcwd(). '/' . $file); if ( is_resource($zip) ) { while ( $zip_entry = zip_read($zip) ) { zip_entry_open($zip, $zip_entry, "r"); $file = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); if ( substr(zip_entry_name($zip_entry), -1, 1) !== "/" && strstr(zip_entry_name($zip_entry), 'wp-content/plugins/') === false && strstr(zip_entry_name($zip_entry), 'wp-content/themes/') === false ) { list($wp, $filename) = explode('/', zip_entry_name($zip_entry), 2); $hashes .= "'" . $filename . "' => '" . md5($file) . "',\r\n"; } zip_entry_close($zip_entry); } zip_close($zip); } $hashes .= ");\r\n?>"; echo "<pre>"; echo $hashes; echo "</pre>";
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Hashes Generator’ is closed to new replies.