检查简单的linux cli应用程序的网络流量 [英] Inspect network traffic from simple linux cli app

查看:119
本文介绍了检查简单的linux cli应用程序的网络流量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在命令行上运行一个小应用程序,我正在尝试查看它创建的(http)网络流量。

I'm running a small app on the command line, and I'm trying to watch the (http) network traffic it creates.

是否有某种包装程序(如'time'或'watch')可以显示进出应用程序的所有网络流量? (或者至少在文件中复制一份)

Is there some kind of wrapper program (like 'time', or 'watch') which can display all network traffic to and from my app? (Or at least, make a copy of it in a file)

推荐答案

使用 tcpdump 在命令行中或 wireshark 在桌面上。

Use tcpdump in command line or wireshark in desktop.

例如,捕获网络流量。 >
tcpdump -s0 -i any -wfile.pcap port 80

要直接观看它,请删除 - wfile.pcap

For example, to capture web traffic.
tcpdump -s0 -i any -wfile.pcap port 80
To watch it directly remove the -wfile.pcap

读取以前保存的文件

tcpdump -r file.pcap

但是对于网络流量,如果你有兴趣观看http流,我喜欢使用 tcpflow - C端口80

However for web traffic if you are interested of watching the http flow as it comes I like to use tcpflow -C port 80

这篇关于检查简单的linux cli应用程序的网络流量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆