Цитата:
Сообщение от ilyhamas
Писал для себя. Есть антикапча
Код:
unit example;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdHttp, IdMultipartFormData, StdCtrls,StrUtils, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, ExtCtrls, sSkinManager, jpeg,
ComCtrls, TabNotBk, dblookup, Tabs, Spin;
function recognize(filename: string; apikey: string; is_phrase: boolean; is_regsense: boolean; is_numeric: boolean; min_len: integer; max_len: integer): string;
type
TForm1 = class(TForm)
Button1: TButton;
filenameedit: TEdit;
GroupBox1: TGroupBox;
Result: TGroupBox;
Image1: TImage;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
name: TEdit;
lname: TEdit;
mail: TEdit;
pass: TEdit;
IdHTTP1: TIdHTTP;
captchasid: TEdit;
apikeyedit: TEdit;
Button2: TButton;
Label6: TLabel;
Memo1: TMemo;
sSkinManager1: TsSkinManager;
Label1: TLabel;
code: TEdit;
Button3: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function recognize(filename: string; apikey: string; is_phrase: boolean; is_regsense: boolean; is_numeric: boolean; min_len: integer; max_len: integer): string;
var
ftype,tmpstr,captcha_id: String;
i: integer;
http: TIdHTTP;
multi: Tidmultipartformdatastream;
begin
if FileExists(filename)=false then begin result:='ERROR: file not found'; exit; end;
ftype:='image/pjpeg';
if strpos(Pchar(filename),'jpeg')<>nil then ftype:='image/pjpeg';
multi:=Tidmultipartformdatastream.Create;
multi.AddFormField('method','post');
multi.AddFormField('key',apikey);
multi.AddFile('file',filename,ftype);
if is_phrase=true then multi.AddFormField('phrase','1');
if is_regsense=true then multi.AddFormField('regsense','1');
if is_numeric=true then multi.AddFormField('numeric','1');
if min_len>0 then multi.AddFormField('min_len',inttostr(min_len));
if max_len>0 then multi.AddFormField('max_len',inttostr(max_len));
http:=TIdHTTP.Create(nil);
tmpstr:=http.Post('http://antigate.com/in.php',multi);
http.Free;
captcha_id:='';
if strpos(Pchar(tmpstr),'ERROR_')<>nil then begin result:=tmpstr; exit; end;
if strpos(Pchar(tmpstr),'OK|')<>nil then captcha_id:=AnsiReplaceStr(tmpstr,'OK|','');
if captcha_id='' then result:='ERROR: bad captcha id';
for i:=0 to 20 do
begin
Application.ProcessMessages;
sleep(5000);
http:=TIdHttp.Create(nil);
tmpstr:=http.Get('http://antigate.com/res.php?key='+apikey+'&action=get&id='+captcha_id);
http.Free;
if strpos(Pchar(tmpstr),'ERROR_')<>nil then begin result:=tmpstr; exit; end;
if strpos(Pchar(tmpstr),'OK|')<>nil then
begin
result:=AnsiReplaceStr(tmpstr,'OK|','');
exit;
end;
Application.ProcessMessages;
end;
result:='ERROR_TIMEOUT';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
statusbar1.Panels[0].Text:='.::Распознование::.';
code.Text:='Получение ответа...';
Button1.Enabled:=false;
code.Text:=recognize(filenameedit.Text,apikeyedit.Text,false,false,false,0,0);
Button1.Enabled:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
get1: String;
get: String;
data1: TStringList;
tf: TextFile;
begin
statusbar1.Panels[0].Text:='.::Регистрация аккуанта::.';
data1 := TStringList.Create;
data1.add('act=register');
data1.add('first_name='+name.text);
data1.add('last_name='+lname.text);
data1.add('regemail='+mail.text);
data1.add('regpass='+pass.text);
data1.add('sex=1');
data1.add('timezone=240');
data1.add('by_login=0');
data1.add('captcha_sid='+captchasid.text);
data1.add('captcha_key='+code.Text);
get1:=idhttp1.Post('http://vkontakte.ru/register.php', data1);
get:=copy(get1, 1,7);
if get ='{"do_lo' then
begin
memo1.Lines.add(mail.text+':'+pass.text);
assignfile(tf,'good.txt');
Append(tf);
writeln(tf, mail.text+':'+pass.text);
CloseFile(tf);
end
else
memo1.Lines.add('Ошибка! Попробуйте снова.');
end;
procedure TForm1.Button3Click(Sender: TObject);
var
http: tidhttp;
data: TStringList;
otvet1: String;
otvet: String;
f: TMemoryStream;
begin
statusbar1.Panels[0].Text:='.::Капча получена::.';
f := TMemoryStream.create;
http := tidhttp.Create(nil);
data := TStringList.Create;
data.add('act=register');
data.add('first_name='+name.text);
data.add('last_name='+lname.text);
data.add('regemail='+mail.text);
data.add('regpass='+pass.text);
data.add('sex=2');
data.add('timezone=240');
data.add('by_login=0');
sleep(200);
otvet1 := http.Post('http://vkontakte.ru/register.php', data);
sleep(200);
otvet := copy(otvet1, 25, 12);
captchasid.Text := otvet;
sleep(200);
http.Get('http://vkontakte.ru/captcha.php?sid='+otvet, f);
f.SaveToFile('captcha.jpg');
image1.Picture.LoadFromFile('captcha.jpg');
f.Free;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
button1.Enabled:=false;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
button1.Enabled:=true;
end;
end.
|
Ещё один [sensored], который присваивает себе мои сорсы.
http://pastie.org/924311
У тебя даже переменные так же называются.
Быдлокодер хренов.
|