TOR + Delphi + Synapse и нафиг нам прокси Code: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,Tlhelp32,shellapi,blckSock,httpsend,ExtCtrls,IdTCPClient; type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; httpsend:Thttpsend; x,x2,my_dir:string; Data:TStringStream; implementation {$R *.dfm} procedure TorChangeIP(AHost: string; APort: integer); const ErrMsg = 'Tor ChangeIP Error: '; var tcp: TIdTCPClient; begin tcp:=TIdTCPClient.Create(nil); try tcp.Host:=AHost; tcp.Port:=APort; tcp.Connect; try tcp.SendCmd('AUTHENTICATE',-1); if tcp.LastCmdResult.TextCode<>'250' then raise Exception.Create(ErrMsg+tcp.LastCmdResult.TextCode); tcp.SendCmd('SIGNAL NEWNYM',-1); if tcp.LastCmdResult.TextCode <>'250' then raise Exception.Create(ErrMsg+tcp.LastCmdResult.TextCode); finally tcp.Disconnect; end; finally tcp.Free; end; end; function KillTask(ExeFileName: string): Integer; const PROCESS_TERMINATE = $0001; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin Result := 0; FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := SizeOf(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); while Integer(ContinueLoop) <> 0 do begin if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeFileName))) then Result := Integer(TerminateProcess( OpenProcess(PROCESS_TERMINATE, BOOL(0), FProcessEntry32.th32ProcessID), 0)); ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle); end; procedure TForm1.Button1Click(Sender: TObject); begin TorChangeIP('127.0.0.1',9051); httpsend:=Thttpsend.Create; httpsend.Sock.SocksIP:='127.0.0.1'; httpsend.Sock.SocksPort:='9050'; httpsend.Sock.SocksType:=ST_Socks4; httpsend.Sock.SocksResolver:=false; HTTPSend.HTTPMethod('GET','http://www.ip-ping.ru/'); Data:=TStringStream.Create(''); httpsend.Document.SaveToStream(data); x:=Data.DataString; Data.Free; httpsend.free; Delete(x,1,pos('<div class="hc2">',x)+16); x2:=copy(x,1,pos('<',x)-1); Memo1.Text:=x2; end; procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin KillTask('tor.exe'); end; procedure TForm1.FormCreate(Sender: TObject); begin my_dir:=ExtractFilePath(ParamStr(0)); ShellExecute(1, 'open',pchar(my_dir+'\tor.exe') , 'sockslistenaddress localhost socksport 9050 controlport 9051', nil, SW_HIDE); end; end.
Thank you Mr : work good when have http but in https not work , how do it ? and how can get respence from post method ,Good work