I know how to do it manually (by looking at the hex dump). How can I obtain the same automatically? Do I have to use the APIs? I have both wireshark and Microsoft network monitor.
相关问题
- Angular RxJS mergeMap types
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- PHP Empty $_POST
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- Is a unicode user agent legal inside an HTTP heade
- git: retry if http request failed
- Flutter - http.get fails on macos build target: Co
- C# HttpClient.SendAsync always returns 404 but URL
- Response body is null, status is 200
- Returning plain text or other arbitary file in ASP
- jquery how to get the status message returned by a
I've found that this way of calling previous dissector in chain somehow interferre with HTTP packet reassembly done for 'chunked' transfer encoding. That is if your response has 'Transfer-Encoding: chunked' header, the original HTTP dissector tries to reassemble the data and if you hook it over with such http_wrapper, then reassembling fails.
For example, this makes http statistics fail too. Statistics/HTTP/Packet Counter would give you, say 6 requests and 4 responses, which is not the case =)
One should better install such kind of 'added value' dissectors with 'register_postdissector' API call or test for reassembling logic carefully.
This can be achieved simply with a Lua dissector that adds an HTTP header field to the packet tree, allowing you to filter for it, as shown in this screenshot:
Copy this Lua script into your plugins directory (e.g.,
${WIRESHARK_HOME}/plugins/1.4.6/http_extra.lua
), and restart Wireshark (if already running).Unfortunately, although you can create custom columns, the data you want in that column is not currently generated by the HTTP protocol decoder. Of course, there may be other tools that I'm not familiar with which can do this today, but as far as Wireshark is concerned you would have to add that functionality.
There are some good resources on creating Wireshark plugins, e.g.:
http://simeonpilgrim.com/blog/2008/04/29/how-to-build-a-wireshark-plug-in/
http://www.wireshark.org/docs/wsdg_html_chunked/ChDissectAdd.html
http://www.codeproject.com/KB/IP/custom_dissector.aspx
And here's a video describing how to add a field that's exposed by a protocol decoder as a custom column:
http://www.youtube.com/watch?v=XpUNXDkfkQg
The thing is, you don't want to re-implement the HTTP protocol decoder.
What I would do is find the source code for the built-in HTTP decoder and look at adding a new field such as
http.header_length
just like the existinghttp.content_length
:I haven't looked at the code, but I would guess that this is a pretty easy thing to add. If you submit a patch to the Wireshark team they will probably also include your new field in the next release.
The Code posted by user568493 didn't work for me at all, So iv'e changed it to a post dissector, and also it was not counting the number of bytes correctly. It was also counting IP and Ethernet bytes.
This is my version, which works on 1.8.2: