您的位置:首页 > 理论基础 > 计算机网络

201512011linux系统日常管理第三部分(使用tshark抓包分析http请求,iptables 针对一个网段)扩展1

2015-12-11 09:04 786 查看
iptables 实现centos内网机器访问外网

默认我们的机器上是没有安装这个工具的。如果你的linux是CentOS那么就使用yum安装

yum install -y wireshark

也可以到官网下载源码 http://www.wireshark.org
具体安装方法,请参考 http://www.qtasp.cn/wiresharkcharpt/buildingwireshark.html
以下,简单介绍这个抓包工具的应用

1. 以下的用法可以显示访问http请求的域名以及uri

tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"

2. 以下可以抓取mysql的查询

tshark -n -i eth1 -R 'mysql.query' -T fields -e "ip.src" -e "mysql.query"

3. 以下可以抓取指定类型的MySQL查询

tshark -n -i eth1 -R 'mysql matches "SELECT|INSERT|DELETE|UPDATE"' -T fields -e "ip.src" -e "mysql.query"

4. 统计http的状态

tshark -n -q -z http,stat, -z http,tree

这个命令,直到你ctrl + c 才会显示出结果

------------------------------------------------------------------------------------------------------

iptables 针对一个网段

iptables -I INPUT -m iprange --src-range 61.4.176.0-61.4.191.255 -j DROP

--------------------------------------------------------------------------------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: