This can be achieved simply with the help of the Lua dissector , which adds an HTTP header field to the package tree, allowing you to filter it, as shown in this screenshot:

Copy this Lua script to your plugins directory (for example, ${WIRESHARK_HOME}/plugins/1.4.6/http_extra.lua ) and restart Wireshark (if it is already running).
do local http_wrapper_proto = Proto("http_extra", "Extra analysis of the HTTP protocol"); http_wrapper_proto.fields.hdr_len = ProtoField.uint32("http.hdr_len", "Header length (bytes)") -- HTTP frames that contain a header usually include the HTTP -- request method or HTTP response code, so declare those here -- so we can check for them later in the dissector. local f_req_meth = Field.new("http.request.method") local f_resp_code = Field.new("http.response.code") local original_http_dissector function http_wrapper_proto.dissector(tvbuffer, pinfo, treeitem) -- We've replaced the original http dissector in the dissector table, -- but we still want the original to run, especially because we need -- to read its data. Let wrap the call in a pcall in order to catch -- any unhandled exceptions. We'll ignore those errors. pcall( function() original_http_dissector:call(tvbuffer, pinfo, treeitem) end ) -- if the request method or response code is present, -- the header must be in this frame if f_req_meth() or f_resp_code() then -- find the position of the header terminator (two new lines), -- which indicates the length of the HTTP header, and then add -- the field to the tree (allowing us to filter for it) local hdr_str = tvbuffer():string() local hdr_len = string.find(hdr_str, "\r\n\r\n") or string.find(hdr_str, "\n\n\n\n") if hdr_len ~= nil then treeitem:add(http_wrapper_proto.fields.hdr_len, hdr_len):set_generated() end end end local tcp_dissector_table = DissectorTable.get("tcp.port") original_http_dissector = tcp_dissector_table:get_dissector(80) -- save the original dissector so we can still get to it tcp_dissector_table:add(80, http_wrapper_proto) -- and take its place in the dissector table end
user568493
source share