Autor Beitrag
the-kecks
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Do 04.06.09 16:47 
hi,
ich hab mal wieder ein problem. ich möchte mich bei uploaded.to anmelden, er nimmt aber einfach die cookies nicht an (kriege kein log bei "OnNewCookie"). folglich gibt er auch nur immer die login seite aus (Memo2).
UPDATE: kann jetzt (wieder) compilieren, login klappt aber immernoch nicht -.- (siehe rs.com thread)
mein code:
-anmelden
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
begin
  [...]
  Params := TStringList.Create;
  try
    Params.Add('email=' + login);
    Params.Add('password=' + pw);
    try
      HTMLCode:=IdHTTP1.Post('http://uploaded.to/login', Params);
    except
      showmessage('Login fehlgeschlagen');
    end;
  finally
    Memo2.text:=HTMLCode;
    if pos('Login', HTMLCode) >0 then showmessage('Login fehlgeschlagen');
    Params.Free;
  end;
end;

-OnNewCookie
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  if (ACookie.Path = ''then ACookie.Path :='/';
  Memo1.Lines.Add('New Cookie:');
  Memo1.Lines.Add('  Comment: '+ACookie.Comment);
  Memo1.Lines.Add('  Version: '+ACookie.Version);
  Memo1.Lines.Add('  CookieText: '+ACookie.CookieText);
  Memo1.Lines.Add('  ServerCookie: '+ACookie.ServerCookie);
  Memo1.Lines.Add('  ClientCookie: '+ACookie.ClientCookie);
  Memo1.Lines.Add('  Domain: '+ACookie.Domain);
  Memo1.Lines.Add('  Expires: '+ACookie.Expires);
  Memo1.Lines.Add('  CookieName: '+ACookie.CookieName);
  Memo1.Lines.Add('  Path: '+ACookie.Path);
  Memo1.Lines.Add('  Value: '+ACookie.Value);
  Memo1.Lines.Add('  DisplayName: '+ACookie.DisplayName);
  Memo1.Lines.Add('');

-FormCreate
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
  SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;
  IdHTTP1.CookieManager := IdCookieManager1;
  IdHttp1.IOHandler := SSLIOHandler;
  IdHTTP1.HandleRedirects := true;
  IdHTTP1.Request.UserAgent := 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10';
  [...]
end;


mfg


Zuletzt bearbeitet von the-kecks am Sa 06.06.09 16:22, insgesamt 2-mal bearbeitet
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.06.09 00:51 
Hast du denn die IdSSLOpenSSL in der uses-Klausel?
Und die DLLs in deinem Programmverzeichnis?
Und warum benutzt du nicht TIdSSLIOHandlerSocketOpenSSL, wenn du OpenSSL benutzen möchtest?
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 09.06.09 14:13 
weiß niemand weiter :( ?

mfg
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Di 09.06.09 17:27 
Antworte doch erstmal auf die Frage von jaenicke.

_________________
PROGRAMMER: A device for converting coffee into software.
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 09.06.09 20:29 
siehe rs.com thread...
alles gemacht funzt aber immer noch nicht. kann IdHTTP1.Post(...) machen, nur wenn ich dann IdHTTP1.Get('uploaded.to/home'[ --> account daten (punkte etc.) raussuchen]) kommt der fehler EIdNotASocket "socket error # 10038 Socket operation on non-socket" :(
und wenn ich HTMLCode:=IdHTTP1.Post(...) mache ist HTMLCode=''

mfg
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Di 09.06.09 21:40 
Und jetzt nochmal den ganzen Code? Aus diesen 2 Befehlen, die du jetzt nur noch beschrieben hast (die auch nix mehr mit dem Code aus dem ersten Beitrag zu tun haben?) werd ich so einzeln nicht schlau.
Und welchen rs.com Thread meinst du? Verlink das doch wenigstens, wenn du schon woanders noch nen Thread auf machst!

Btw: Was wird denn das Ganze eigentlich?

_________________
PROGRAMMER: A device for converting coffee into software.
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 09.06.09 22:15 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Params := TStringList.Create;
  try
    Params.Add('email=' + login);
    Params.Add('password=' + pw);
    try
      HTMLCode:=IdHTTP1.Post('http://uploaded.to/login', Params);  //HTMLCode=''
    except
      showmessage('Login fehlgeschlagen');
    end;
  finally
    HTMLCode:=IdHTTP1.Get('http://uploaded.to/home'); //Socket error
    Memo2.text:=HTMLCode;
    if pos('Login', HTMLCode) >0 then showmessage('Login fehlgeschlagen');
    Params.Free;
  end;

es wird ein account checker für uploaded.to. Wie viel Traffic übrig ist etc.
rs.com thread (nicht von mir)

mfg
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Di 09.06.09 23:12 
Du solltest dir echt nochmal den Sinn von try...finally angucken.. so wie du es einsetzt, ist es absolut NICHT gedacht.
ich denke mal, dass das HTTP.Get direkt nach dem Post geschehen sollte - und zwar nur, wenn dieses erfolgreich war. Vielleicht solltest du erstmal dafür sorgen, dass dies erfolgreich geschieht? Warum das nicht geht, kA.

Vielleicht wollen die auch einfach nicht, dass man sich da mit Fremdprogrammen einloggen kann?

_________________
PROGRAMMER: A device for converting coffee into software.
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Mi 10.06.09 17:34 
jaja, mach ich ja alles noch. Erstmal solls funktionieren.
Die haben selber ein Tool gemacht wo man sich bei denen einloggen & uploaden kann. außerdem git es schon andere programme, die sich bei ul.to einloggen und daten rausfiltern können (zb jDownloader (in Java programmiert)).

mfg
Sirke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 208
Erhaltene Danke: 2



BeitragVerfasst: Mi 10.06.09 20:12 
Ich weiß nicht wie viel du bereits herumgespielt hast und dies evtl schon probiert hast, aber du solltest schon alle Daten übertragen:

ausblenden Delphi-Quelltext
1:
2:
3:
Params.Add('email=' + login);
Params.Add('password=' + pw);
Params.Add('submit=Login');
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Mi 10.06.09 21:55 
immernoch der gleiche fehler :(

mfg
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Sa 11.07.09 16:38 
hi,
melde mich nach längerer zeit nochmal zurück in diesem thread :D
nunja, ich bin jetzt schon etwas weiter aber so ganz klappt es immernoch nicht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
  Params.Add('email=' + login);
  Params.Add('password=' + pw);
  Params.Add('submit=Login');
...
  IdHTTP1.IOHandler:= IdIOHandlerStack1; //defaultport = 80
  IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
  IdHTTP1.Request.Referer := 'http://uploaded.to/';
  
  HTMLCode:=IdHTTP1.Post('http://uploaded.to/login', Params);
    
  IdHTTP1.IOHandler:= IdSSLIOHandlerSocketOpenSSL1;
  IdHTTP1.Request.ContentType := '';
  IdHTTP1.Request.Referer := '';

weitere einstellungen:
IdHTTP:
- AllowCookies: true
- handleRedirects: true
- cookiemanager: IdCookieManager1
- userAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10

Obwohl ich den CookieManager1 ja als cookieManager angegeben habe, gibt mir IdHTTP1.Post die login seite zurück in der steht:
Login failed! Activate Cookies, please.

mfg
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 11.07.09 16:45 
Erstens: Wozu behandelst du überhaupt das OnNewCookie Event? Ich weiß nicht, ob das Auswirkungen hat.
Zweitens: Warum änderst du den Pfad des Cookies?
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Sa 11.07.09 17:10 
das mit dem pfad hab ich inzwinschen raugenommen.
ich behandle das event, damit ich sehen kann ob ich einen cookie erhalten habe. aber leider zeichnet der ncihts auf :(

mfg
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 11.07.09 17:17 
Vielleicht musst du vor dem Login erst einmal wirklich auf die Startseite statt nur den Referrer zu setzen?

Selbst habe ich bisher fast noch nie mit den Indys auf dem Formular gearbeitet, weil ich das etwas zu umständlich finde. Aber wenn da kein Cookie ankommt, dann wird das ja nicht daran liegen (wenn auf dem Formular alles richtig gesetzt ist natürlich).
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Sa 11.07.09 17:28 
also hab jetz mal vor das post IdHTTP1.Get('http://uploaded.to/'); gesetzt aber es funzt immernoch nicht :(

mfg
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Di 14.07.09 22:16 
so funzt es:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
procedure TForm1.Button1Click(Sender: TObject);
var
  HTMLCode, auth : String;
  Batch, cookies : TStringlist;
begin
  Batch:=TStringlist.Create;
  cookies:=TStringlist.Create;
  try
    Batch.Add('curl -L -b cookies.txt -c cookies.txt -d "email='+ edit1.Text +'&password='+ edit2.Text +'" "http://www.uploaded.to/login"');
    Batch.SaveToFile(ExtractFilePath(ParamStr(0)) + 'temp.bat');
    WinExec(PChar(ExtractFilePath(ParamStr(0)) + 'temp.bat'), SW_HIDE);
    sleep(2000);
    if FileExists(ExtractFilePath(ParamStr(0)) + 'cookies.txt'then cookies.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'cookies.txt')
    else
    begin
      showmessage('Login fehlgeschlagen');
      exit;
    end;
    auth := Copy(cookies.text, pos('auth  ',cookies.text)+5, length(cookies.text)-pos('auth  ',cookies.text)-6);
    IdHTTP1.CookieManager.AddCookie('auth=' + auth, 'uploaded.to'); //vorher: '.uploaded.to'
    try
      HTMLCode:=IdHTTP1.Get('http://uploaded.to/home');
    except
      on E:Exception do
        showmessage('Login Fehlgeschlagen: "' + E.Message + '"');
    end;
    Memo2.text:=HTMLCode;
  finally
    if FileExists(ExtractFilePath(ParamStr(0)) + 'temp.bat'then deletefile(ExtractFilePath(ParamStr(0)) + 'temp.bat');
    if FileExists(ExtractFilePath(ParamStr(0)) + 'cookies.txt'then deletefile(ExtractFilePath(ParamStr(0)) + 'cookies.txt');
    cookies.free;
    Batch.free;
  end;
end;

cookies.txt:
Zitat:

# Netscape HTTP Cookie File
# curlm.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

.uploaded.to TRUE / FALSE 1342128589 lang en
.uploaded.to TRUE / FALSE 1342128589 auth 618683c1d06592b71ef9161bbf87ced9ba45c0



mfg


Zuletzt bearbeitet von the-kecks am Do 16.07.09 19:42, insgesamt 1-mal bearbeitet
the-kecks Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157
Erhaltene Danke: 1

Windows Vista Home Premium 64Bit
Delphi 7 Ent.
BeitragVerfasst: Mi 15.07.09 22:54 
niemand ne idee? ich steh echt aufm schlauch :(
PS: hab auch schon gecheckt ob der hash geht, funzt einwandfrei (benutze nicht den hash, den ich hier angegeben hab. wär ja auchn bisschen doof den hier anzugeben :D)
//ES FUNZT :)
habe code editert!

mfg