Wireshark is an excellent tool, and capture filters can be quite daunting, but they can also be very powerful and useful.
Recently I was helping to troubleshoot some HTTP 503 error codes which were happening on an couple of IIS servers. These systems were handling over a million requests per day between the two systems, and intermittently responding with 503 errors for a small percentage of requests.
It was difficult for us to find any reason for these errors, and unfortunately, IIS does not log 503 errors (as far as we could see) so we could not tell how many were occurring, when they were occurring, or if there were any other associated patterns. We really needed to log the 503 errors, so that we could continue to troubleshoot and perform some configuration optimization.
Just leaving Wireshark running and capturing all requests and responses for 24 hours+ was not a good option, because of the additional load, and data logged. We wanted to come up with a special Wireshark filter, to capture and record only the 503 errors over a longer period of time, so that we could do more analysis and fix the problem.
I remembered a recent course I studied which pointed to some capture filtering that could be done to find HTTP GET requests. More detail here http://wiki.wireshark.org/CaptureFilters
"Capture HTTP GET requests. This looks for the bytes 'G', 'E', 'T', and ' ' (hex values 47, 45, 54, and 20) just after the TCP header. "tcp[12:1] & 0xf0) >> 2" figures out the TCP header length. port 80 and tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420"
This is pretty clever stuff, but I figured I could extend this filter to look for 503 responses.
Capture filters are more difficult than display filters in Wireshark.
- With display filters you can easily just right-click on a relevant node you want to filter on, and "Apply as filter".
- Capture filters are a lot more manual to configure, and they are more time-consuming to tweak and get working correctly.
port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x48545450) and (tcp[((tcp[12:1] & 0xf0) >> 2)+4:4] = 0x2f312e31) and (tcp[((tcp[12:1] & 0xf0) >> 2)+8:4] = 0x20353033)
This filter can easily be adjusted to look for other error codes such as 500, 404 etc, simply by changing the last three hex characters ("353033")
So for example to look for 500 error codes:
port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x48545450) and (tcp[((tcp[12:1] & 0xf0) >> 2)+4:4] = 0x2f312e31) and (tcp[((tcp[12:1] & 0xf0) >> 2)+8:4] = 0x20353030)
This filter was so useful in tracking down our problem, that I thought I would share it with the web.
The lesson to be learned here, is do not fear the apparent complexity of Wireshark capture filters. Take an example, and tweak it until you get the result that you are looking for.
Let me know if you find this useful.
Thanks for the info.
ReplyDeleteWhat was the actual cause to the 503 errors?
The issue was related to throttling of connections on the site.
ReplyDeleteWe increased the number of connections and it fixed the problem, but the only way to confirm that it had been fixed was to use this filter.
can you share how to calculate the last 3 digits for other error code?
ReplyDeleteggoodd
ReplyDeleteVery useful, thanks man! even in 2018 this is hella relevant
ReplyDeleteHey Guys !
ReplyDeleteUSA Fresh & Verified SSN Leads with DL Number AVAILABLE with 99.9% connectivity
All Leads have genuine & valid information
**HEADERS IN LEADS**
First Name | Last Name | SSN | Dob | DL Number | Address | City | State | Zip | Phone Number | Account Number | Bank Name | Employee Details | IP Address
*Price for SSN lead $2
*You can ask for sample before any deal
*If anyone buy in bulk, we can negotiate
*Sampling is just for serious buyers
==>ACTIVE, FRESH CC & CVV FULLZ AVAILABLE<==
->$5 PER EACH
->Hope for the long term deal
->Interested buyers will be welcome
**Contact 24/7**
Whatsapp > +923172721122
Email > leads.sellers1212@gmail.com
Telegram > @leadsupplier
ICQ > 752822040
supreme shirt
ReplyDeletecurry 5
jordan shoes
supreme clothing
kd shoes
lebron shoes
yeezy 350
kobe 9
kobe shoes
yeezy supply
o2y45x8b26 t3j64l4j49 h7u32j4x39 v6l56n3n81 k7e83c6d06 j1d29l3l46
ReplyDeletea bathing ape
ReplyDeletetravis scott jordan
curry shoes
off white
golden goose shoes cheap
off white outlet
off white outlet
supreme shirt
fear of god outlet
golden goose outlet
Hey Everyone!
ReplyDelete************
Linux roots
cPanel scanner
cPanel Bruter
Shell Scanner
SMTP Scanner
SMTP Bruter
Zimbra Scanners
And Many More Spamming Tools Are Available Here.
***********
Hit Me On;
Telegram : @cpanelmaster
I.C.Q : @cpanelmaster
Site : toolz.store