Código PHP:
program Md5_Cracker;
{$APPTYPE CONSOLE}
uses
SysUtils, StrUtils, Classes,
IdHTTP, IdException, IdHashMessageDigest, IdHash,
XMLDoc, XMLIntf,
ComObj,
JclPCRE;
type
TMethods = (mGet, mPost);
TOptions = (oRegEx, oShowAll,
oShowError, oShowHtml, oBeep,
oDecrypt, oEncrypt);
TOptionSet = set of TOptions;
TMd5Website = record
Url: string;
Field: string;
RegEx: string;
Method: TMethods;
end;
TMd5WebsiteArray = array of TMd5Website;
var
Timeout: Byte = 10;
MaxThread: Byte = 5;
XmlPath: string = 'Websites.xml';
Options: TOptionSet;
Hash: string;
ToHash: string;
Current: Byte;
function WriteCenterln(Str: string; Size: Byte = 80): string;
begin
Writeln(DupeString(' ', ((Size - Length(Str)) div 2)) + Str);
end;
function FillTo(Str: string; Size: Smallint): string;
begin
Result:= Str + DupeString(' ', Size - Length(Str));
end;
procedure LoadXml(var Md5WebList: TMd5WebsiteArray);
var
Xml: IXMLDocument;
Node: IXMLNode;
I: Byte;
begin
CoInitializeEx(nil, 0);
Xml:= LoadXMLDocument(XmlPath);
if(Xml.DocumentElement.NodeName = 'Websites')then
begin
SetLength(Md5WebList, Xml.DocumentElement.ChildNodes.Count);
for I:= 0 to Xml.DocumentElement.ChildNodes.Count -1 do
begin
Node:= Xml.DocumentElement.ChildNodes[I];
with Md5WebList[I] do
begin
Url:= AnsiReplaceText(Node.Text, 'Http://', '');
Field:= Node.Attributes['Field'];
RegEx:= Node.Attributes['RegEx'];
if(CompareText(Node.Attributes['Method'], 'Get') = 0)then
begin
Method:= mGet;
end
else
begin
Method:= mPost;
end;
end;
end;
end;
Xml:= nil;
end;
function CheckOnWebSite(Md5Website: Pointer): Integer;
var
Http: TIdHTTP;
Response: string;
Reg: TJclRegEx;
Args: TStringList;
HashResult: string;
UrlSplit: TStringList;
begin
Result:= 0;
Http:= TIdHTTP.Create(nil);
Reg:= TJclRegEx.Create;
UrlSplit:= TStringList.Create;
Http.ReadTimeout:= Timeout * 1000;
with TMd5Website(Md5Website^) do
begin
try
if(Method = mGet)then
begin
Response:= Http.Get('Http://' + Url + Field + '=' + Hash);
end
else
begin
Args:= TStringList.Create;
Args.Add(Field + '=' + Hash);
Response:= Http.Post('Http://' + Url, Args);
Args.Free;
end;
Reg.Options:= [roIgnoreCase];
Reg.Compile(RegEx, false, false);
Reg.Match(Response);
if(Reg.CaptureNameCount > 0)then
begin
HashResult:= Reg.NamedCaptures['Result'];
end;
except
on E: EIdConnectTimeOut do
begin
HashResult:= 'Time out';
end;
on E:EPCREError do
begin
if(E.ErrorCode = -1)then
begin
HashResult:= 'Not Found';
end;
end;
on E: Exception do
begin
HashResult:= Trim(E.Message);
end;
end;
if(HashResult = '')then
begin
HashResult:= 'Not Found';
end;
if(not((HashResult = 'Not Found') and not(oShowAll in Options)))then
begin
ExtractStrings( ['/', '\'], [], PChar(Url), UrlSplit);
WriteCenterln('³ ' + FillTo(UrlSplit[0], 24) + '³ ' + FillTo(HashResult, 49) + '³');
if(oBeep in Options)then
begin
Beep;
end;
if(oRegEx in Options)then
begin
WriteCenterln('Ã' + DupeString('Ä', 25) + 'Á' + DupeString('Ä', 50) + '´');
try
WriteCenterln('³ ' + FillTo(Reg.Captures[0], 75) + '³');
except
on E: Exception do
begin
WriteCenterln('³ ' + FillTo('Error ' + E.message, 75) + '³');
end;
end;
WriteCenterln('Ã' + DupeString('Ä', 25) + 'Â' + DupeString('Ä', 50) + '´');
end;
if(oShowHtml in Options)then
begin
WriteCenterln('Ã' + DupeString('Ä', 25) + 'Á' + DupeString('Ä', 50) + '´');
Writeln(Response);
WriteCenterln('Ã' + DupeString('Ä', 25) + 'Â' + DupeString('Ä', 50) + '´');
end;
end;
Current:= Current +1;
end;
Http.Free;
Reg.Free;
UrlSplit.Free;
end;
function GetMd5Hash(Hash: string): string;
var
Md5Digest: TIdHashMessageDigest5;
Hash4x4: T4x4LongWordRecord;
begin
Md5Digest:= TIdHashMessageDigest5.Create;
Hash4x4:= Md5Digest.HashValue(Hash);
Md5Digest.Free;
Result:= Md5Digest.AsHex(Hash4x4);
end;
procedure ShowHelp;
begin
WriteCenterln('Ú' + DupeString('Ä', 76) + '¿');
WriteCenterln(FillTo('³ -? display this help', 77) + '³');
WriteCenterln(FillTo('³ -d decrypt string', 77) + '³');
WriteCenterln(FillTo('³ -e encrypt string', 77) + '³');
WriteCenterln(FillTo('³ -b beep', 77) + '³');
WriteCenterln(FillTo('³ -m # number of threads', 77) + '³');
WriteCenterln(FillTo('³ -t # response timeout', 77) + '³');
WriteCenterln(FillTo('³ -x # xml path', 77) + '³');
WriteCenterln(FillTo('³ -a show all results', 77) + '³');
WriteCenterln(FillTo('³ -s show errors instead "Not Found" message', 77) + '³');
WriteCenterln(FillTo('³ -o show complete Regex output', 77) + '³');
WriteCenterln(FillTo('³ -r show complete Response output', 77) + '³');
WriteCenterln('À' + DupeString('Ä', 76) + 'Ù');
end;
function ParseArgs: TOptionSet;
var
I: Byte;
Param: string;
begin
Result:= [];
I:= 1;
while(not(I = ParamCount)) do
begin
try
Param:= ParamStr(I);
I:= I + 1;
if(CompareText(Param, '-m') = 0)then
begin
MaxThread:= StrToInt(ParamStr(I));
end
else if(CompareText(Param, '-t') = 0)then
begin
Timeout:= StrToInt(ParamStr(I));
end
else if(CompareText(Param, '-x') = 0)then
begin
XmlPath:= ParamStr(I);
end
else if(CompareText(Param, '-d') = 0)then
begin
Result:= Result + [oDecrypt];
Hash:= ParamStr(I);
end
else if(CompareText(Param, '-e') = 0)then
begin
Result:= Result + [oEncrypt];
ToHash:= ParamStr(I);
end
else if(CompareText(Param, '-b') = 0)then
begin
Result:= Result + [oBeep];
end
else if(CompareText(Param, '-a') = 0)then
begin
Result:= Result + [oShowAll];
end
else if(CompareText(Param, '-s') = 0)then
begin
Result:= Result + [oShowError, oShowAll];
end
else if(CompareText(Param, '-o') = 0)then
begin
Result:= Result + [oRegEx];
end
else if(CompareText(Param, '-r') = 0)then
begin
Result:= Result + [oShowHtml];
end
else if(CompareText(Param, '-?') = 0)then
begin
ShowHelp;
end;
except
Result:= [];
Writeln('Argument parse error ignored ' + ParamStr(I-1) + '.');
Writeln;
end;
end;
end;
var
Md5WebList: TMd5WebsiteArray;
I: Byte;
Tid: Cardinal;
begin
WriteCenterln('ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»');
WriteCenterln('º Md5 Hash Cracker º');
WriteCenterln('º º');
WriteCenterln('º By Hacker_wap º');
WriteCenterln('º Http://Forum-Invaders.com.br º');
WriteCenterln('ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ');
Writeln;
Options:= ParseArgs;
try
if(oDecrypt in Options)then
begin
LoadXml(Md5WebList);
WriteCenterln('Ú' + DupeString('Ä', 25) + 'Â' + DupeString('Ä', 50) + '¿');
for I:= 0 to Length(Md5WebList) -1 do
begin
while((I - Current) > MaxThread) do
begin
Sleep(50);
end;
BeginThread(nil, 0, @CheckOnWebSite, @Md5WebList[I], 0, Tid);
end;
repeat
Sleep(100);
until(Current = Length(Md5WebList));
WriteCenterln('À' + DupeString('Ä', 25) + 'Á' + DupeString('Ä', 50) + 'Ù');
end;
if(oEncrypt in Options)then
begin
WriteCenterln('Ú' + DupeString('Ä', 42) + 'Â' + DupeString('Ä', 33) + '¿');
WriteCenterln('³ ' + FillTo('Hash of "' + ToHash + '"', 41) + '³ ' + FillTo(GetMd5Hash(ToHash), 32) + '³');
WriteCenterln('À' + DupeString('Ä', 42) + 'Á' + DupeString('Ä', 33) + 'Ù');
end;
except
on E: Exception do
begin
Writeln('Error: ' + E.Message);
end;
end;
Readln;
end.
O codigo não ficou bom porque tive alguns problemas porem mesmo assim quiz terminar, talvez seja util á alguem