How to save POST&GET headers of a web page with "Wireshark"?

1780
brilliant

I've been trying to find a python code that would log in to my mail box on yahoo.com from "Google App Engine". I was given this code:

import urllib, urllib2, cookielib url = "https://login.yahoo.com/config/login?" form_data = {'login' : 'my-login-here', 'passwd' : 'my-password-here'} jar = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar)) form_data = urllib.urlencode(form_data) # data returned from this pages contains redirection resp = opener.open(url, form_data) # yahoo redirects to http://my.yahoo.com, so lets go there instead resp = opener.open('http://mail.yahoo.com') print resp.read() 

The author of this script looked into HTML script of yahoo log-in form and came up with this script.

That log-in form contains two fields, one for users' Yahoo! ID and another one is for users' password.

However, when I tried this code out (substituting mu real Yahoo login for 'my-login-here' and my real password for 'my-password-here'), it just return the log-in form back to me, which means that something didn't work right.

Another supporter suggested that I should send an MD5 hash of my password, rather than a plain password.

He also noted that in that log-in form there are a lot other hidden fields besides login and password fields (he called them "CSRF protections") that I would also have to deal with:

<input type="hidden" name=".tries" value="1"> <input type="hidden" name=".src" value="ym"> <input type="hidden" name=".md5" value=""> <input type="hidden" name=".hash" value=""> <input type="hidden" name=".js" value=""> <input type="hidden" name=".last" value=""> <input type="hidden" name="promo" value=""> <input type="hidden" name=".intl" value="us"> <input type="hidden" name=".bypass" value=""> <input type="hidden" name=".partner" value=""> <input type="hidden" name=".u" value="bd5tdpd5rf2pg"> <input type="hidden" name=".v" value="0"> <input type="hidden" name=".challenge" value="5qUiIPGVFzRZ2BHhvtdGXoehfiOj"> <input type="hidden" name=".yplus" value=""> <input type="hidden" name=".emailCode" value=""> <input type="hidden" name="pkg" value=""> <input type="hidden" name="stepid" value=""> <input type="hidden" name=".ev" value=""> <input type="hidden" name="hasMsgr" value="0"> <input type="hidden" name=".chkP" value="Y"> <input type="hidden" name=".done" value="http://mail.yahoo.com"> 

He said that I should do the following:

  1. Simulate normal login and save login page that I get;
  2. Save POST&GET headers with "Wireshark";
  3. Compare login page with those headers and see what fields I need to include with my request;

I really don't know how to carry out the first two of these three steps. I have just downloaded "Wireshark" and have tried capturing some packets there. However, I don't know how to "simulate normal login and save the login page". Also, I don't how to save POST$GET headers with "Wireshark". Can anyone, please, guide me through these two steps in "Wireshark"? Or at least tell me what I should start with. Thank You.

0
Stoppen Sie, diese Frage alle zwei Stunden erneut zu veröffentlichen. random vor 14 Jahren 0
Bitte beachte, dass alle Fragen, die ich bisher gestellt habe, unterschiedlich sind. Zum Beispiel habe ich auf SO eine Frage gestellt, was ein Header ist, und die vorliegende Frage betrifft die Verwendung von "Wireshark", um POST & GET-Header zu erhalten. Dieses habe ich aus Versehen nur einmal neu gepostet und wollte den Zwilling löschen, sobald ich das entdeckte, aber die Moderatoren haben es leider früher als ich gesehen und gelöscht. Was bringt Sie dazu, zu glauben, dass ich diese Frage "alle zwei Stunden" neu gepostet habe? brilliant vor 14 Jahren 0

2 Antworten auf die Frage

2
Ignacio Vazquez-Abrams

You don't need Wireshark for this. Firebug is perfectly capable of tearing apart requests and responses right from Firefox.

@ Ignacio Vazquez-Abrams: Hallo Ignacio !!!! Ich habe Firebug ausprobiert und was ich dort bekam, war die gleiche Liste von "Eingabetypen", die Sie in meiner Frage sehen können (zweite vertikale blaue Linie auf der linken Seite). Aber nachdem ich sie herausgegriffen habe, weiß ich noch nicht, wie ich sie in meine Anfrage aufnehmen sollte und wo ihre korrekten Werte sind. (Ich dachte "Wireshark" würde es mir klar machen.) Hast du eine Idee? brilliant vor 14 Jahren 0
Versuchen Sie das Netzfeld. Ignacio Vazquez-Abrams vor 14 Jahren 0
Ist es eine Software, die ich herunterladen sollte? Wo kann ich das bekommen? brilliant vor 14 Jahren 0
Ja. Es heißt Firebug. Ich habe schon den Link dafür gegeben. Ignacio Vazquez-Abrams vor 14 Jahren 0
Ooops! Es tut mir leid!! Ich habe es dort nicht bemerkt. :( Ich habe dort "inspect" verwendet. brilliant vor 14 Jahren 0
Ich habe also gerade das Net-Panel aktiviert, aber es wird dort nichts angezeigt. brilliant vor 14 Jahren 0
Ignacio, es tut mir leid, aber ich denke es gibt etwas an "Wireshark", das "Firebug" nicht hat - mit dem "Firebug" sehe ich keine Post & Get-Header. Also werde ich diese Frage erneut beantworten. brilliant vor 14 Jahren 0
1
Sathya

When you were asked to

simulate normal login and save the login page

it was a a request for you to login to your Yahoo account as you would do normally from a Web Browser and save the page.

As for HTTP POST/GET variables & saving them, I don't have experience but you should probably have a look at this SO answer


Seems you're the OP for the Q in SO -.-

@ Sathya: Ich sehe, Sathya, ich danke dir für diesen Beitrag. brilliant vor 14 Jahren 0
Ja, Sathya, das bin ich da - ich tue alles Mögliche, um diese Sache zu verstehen. Trotzdem danke ich Ihnen, dass Sie mir erklärt haben, was dieser Unterstützer unter "simulieren" bedeutet. Als nicht-englischer Sprecher fiel es mir schwer, seine Bedeutung hinter diesem Wort zu erkennen. brilliant vor 14 Jahren 0