FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Home  »  Software  »  HTTP Packet Capturing to debug Apache

by 4 comments

This article is a quick and easy HowTo detailing the use of Wireshark or another network sniffing program to debug your Apache .htaccess or httpd.conf files.

First some shell based tools.

wget -S --spider URLlynx -head -dump URLcurl -I URLHEAD URLGET -de URLw3m -dump_head URLsiege -g URL


Set Your Capture-filter to tcp port 80 and then start capturing. Use any of the following display filters to view the data you want.

Display Filters

HTTP Display Filter Options

  • http.accept String Accept
  • http.accept_encoding String Accept Encoding
  • http.accept_language String Accept-Language
  • http.authbasic String Credentials
  • http.authorization String Authorization
  • http.cache_control String Cache-Control
  • http.connection String Connection
  • http.content_encoding String Content-Encoding
  • http.content_length Unsigned 32-bit integer Content-Length
  • http.content_type String Content-Type
  • http.cookie String Cookie
  • http.date String Date
  • http.host String Host
  • http.last_modified String Last-Modified
  • http.location String Location
  • http.notification Boolean Notification
  • http.proxy_authenticate String Proxy-Authenticate
  • http.proxy_authorization String Proxy-Authorization
  • http.referer String Referer
  • http.request Boolean Request
  • http.request.method String Request Method
  • http.request.uri String Request URI
  • http.request.version String Request Version
  • http.response Boolean Response
  • http.response.code Unsigned 16-bit integer Response Code
  • http.server String Server
  • http.set_cookie String Set-Cookie
  • http.transfer_encoding String Transfer-Encoding
  • http.user_agent String User-Agent
  • http.www_authenticate String WWW-Authenticate
  • http.x_forwarded_for String X-Forwarded-For

View All HTTP trafic

http

View all flash video stuff

http.request.uri contains "flv" or http.request.uri contains "swf" or http.content_type contains "flash" or http.content_type contains "video"

Show non-google cache-control

http.cache_control != "private, x-gzip-ok="""
or
(((((http.cache_control != "private, x-gzip-ok=""") && !(http.cache_control == "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private")) && !(http.cache_control == "max-age=0, no-store")) && !(http.cache_control == "private")) && !(http.cache_control == "no-cache")) && !(http.cache_control == "no-transform")

Show only certain responses

#404: page not found
http.response.code == 404
 
#200: OK
http.response.code == 200

Show only certain HTTP methods

http.request.method == "POST" || http.request.method == "PUT"

Show only filetypes that begin with "text"

http.content_type[0:4] == "text"

Show only javascript

http.content_type contains "javascript"

Show all http with content-type="image/(gif|jpeg|png|etc)"

http.content_type[0:5] == "image"

Show all http with content-type="image/gif"

http.content_type == "image/gif"

Do not show content http, only headers

http.response !=0 || http.request.method != "TRACE"

Setting HTTP Preferences

Reassemble HTTP headers spanning multiple TCP segments:

When this preference is enabled, then the HTTP dissector will reassemble the HTTP header if it has been transmitted over more than one TCP segment. Although it is unusual for headers span multiple segments, it's not impossible, and this should be checked if you expect to view the contents of the HTTP conversation.

Reassemble HTTP bodies spanning multiple TCP segments:

When this preference is enabled, then the HTTP dissector will reassemble the HTTP body if it has been transmitted over more than one TCP segment. All but the smallest of responses will span multiple segments, so this preference should be checked if you expect to view the contents of the HTTP conversation.See TCP Reassembly for an example on how to use this to extract JPEG images from a capture.

Reassemble chunked transfer-coded bodies:

When this preference is enabled, any chunked transfer-coding response spanning multiple segments will be decoded and the payload (the body of the response) will be added to the protocol tree. This happens automatically for one segment responses.

Uncompress entity bodies:

Enable this preference if gzip or deflate encoded (compressed) HTTP entities should be decoded. This allows the visualisation of the compressed data, and possibly the dissection of it.

Tags

January 23rd, 2007

Comments Welcome

Popular Articles
My Online Tools

Related Articles
Newest Posts
Twitter


  •  t.co/ShKrGdqXuJ 
  • RUN GCC! This is a typical shirt I wear, from the  t.co/46LYbFr4k2  shop. A clerk at the LQ recognized it!  t.co/jjmT0dkCPu 
  • Merlin the Magician  t.co/iMmRbanUi4 
  • ROGUE CODE - Latest novel from @markrussinovich  t.co/apkn0LoPIt 
  • RTFM - surprisingly very helpful and way more comprehensive than it looks! @redteamfieldman #pwnAllTheThings  t.co/xiaJ5g0aC9 
  • Dear Hacker - Letters to the Editor of 2600, from Emmanuel Goldstein  t.co/JCfLab7FAJ 
  • The Mythical Man-Month - Essays on Software Engineering, by Frederick P. Brooks, Jr.  t.co/ilWN5GHElr 
  • "where wizards stay up late" - The Origins of the Internet. Favorite book detailing the birth of the net and IMPs  t.co/gY9VTGJgZz 
  • ZERO DAY - read before Trojan horse  t.co/pPMLGDJv8P 
  • Trojan Horse, a novel!  t.co/Hf8EtYaZVa 
  • The Hacker Playbook - very nice high level overview of attacks  t.co/lHwNVWi61u 
  • Clean Code - A Handbook of Agile Software Craftsmanship  t.co/hnJX0x1qIc 
  • Secrets of the JavaScript Ninja - By my absolute favorite JS hacker John Resig!  t.co/tZ42ljmcCl 
  • Hacking Exposed 7: Network Security Secrets & SolutionsMy all time favorite, basic but thorough and accurate.  t.co/jycW0RDVtZ 

Hacking and Hackers

The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean someone who loves to program, someone who enjoys playful cleverness, or the combination of the two. See my article, On Hacking.
-- Richard M. Stallman






[hide]

It's very simple - you read the protocol and write the code. -Bill Joy

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group. POSIX ® is a registered Trademark of The IEEE.

| Google+ | askapache

Site Map | Contact Webmaster | License and Disclaimer | Terms of Service

↑ TOPMain