Ich möchte tcpdump
mit einigen Parametern ausführen (weiß immer noch nicht, was ich verwenden soll) und dann die Seite stackoverflow.com laden.
Die Ausgabe sollte die HTTP-Kommunikation sein. Später möchte ich es als Shell-Skript verwenden. Wenn ich also die HTTP-Kommunikation einer Site site.com überprüfen möchte, kann ich einfach script.sh site.com
.
Die HTTP-Kommunikation sollte einfach genug sein. So was:
GET /questions/9241391/how-to-capture-all-the-http-communication-data-using-tcp-dump
Host: stackoverflow.com
...
...
HTTP/1.1 200 OK
Cache-Control: public, max-age=60
Content-Length: 35061
Content-Type: text/html; charset=utf-8
Expires: Sat, 11 Feb 2012 15:36:46 GMT
Last-Modified: Sat, 11 Feb 2012 15:35:46 GMT
Vary: *
Date: Sat, 11 Feb 2012 15:35:45 GMT
....
decoded deflated data
....
Welche Optionen sollte ich nun mit tcpdump
verwenden, um es zu erfassen?
Dies kann durch ngrep
geschehen.
ngrep -q -d eth1 -W byline Host stackoverflow.com and port 80
^ ^ ^ ^
| | | |
| | | |
| | | v
| | | filter expression
| | |
| | +--> -W is set the dump format ("normal", "byline", "single", "none")
| |
| +----------> -d is use specified device instead of the pcap default
|
+-------------> -q is be quiet ("don't print packet reception hash marks")
Basierend auf dem, was Sie erwähnt haben, könnten ngrep (unter Unix) und Fiddler (Windows) bessere/einfachere Lösungen sein.
Wenn Sie tcpdump unbedingt verwenden möchten, probieren Sie die folgenden Optionen aus
tcpdump -A -vvv Host ziel_Hostname - A (Ascii) - vvv (ausführliche Ausgabe)
tcpdump -i eth0 -w dump3.pcap -v 'tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'