Digest::MD5::Reverse - MD5 Reverse Lookup


Digest-MD5-Reverse documentation Contained in the Digest-MD5-Reverse distribution.

Index


Code Index:

NAME

Top

Digest::MD5::Reverse - MD5 Reverse Lookup

VERSION

Top

Version 1.3

SYNOPSIS

Top

    use Digest::MD5::Reverse;
    my $plaintext = reverse_md5($md5);    

DESCRIPTION

Top

MD5 sums (see RFC 1321 - The MD5 Message-Digest Algorithm) are used as a one-way hash of data. Due to the nature of the formula used, it is impossible to reverse it.

This module provides functions to search several online MD5 hashes database and return the results (or return undefined if no match found).

We are not breaking security. We are however making it easier to lookup the source of a MD5 sum.

EXAMPLES

Top

    use Digest::MD5::Reverse;
    print "Data is ".reverse_md5("acbd18db4cc2f85cedef654fccc4a4d8")."\n";    
    # Data is foo

DATABASE

Top

* milw0rm.com
* gdataonline.com
* hashreverse.com
* us.md5.crysm.net
* nz.md5.crysm.net
* ice.breaker.free.fr
* hashchecker.com
* md5.rednoize.com
* md5.xpzone.de
* md5encryption.com

SEE ALSO

Top

Digest::MD5

AUTHOR

Top

Raoul-Gabriel Urma << blwood@skynet.be >>

COPYRIGHT & LICENSE

Top


Digest-MD5-Reverse documentation Contained in the Digest-MD5-Reverse distribution.
package Digest::MD5::Reverse;

use warnings;
use strict;
use Socket;
use Exporter;

our $VERSION = "1.3";
our @ISA = qw(Exporter);
our @EXPORT = qw(&reverse_md5);


our $DATABASE = [
	{
		host => "milw0rm.com",
		path => "/cracker/search.php",
		meth => "POST",
		content => "hash=%value%&Submit=Submit",
		mreg => qr{
				<TR\sclass="submit">
                                <TD\salign="middle"\snowrap="nowrap"\swidth=90>md5<\/TD>
                                <TD\salign="middle"\snowrap="nowrap"\swidth=250>\w{32}<\/TD>
                                <TD\salign="middle"\snowrap="nowrap"\swidth=90>(.+?)<\/TD>
                                <TD\salign="middle"\snowrap="nowrap"\swidth=90>cracked<\/TD>
				<\/TR>
                                }x
	}, 
	{
        host => "gdataonline.com",
        path => "/qkhash.php?mode=xml&hash=%value%",
        meth => "GET",
        mreg => qr{
				<result>(.+?)<\/result>
                                    }x
    },
	{
		host => "hashreverse.com",
		path => "/index.php?action=view",
		meth => "POST",
		content => "hash=%value%&Submit2=Search+for+a+SHA1+or+MD5+hash",
		mreg => qr{
				<li>(.+?)<\/li>
                                    }x
	},
	{
		host => "us.md5.crysm.net",
		path => "/find?md5=%value%",
		meth => "GET",
		mreg => qr{
				<li>(.+?)<\/li>
                                    }x        
	},
	{
		host => "nz.md5.crysm.net",
		path => "/find?md5=%value%",
		meth => "GET",
		mreg => qr{
				<li>(.+?)<\/li>
                                    }x        
	},
	{
		host => "ice.breaker.free.fr",
		path => "/md5.php?hash=%value%",
		meth => "GET",
		mreg => qr{
				<br>\s-\s(.+?)<br>
                                    }x        
	},
    {
        host => "hashchecker.com",
        path => "/index.php",
        meth => "POST",
        content => "search_field=%value%&Submit=search",
        mreg => qr{
				<b>(.+?)<\/b>\sused\scharlist
                                    }x        
    },
    {
        host => "md5.rednoize.com",
        path => "/?s=md5&q=%value%",
        meth => "GET",
        mreg => qr{
				<div\sid="result"\s>(.+?)<\/div>
                                    }x
		
	},
	{
        host => "md5.xpzone.de",
        path => "/?string=%value%&mode=decrypt",
        meth => "GET",
        mreg => qr{
				Code:\s<b>(.+?)</b><br>
                                    }x
    },
	{
        host => "md5encryption.com",
        path => "/?mod=decrypt",
        meth => "POST",
		content => "hash2word=%value%",
        mreg => qr{
				<b>Decrypted\sWord:<\/b>\s(.*?)(?:<br\s\/>){2}
                                    }x   
    }
];

my $get = sub
{
	my($url,$path) = @_;
	socket(my $socket, PF_INET, SOCK_STREAM, getprotobyname("tcp")) or die "Socket Error : $!\n";
	connect($socket,sockaddr_in(80, inet_aton($url))) or die "Connect Error: $!\n";
	send($socket,"GET $path HTTP/1.1\015\012Host: $url\015\012User-Agent: Firefox\015\012Connection: Close\015\012\015\012",0);
	return do { local $/; <$socket> };
};

my $post = sub
{
	my($url,$path,$content) = @_;
	my $len = length $content;
	socket(my $socket, PF_INET, SOCK_STREAM, getprotobyname("tcp")) or die "Socket Error : $!\n";
	connect($socket,sockaddr_in(80, inet_aton($url))) or die "Connect Error : $!\n";
	send($socket,"POST $path HTTP/1.1\015\012Host: $url\015\012User-Agent: Firefox\015\012Content-Type: application/x-www-form-urlencoded\015\012Connection: Close\015\012Content-Length: $len\015\012\015\012$content\015\012",0);
	return do { local $/; <$socket> };
};

my $reverseit = sub  
{
	my $md5 = shift;
	return undef if length $md5 != 32;	
	my($string,$page);
	SEARCH:
	for my $site (@{ $DATABASE }) 
	{
		my $host = $site->{host};
		my $path = $site->{path};
		my $meth = $site->{meth};
		my $mreg = $site->{mreg};        
		my $content = $site->{content};
        if($meth eq "POST")
        {
		$content =~ s/%value%/$md5/ig;
		$page = $post->($host,$path,$content);            
        }
        else
        {
		$path =~ s/%value%/$md5/ig;
		$page = $get->($host,$path);            
        }         
	next unless $page;
	last SEARCH if(($string) = $page =~ /$site->{mreg}/);
	}
	return $string ? $string : undef;
};

sub reverse_md5
{
	return $reverseit->(shift);	
}

1;