Indyと私のfacebookアカウントにログインします。バージョンは9.00.10で、TIDHTTPでOpenSSLを使用し、クッキーマネージャを割り当てました。すべてが正常に動作します(私はPOSTリクエストGETなどを送ることができます) IndyとFacebookにログイン
は、私はFacebookのに実際のログインを盗聴し、私は次の情報を持っている:のUserAgent:Mozillaの/ 5.0(Windowsの; Uを;のWindows NT 6.0; EN-US; RV:
- LSD =私が持っている:1.9.2)Geckoの/ 20100115 Firefoxの/ 3.6(.NET CLR 3.5.30729)
いくつかのPOSTパラメータがあります。それが何であるか分かりません。
- email =実際のFacebookのユーザー名/メールアドレス。
- pass =パスワード(暗号化されていない) - >私は平文で見ることにショックを受けました。
- default_persistent =「ログインしてください」のための(0または1)
- timezone =タイムゾーンコード。
- lgnrnd =私はそれが何であるか分かりません。
- lgnjs =私はそれが何であるか分かりません。
- ロケールポストがhttps://www.facebook.com/login.php?login_attempt=1について説明する
=のGeoIP位置(e.x.はen_US)。しかし、私がログインしようとすると、私は間違ったメールを入力したことを返します。私は正しいeMailとパスワードを使用したと確信しています。ここで
は私のコードです:
procedure TForm1.Button1Click(Sender: TObject);
var
TEST : STRING;
lParamList: TStringList;
i : Integer;
begin
lParamList := TStringList.Create;
lparamlist.Add('lsd=AVoBzJ5G');
lparamlist.Add('email=myeMail%40mysite.com');
lparamlist.Add('pass=mypass');
lparamlist.Add('default_persistent=0');
lparamlist.Add('timezone=240');
lparamlist.Add('lgnrnd=210302_FeQV');
lparamlist.Add('lgnjs=1367035381');
lparamlist.Add('locale=en_US');
IDHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';
Test := IdHTTP1.Get('https://www.facebook.com'); // To get the first cookies.
for i := 0 to IDHTTP1.CookieManager.CookieCollection.Count - 1 do begin
ShowMessage(IDHTTP1.CookieManager.CookieCollection.Items[i].CookieText); // Show me the cookies.
end;
TEST := IDHTTP1.Post('https://www.facebook.com/login.php?login_attempt=1', lParamList);
StrToFile ('text.html', test);
ShellExecute (0, 'open', 'text.html', '', '', SW_SHOW);
end;
私はLiveHTTPHeadersからもらったパラメータを使用していました。 どのように私は正常にインディーズとFacebookにログインするでしょうか?
EDIT:XE2とインディ10でこれを試みたが、私は「間違った電子メール」のエラーを取得:hoForceEncodeParams
フラグはあなたがして、(それがデフォルトである)TIdHTTP.HTTPOptions
プロパティで有効になっている場合
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdCookieManager, IdIOHandler,
IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL, IdBaseComponent,
IdComponent, DateUtils, ShellAPI, IdTCPConnection, IdTCPClient, IdHTTP, Vcl.StdCtrls;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
IdCookieManager1: TIdCookieManager;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetBetween (Str: String; StrStart : String; StrEnd : String) : String;
var
iPos : Integer;
BackUp : String;
begin
result := '';
iPos := Pos (StrStart, Str);
if iPos <> 0 then begin
Delete (Str, 1, iPos + Length (StrStart) - 1);
iPos := Pos (StrEnd, Str);
if iPos <> 0 then begin
result := Copy(Str,1, iPos - 1);
end;
end;
end;
function StrToFile(szFilePath:string; dwPosition:DWORD; szInput:string):Boolean;
var
hFile: DWORD;
dwSize: DWORD;
dwWritten: DWORD;
begin
Result := FALSE;
hFile := CreateFileW(PWideChar(szFilePath), GENERIC_WRITE, 0, nil, CREATE_ALWAYS, 0, 0);
if hFile <> INVALID_HANDLE_VALUE then
begin
dwSize := Length(szInput) * 2;
if dwSize > 0 then
begin
SetFilePointer(hFile, dwPosition, nil, FILE_BEGIN);
WriteFile(hFile, szInput[1], dwSize, dwWritten, nil);
if dwWritten = dwSize then
Result := TRUE;
end;
CloseHandle(hFile);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Response : String;
lparamList : TStringList;
begin
IDHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';
try
Response := IDHTTP1.Get('https://www.facebook.com/');
except
end;
lParamList := TStringList.Create;
lParamList.Add('lsd='+GetBetween (Response, 'name="lsd" value="', '"'));
lParamList.Add('[email protected]');
lParamList.Add('pass=myPassword');
lParamList.Add('default_persistent'+GetBetween (Response, 'name="default_persistent" value="', '"'));
lParamList.Add('timezone=240');
lParamList.Add('lgnrnd='+GetBetween (Response, 'name="lgnrnd" value="', '"'));
lParamList.Add('lgnjs='+inttostr(DateTimeToUnix(Now)));
lParamList.Add('locale=en_US');
IDHTTP1.Request.Referer := 'https://www.facebook.com/';
try
Response := IDHTTP1.Post('https://www.facebook.com/login.php?login_attempt=1', lparamList);
except
end;
StrToFile ('test.html', 0, Response);
ShellExecute (0, 'open', 'test.html', '', '', SW_SHOW);
end;
end.
あなたにはスニファがあります。 Indyが送信しているデータをスニッフィングし、Webブラウザが送信するデータと比較します。 –
Fiddlerを使用してSSLデータをスニッフィングすることができます。これはローカルプロキシとして機能するためです。 Internet Explorerを含むWinInetベースのアプリケーションが実行中に自動的に接続されます。 'TIdHTTP'(これには' ProxyParams'プロパティがあります)を含め、他のアプリケーションを手動で設定する必要があります。 –
私は、TIdHTTPトラフィックを含むSSLトラフィックを盗聴するためにFiddlerを使用します。 'TIdHTTP.ProxyParams'プロパティが' TIdHTTP'にHTTPSサーバではなくFiddlerに直接接続するように設定するようにしてください。 –