『壹』 linux tcpmp 要捕获完全的一个数据包,不仅仅是包头,包括数据,并且打印出来,参数是怎样的!
增加-s参数制定捕获长度,例如
tcpmp -i eth0 -n -vv -x -e -s 1600
『贰』 tcpmp 某服务器占用哪个端口
Linux作为网络服务器,特别是作为路由器和网关时,数据的采集专和分析是属不可少的。TcpDump是Linux中强大的网络数据采集分析工具之一。
用简单的话来定义tcpmp,就是:mp the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具。
tcpmp参数是用于过滤目的,这是因为网络中流量很大,如果不加分辨将所有的数据包都截留下来,数据量太大,反而不容易发现需要的数据包。使用这些参数定义的过滤规则可以截留特定的数据包,以缩小目标,才能更好的分析网络中存在的问题。tcpmp使用参数指定要监视数据包的类型、地址、端口等,根据具体的网络问题,充分利用这些过滤规则就能达到迅速定位故障的目的。请使用man tcpmp查看这些过滤规则的具体用法。
『叁』 在Linux系统怎么用tcpmp命令
------------------------------------tcpmp--------------------------------
协议报文分析器:
sniffer: 商业工具
tcpmp, wireshark(GUI), tshark(CLI)
tcpmp [options] 过滤条件
获取报文的条件:
ip src host 172.16.100.1
tcp src or dst port 21
udp dst port 53
tcp src or dst port 21 AND src host 172.16.100.1
tcp port 21 AND host 172.16.100.1
tcpmp的语法:
tcpmp [options] [Protocol] [Direction] [Host(s)] [Value] [Logical Operations] [Other expression]
Protocol(协议):
Values(取值): ether, fddi, ip, arp, rarp, decnet, lat, sca, moprc, mopdl, tcp and udp.
If no protocol is specified, all the protocols are used.
Direction(流向):
Values(取值): src, dst, src and dst, src or dst
If no source or destination is specified, the "src or dst" keywords are applied. (默认是src or dst)
For example, "host 10.2.2.2" is equivalent to "src or dst host 10.2.2.2".
Host(s)(主机):
Values(替代关键字): net, port, host, portrange.
If no host(s) is specified, the "host" keyword is used. 默认如果此段没有指定关键字,默认即host。
For example, "src 10.1.1.1" is equivalent to "src host 10.1.1.1".
Logical Operations:
(1) and
and or &&
(2) or
or or ||
(3) except
not or !
常用选项:
-i any : 指定在哪个网卡进行抓包
-n : 不反解主机名
-nn : 不反解主机名与端口号
-X : 以16进制格式与ASCII格式显示报文
-XX : 除了显示X的内容还显示以太网首部
-v, -vv, -vvv : 显示更详细的信息
-c # : Only get x number of packets and then stop.
-s : Define the snaplength (size) of the capture in bytes. Use -s0 to get everything, unless you are intentionally capturing less.
-S : Print absolute sequence numbers.
-e : Get the ethernet header as well.
-q : Show less protocol information.
-E : Decrypt IPSEC traffic by providing an encryption key.
-A :Display Captured Packets in ASCII
-w /path/to/some_file : Capture the packets and write into a file
-r /path/from/some_file : Reading the packets from a saved file
-tttt : Capture packets with proper readable timestamp
eg:
tcpmp -i eth0 -X -nn -vv tcp port 100
可以在报文上面看一下有无user与pass的信息.
tcpmp -i eth0 -X -nn -vv tcp port 110 and ip src 192.168.10.1
ip host 172.16.100.1
ip src host 172.16.100.1
ip dst host 172.16.100.1
ip src and dst host 172.16.100.1
『肆』 Linux下如何抓指定IP的包
用tcpm命令可以抓指定IP的包,具体命令为:
tcpmp tcp -i eth1 -t -s 0 -c 100 and dst port 22 and src net 192.168.1.1 -w ./target.cap
参数解析:
tcp: ip icmp arp rarp 和 tcp、udp、icmp这些选项等都要放到第一个参数的位置,用来过滤数据报的类型。
-i eth1 : 只抓经过接口eth1的包
-t : 不显示时间戳
-s 0 : 抓取数据包时默认抓取长度为68字节。加上-S 0 后可以抓到完整的数据包
-c 100 : 只抓取100个数据包
dst port 22 : 抓取目标端口是22的数据包
src net 192.168.1.0/24 : 数据包的源网络地址为192.168.1.1
-w ./target.cap : 保存成cap文件,方便用ethereal(即wireshark)分析
(4)linuxtcpmp过滤端口号扩展阅读
tcpmp语法格式:
tcpmp [-adeflnNOpqStvx][-c<数据包数目>][-dd][-ddd][-F<表达文件>][-i<网络界面>][-r<数据包文件>][-s<数据包大小>][-tt][-T<数据包类型>][-vv][-w<数据包文件>][输出数据栏位]
tcpmp主要参数说明:
1、-a 尝试将网络和广播地址转换成名称。
2、-c<数据包数目> 收到指定的数据包数目后,就停止进行倾倒操作。
3、-d 把编译过的数据包编码转换成可阅读的格式,并倾倒到标准输出。
4、-dd 把编译过的数据包编码转换成C语言的格式,并倾倒到标准输出。
5、-ddd 把编译过的数据包编码转换成十进制数字的格式,并倾倒到标准输出。
6、-e 在每列倾倒资料上显示连接层级的文件头。
7、-f 用数字显示网际网络地址。
8、-F<表达文件> 指定内含表达方式的文件。
9、-i<网络界面> 使用指定的网络截面送出数据包。
10、-l 使用标准输出列的缓冲区。
11、-n 不把主机的网络地址转换成名字。
12、-N 不列出域名。
『伍』 关于linux tcpmp命令
用简单的话来定义tcpmp,就是:mp the traffic on a network,根据使用者的定义对网络上的数据包进行截获的包分析工具。 tcpmp可以将网络中传送的数据包的“头”完全截获下来提供分析。它支持针对网络层、协议、主机、网络或端口的过滤,并提供and、or、not等逻辑语句来帮助你去掉无用的信息。
实用命令实例
默认启动
tcpmp
普通情况下,直接启动tcpmp将监视第一个网络接口上所有流过的数据包。
监视指定网络接口的数据包
tcpmp -i eth1
如果不指定网卡,默认tcpmp只会监视第一个网络接口,一般是eth0,下面的例子都没有指定网络接口。
监视指定主机的数据包
打印所有进入或离开sundown的数据包.
tcpmp host sundown
也可以指定ip,例如截获所有210.27.48.1 的主机收到的和发出的所有的数据包
tcpmp host 210.27.48.1
打印helios 与 hot 或者与 ace 之间通信的数据包
tcpmp host helios and \( hot or ace \)
截获主机210.27.48.1 和主机210.27.48.2 或210.27.48.3的通信
tcpmp host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \)
打印ace与任何其他主机之间通信的IP 数据包, 但不包括与helios之间的数据包.
tcpmp ip host ace and not helios
如果想要获取主机210.27.48.1除了和主机210.27.48.2之外所有主机通信的ip包,使用命令:
tcpmp ip host 210.27.48.1 and ! 210.27.48.2
截获主机hostname发送的所有数据
tcpmp -i eth0 src host hostname
监视所有送到主机hostname的数据包
tcpmp -i eth0 dst host hostname
监视指定主机和端口的数据包
如果想要获取主机210.27.48.1接收或发出的telnet包,使用如下命令
tcpmp tcp port 23 and host 210.27.48.1
对本机的udp 123 端口进行监视 123 为ntp的服务端口
tcpmp udp port 123
监视指定网络的数据包
打印本地主机与Berkeley网络上的主机之间的所有通信数据包(nt: ucb-ether, 此处可理解为'Berkeley网络'的网络地址,此表达式最原始的含义可表达为: 打印网络地址为ucb-ether的所有数据包)
tcpmp net ucb-ether
打印所有通过网关snup的ftp数据包(注意, 表达式被单引号括起来了, 这可以防止shell对其中的括号进行错误解析)
tcpmp 'gateway snup and (port ftp or ftp-data)'
打印所有源地址或目标地址是本地主机的IP数据包
(如果本地网络通过网关连到了另一网络, 则另一网络并不能算作本地网络.(nt: 此句翻译曲折,需补充).localnet 实际使用时要真正替换成本地网络的名字)
tcpmp ip and not net localnet
『陆』 请问tcpmp命令如何获取url呢
Ref 1:
http://n3t.awardspace.us/content/tcpmp-url-extraction
Ref 2:
http://www.linuxquestions.org/questions/linux-networking-3/how-to-use-tcpmp-to-be-able-to-see-http-requests-sent-to-the-server-696065/
Ref 3:
http://stackoverflow.com/questions/4777042/can-i-use-tcpmp-to-get-http-requests-response-header-and-response-body
『柒』 如何监听某个端口命令 linux
使用tcpmp命令来抓取监听端口数据:
tcpmp tcp port 5555 host 210.27.48.1
该命令作用为监听主机210.27.48.1端口5555上的通讯包。
『捌』 linux的tcpmp如何查看80端口发出去的url网址是什么
用wireshark抓取,或者tcpmp抓取保存文件,再用wireshark来分析。
『玖』 suse linux下用tcpmp抓包,信息量比较大的时候,设置过滤条件抓不到包,为什么
tcpmp -s 0 -i eth1 host 192.168.1.100 >> ~/e.log | tail -f ~/e.log | grep XXX --color
没有试过,简单的写个类似专楼上的思属路。
『拾』 linux上用tcpmp抓包的问题
(管理员,给人家解释一下嘛,何必呢。)。。。你确定满意答案了,搞的版我只能这样回权答你了,具体可以看看man tcpmp 这里-nn 是不把地址转换为域名,不把端口转换为端口名,你不加.tcpmp在抓第一个包的时候就要把地址转换成域名,端口转换成端口名,如果你的DNS没有配置好,就会延时,等待解析,,直到最后超时,才会显示出来抓到的包,而这段时间还没完,你可能已经CTRL+C中止了,所以抓不到,你多等会儿可能就出来了(这段时间可能很长的)。加了-nn,就不解析了,(就不存在DNS没配置好,等待解析直到超时了)。直接以IP地址,端口号的形式显示出来了。