分析我的java代码发送的http流量的最佳方法?
我有一些新的(使用 Apache commons http 库)和旧的(严格使用 java 1.4 API)的 java 代码,并且正在尝试使用较新的 apache commons 库重写旧代码。然而,它不起作用,我正在努力找出原因。请求正在发送,但我的新代码在我无权访问的接收服务器上超时。由于旧代码可以工作,所以我一定搞砸了 http 请求。使用某种 HTTP 流量嗅探器来准确检查正在发送的内容将非常有用,这样我就可以看到其中存在哪些差异。
我从网上下载了一些 http 嗅探器(这个 和 那个),但都没有捕获我的java代码发送的任何http数据(但当我随机发送时它们确实有效来自浏览器的请求)。关于如何获取这些数据,有什么想法吗?
I have some java code both new (using Apache commons http libraries) and old (strictly using java 1.4 API) and am trying to rewrite the old code using the newer apache commons libraries. However, it isn't working and I'm struggling to find out why. The requests are being sent, but my newer code times out on the receiving server which I don't have access to. Since the old code works, I must have mucked up the http request. It would be very useful to use some sort of HTTP traffic sniffer to examine exactly what is being sent so I can see what differences there are.
I've downloaded a few http sniffers from the web (this one and that one) but neither capture any of the http data being sent by my java code (but they do work when I send random requests from a browser). Any ideas out there on how I can get my hands on this data?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 wireshark。
它很棒、免费、开源、跨平台,并且可以突出显示不同的网络层,并且它不是从一些看起来像 SEO 垃圾邮件的可疑网站运行。
Snort 是另一个不错的工具,但它更适合入侵检测和自动响应。尽管如此,它还是有一个很棒的嗅探器。
Use wireshark.
It's great, free, open-source, cross-platform, and can highlight different network layers, and it's not running from some dubious website that looks like SEO spam.
Snort is another good one, but it's more geared toward intrusion detection and automated responses to that. Still, it has a great sniffer.
我通常发现数据包嗅探对于 HTTP 故障排除来说级别太低。尝试反向代理;我个人喜欢 Charles,因为它在 Windows、Mac OS X 和 Linux 中的工作方式相同; Fiddler 是 Windows 上流行的工具。
Typically I find that packet sniffing is too low level for troubleshooting HTTP. Try a reverse proxy; personally I like Charles as it works the same in Windows, Mac OS X and Linux; Fiddler is a popular on Windows.
如果你尝试嗅探你的环回(127.0.0.1) - 这有点复杂,你应该为此安装特殊的驱动程序。
我建议您将请求发送到“假”服务器,然后嗅探它。
您可以使用“WireShark”或“burpSuite”进行嗅探(如果您可以配置通过代理服务器的程序)。
GL.
If you try to sniff your loopback(127.0.0.1) - thats bit complicated and you should install special driver for that.
I'd suggest you to send request to "fake" server and than sniff it.
u can sniff with "WireShark" or "burpSuite" (if u can configure ur program that go through proxy server).
gl.
您可以指定 SOCKS 代理。通常Java使用SocksSocketImpl - 即它自动支持SOCKS代理。
任何其他嗅探器也可以
you can specify SOCKS Proxy. normally Java uses SocksSocketImpl - i.e. it supports automatically SOCKS proxies.
Any other sniffer will do as well