关闭

Linux系统套接字编程中存在的五个隐患

发表于:2011-6-27 11:00

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:51Testing软件测试网采编

  清单 4.netstat 实用程序的用法模式

View all TCP sockets currently active$ netstat
 --tcpView all UDP sockets$ netstat
 --udpView all TCP sockets in the listening state$ netstat
 --listeningView the multicast group membership information$ netstat
--groupsDisplay the list of masqueraded connections$ netstat
--masqueradeView statistics for each protocol$ netstat
 --statistics

  尽管存在许多其他的实用程序,但 netstat 的功能很全面,它覆盖了 route、ifconfig 和其他标准 GNU/Linux 工具的功能。

  监视流量

  可以使用 GNU/Linux 的几个工具来检查网络上的低层流量。tcpdump 工具是一个比较老的工具,它从网上“嗅探”网络数据包,打印到 stdout 或记录在一个文件中。该功能允许查看应用程序产生的流量和 TCP 生成的低层流控制机制。一个叫做 tcpflow 的新工具与 tcpdump 相辅相成,它提供协议流分析和适当地重构数据流的方法,而不管数据包的顺序或重发。清单 5 显示 tcpdump 的两个用法模式。

  清单 5.tcpdump 工具的用法模式

Display all traffic on the eth0 interface for
the local host$ tcpdump -l -i eth0Show all traffic
on the network coming from or going
to host plato$ tcpdump host platoShow all HTTP traffic
for host camus$ tcpdump host camus and (port http)View
traffic coming from or going
to TCP port 45000 on the local host$ tcpdump tcp port 45000

  tcpdump 和 tcpflow 工具有大量的选项,包括创建复杂过滤表达式的能力。查阅下面的 参考资料 获取更多关于这些工具的信息。

  tcpdump 和 tcpflow 都是基于文本的命令行工具。如果您更喜欢图形用户界面(GUI),有一个开放源码工具 Ethereal 也许适合您的需要。Ethereal 是一个专业的协议分析软件,它可以帮助调试应用层协议。它的插入式架构(plug-in architecture)可以分解协议,比如 HTTP 和您能想到的任何协议(写本文的时候共有 637 个协议)。

44/4<1234
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号