Jumping on a session with curl, tcpdump and grep
Sometimes you want to use the 'curl' command line utility to grab a page using your current session that you were browsing in from your web browser.
So you need to to first capture the cookie header, assuming the host you're talking to is not smart enough to use a rolling session ID or something, it should be pretty straight forwards.
The following tcpdump and grep line tells tcpdump to output STDOUT with line buffering enabled, and the grep pipe tells it to treat all input as text (as it's binary from tcpdump), and to stop after the first match.
# tcpdump -i eth1 host target.com -s 0 -w - -l 2>/dev/null | grep -ai -m 1 ^Cookie Cookie: ctime=2147483; PHPSESSID=6a87410c0a65ed057e4d449cc3015cda;
as you can see, the Cookie is containing the PHPSESSID, now we just feed this into curl command line with the header (cookie) option set, remove the "Cookie: " header part and keep the value.
$ curl -b "ctime=2147483; PHPSESSID=6a87410c0a65ed057e4d449cc3015cda;" target.com
have fun! you could probably script this solution into one script to do it all for you.
