Support » Plugin: Exploit Scanner » 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 = '';
    $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";
    $hashes .= ");\r\n?>";
    echo "<pre>";
    echo $hashes;
    echo "</pre>";

Viewing 4 replies - 1 through 4 (of 4 total)
  • This looks awesome. Would you be able to give some detailed instructions (for the novice) as to how to install this? I just received notification to update to WP3.6, so I’m guessing that as soon as I do that I’ll be back to having 400+ false positives. By the way, have you tried this with the new WP3.6? Thanks.


    Upload this code as a php file to your server (or better still a local machine web testing setup). Put the latest WordPress zip file in the same directory and make sure to call it Then load the php file into you browser. It will produce the output you’ll need to save as hashes-3.6.php. I’ve tried it with 3.6 and it worked fine.


    Thank you very much, however, just so you know, no novice would EVER be able to figure out those instructions.

    I copied your code into Notebook and created a file called hashesgenerator.php and uploaded that to my blog. I placed the WP ZIP in the same directors and renamed it. Your code would not run, however, so I added “<?php” as the first line and “?>” as the last line.

    Now when I go to it runs but I get the error “Call to undefined function zip_open()”. Turns out PHP does not enable ZIP by default ( and I cannot figure out how to enable it.

    Anyway, I see that you’ve uploaded a copy of the WP3.6 hashes, so I’ll just grab those. Thanks!


    Thanks for the feedback – I really wouldn’t expect a novice to be trying this out anyway. I just did it to see if it was possible. Turns out it was and it was reasonably easy – but there are still certain skills one must acquire before using this code. I posted it so others can use if they wish and feel able.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hashes Generator’ is closed to new replies.