1、mergecap命令是做什么的?

merge-cap从这个命令的名称可以看出来,是用来合并pcap文件的,也就是把多个文件合并成一个pcap。
我们执行一下mergecap -h 看一下这个命令怎么用:
[root@localhost exception_pcap]# mergecap -h
Mergecap 1.10.14 (Git Rev Unknown from unknown)
Merge two or more capture files into one.(//合并两个或者多个捕获文件到一个文件)
See http://www.wireshark.org for more information.Usage: mergecap [options] -w <outfile>|- <infile> [<infile> ...]Output:-a                concatenate rather than merge files.                      //连接(文件)而不是合并文件default is to merge based on frame timestamps.            //默认是基于帧时间戳的合并-s <snaplen>      truncate packets to <snaplen> bytes of data.              //将数据包截断为<snaplen>字节的数据,-s后面必须跟一个十进制数字(默认是186字节)-w <outfile>|-    set the output filename to <outfile> or '-' for stdout.   //设置(指定)输出文件名 -F <capture type> set the output file type; default is pcapng.              //设置输出文件类型;默认为pcapngan empty "-F" option will list the file types.            //-T <encap type>   set the output file encapsulation type;                   //设置输出文件封装类型default is the same as the first input file.              //默认值与第一个输入文件相同。an empty "-T" option will list the encapsulation types.   //Miscellaneous:-h                display this help and exit.                               //显示帮助及退出-v                verbose output.                                           //输出参数

2、下面我们来使用一下这些参数:

(1)基本参数使用
[root@localhost mergecap]# ls
userip-1.pcap  userip-2.pcap  userip-3.pcap  userip-4.pcap  userip-5.pcap  userip-6.pcap  userip-8.pcap  userip-9.pcap
[root@localhost mergecap]# mergecap -a userip-1.pcap userip-2.pcap -w merge_out.pcap
[root@localhost mergecap]# ls
merge_out.pcap  userip-1.pcap  userip-2.pcap  userip-3.pcap  userip-4.pcap  userip-5.pcap  userip-6.pcap  userip-8.pcap  userip-9.pcap
[root@localhost mergecap]#
//备注:mergecap命令的-a参数后面,可以跟多个pcap文件(具体能跟多少个不知道,我最多后面跟了85个pcap文件)

(2)其他参数使用

[root@localhost mergecap]# mergecap -a userip-1.pcap userip-2.pcap -T ppp -s 500 -w merge_out.pcap
//使用-T参数,把输出报文封装成ppp格式的
//使用-s 参数,把输出的每个报文截断成为一定规律长度的报文...,-s参数后面一定要带一个10进制的数字
//-F 参数大家可以自己试用一下

(3)如何把一个目录下面的所有pcap文件合并成一个pcap

//用echo `ls`显示所有文件名
[root@localhost mergecap]# echo `ls`
3.pcap merge_out.pcap one.pcap userip-1.pcap userip-2.pcap userip-3.pcap userip-4.pcap userip-5.pcap userip-6.pcap userip-8.pcap userip-9.pcap//再用mergecap命令对这些文件进行合并
[root@localhost mergecap]# mergecap -a $(echo `ls`) -w one.pcap
[root@localhost mergecap]# ls -lh
总用量 5.2M
-rw-r--r-- 1 root root 2.7M 9月  15 18:53 one.pcap
-rw-r--r-- 1 root root 365K 9月  15 18:36 userip-1.pcap
-rw-r--r-- 1 root root 257K 9月  15 18:36 userip-2.pcap
-rw-r--r-- 1 root root 286K 9月  15 18:36 userip-3.pcap
-rw-r--r-- 1 root root 485K 9月  15 18:36 userip-4.pcap
-rw-r--r-- 1 root root 365K 9月  15 18:36 userip-5.pcap
-rw-r--r-- 1 root root 286K 9月  15 18:36 userip-6.pcap
-rw-r--r-- 1 root root 301K 9月  15 18:36 userip-8.pcap
-rw-r--r-- 1 root root 151K 9月  15 18:36 userip-9.pcap

3、-F和-T 参数扩展

[root@localhost exception_pcap]# mergecap -F
mergecap: option requires an argument -- 'F'
mergecap: The available capture file types for the "-F" flag are:5views - InfoVista 5View capturebtsnoop - Symbian OS btsnoopcommview - TamoSoft CommViewdct2000 - Catapult DCT2000 trace (.out format)erf - Endace ERF captureeyesdn - EyeSDN USB S0/E1 ISDN trace formatk12text - K12 text filelanalyzer - Novell LANalyzermodlibpcap - Modified tcpdump - libpcapnetmon1 - Microsoft NetMon 1.xnetmon2 - Microsoft NetMon 2.xnettl - HP-UX nettl tracengsniffer - NA Sniffer (DOS)ngwsniffer_1_1 - NA Sniffer (Windows) 1.1ngwsniffer_2_0 - NA Sniffer (Windows) 2.00xniobserver - Network Instruments Observernokialibpcap - Nokia tcpdump - libpcapnseclibpcap - Wireshark - nanosecond libpcapnstrace10 - NetScaler Trace (Version 1.0)nstrace20 - NetScaler Trace (Version 2.0)pcap - Wireshark/tcpdump/... - pcappcapng - Wireshark/... - pcapngrf5 - Tektronix K12xx 32-bit .rf5 formatrh6_1libpcap - RedHat 6.1 tcpdump - libpcapsnoop - Sun snoopsuse6_3libpcap - SuSE 6.3 tcpdump - libpcapvisual - Visual Networks traffic capture[root@localhost exception_pcap]# mergecap -T
mergecap: option requires an argument -- 'T'
mergecap: The available encapsulation types for the "-T" flag are:ap1394 - Apple IP-over-IEEE 1394arcnet - ARCNETarcnet_linux - Linux ARCNETascend - Lucent/Ascend access equipmentatm-pdus - ATM PDUsatm-pdus-untruncated - ATM PDUs - untruncatedatm-rfc1483 - RFC 1483 ATMax25 - Amateur Radio AX.25ax25-kiss - AX.25 with KISS headerbacnet-ms-tp - BACnet MS/TPbacnet-ms-tp-with-direction - BACnet MS/TP with Directional Infober - ASN.1 Basic Encoding Rulesbluetooth-h4 - Bluetooth H4bluetooth-h4-linux - Bluetooth H4 with linux headerbluetooth-hci - Bluetooth without transport layercan20b - Controller Area Network 2.0Bchdlc - Cisco HDLCchdlc-with-direction - Cisco HDLC with Directional Infocosine - CoSine L2 debug logdbus - D-Busdct2000 - Catapult DCT2000docsis - Data Over Cable Service Interface Specificationdpnss_link - Digital Private Signalling System No 1 Link Layerdvbci - DVB-CI (Common Interface)enc - OpenBSD enc(4) encapsulating interfaceerf - Extensible Record Formatether - Ethernetether-nettl - Ethernet with nettl headersfc2 - Fibre Channel FC-2fc2sof - Fibre Channel FC-2 With Frame Delimiterfddi - FDDIfddi-nettl - FDDI with nettl headersfddi-swapped - FDDI with bit-swapped MAC addressesflexray - FlexRayfrelay - Frame Relayfrelay-with-direction - Frame Relay with Directional Infogcom-serial - GCOM Serialgcom-tie1 - GCOM TIE1gprs-llc - GPRS LLCgsm_um - GSM Um Interfacehhdlc - HiPath HDLCi2c - I2Cieee-802-11 - IEEE 802.11 Wireless LANieee-802-11-airopeek - IEEE 802.11 plus AiroPeek radio headerieee-802-11-avs - IEEE 802.11 plus AVS radio headerieee-802-11-netmon - IEEE 802.11 plus Network Monitor radio headerieee-802-11-prism - IEEE 802.11 plus Prism II monitor mode radio headerieee-802-11-radio - IEEE 802.11 Wireless LAN with radio informationieee-802-11-radiotap - IEEE 802.11 plus radiotap radio headerieee-802-16-mac-cps - IEEE 802.16 MAC Common Part Sublayerinfiniband - InfiniBandios - Cisco IOS internalip-over-fc - RFC 2625 IP-over-Fibre Channelip-over-ib - IP over Infinibandipfix - IPFIXipmb - Intelligent Platform Management Busipnet - Solaris IPNETirda - IrDAisdn - ISDNixveriwave - IxVeriWave header and stats blockjfif - JPEG/JFIFjuniper-atm1 - Juniper ATM1juniper-atm2 - Juniper ATM2juniper-chdlc - Juniper C-HDLCjuniper-ether - Juniper Ethernetjuniper-frelay - Juniper Frame-Relayjuniper-ggsn - Juniper GGSNjuniper-mlfr - Juniper MLFRjuniper-mlppp - Juniper MLPPPjuniper-ppp - Juniper PPPjuniper-pppoe - Juniper PPPoEjuniper-svcs - Juniper Servicesjuniper-vp - Juniper Voice PICk12 - K12 protocol analyzerlapb - LAPBlapd - LAPDlayer1-event - EyeSDN Layer 1 eventlin - Local Interconnect Networklinux-atm-clip - Linux ATM CLIPlinux-lapd - LAPD with Linux pseudo-headerlinux-sll - Linux cooked-mode captureltalk - Localtalkmime - MIMEmost - Media Oriented Systems Transportmp2ts - ISO/IEC 13818-1 MPEG2-TSmpeg - MPEGmtp2 - SS7 MTP2mtp2-with-phdr - MTP2 with pseudoheadermtp3 - SS7 MTP3mux27010 - MUX27010netanalyzer - netANALYZERnetanalyzer-transparent - netANALYZER-Transparentnfc-llcp - NFC LLCPnflog - NFLOGnstrace10 - NetScaler Encapsulation 1.0 of Ethernetnstrace20 - NetScaler Encapsulation 2.0 of Ethernetnull - NULLpacketlogger - PacketLoggerpflog - OpenBSD PF Firewall logspflog-old - OpenBSD PF Firewall logs, pre-3.4ppi - Per-Packet Information headerppp - PPPppp-with-direction - PPP with Directional Infopppoes - PPP-over-Ethernet sessionraw-icmp-nettl - Raw ICMP with nettl headersraw-icmpv6-nettl - Raw ICMPv6 with nettl headersraw-telnet-nettl - Raw telnet with nettl headersrawip - Raw IPrawip-nettl - Raw IP with nettl headersrawip4 - Raw IPv4rawip6 - Raw IPv6redback - Redback SmartEdgesccp - SS7 SCCPsctp - SCTPsdh - SDHsdlc - SDLCsita-wan - SITA WAN packetsslip - SLIPsocketcan - SocketCANsymantec - Symantec Enterprise Firewalltnef - Transport-Neutral Encapsulation Formattr - Token Ringtr-nettl - Token Ring with nettl headerstzsp - Tazmen sniffer protocolunknown - Unknownunknown-nettl - Unknown link-layer type with nettl headersusb - Raw USB packetsusb-linux - USB packets with Linux headerusb-linux-mmap - USB packets with Linux header and paddingusb-usbpcap - USB packets with USBPcap headeruser0 - USER 0user1 - USER 1user10 - USER 10user11 - USER 11user12 - USER 12user13 - USER 13user14 - USER 14user15 - USER 15user2 - USER 2user3 - USER 3user4 - USER 4user5 - USER 5user6 - USER 6user7 - USER 7user8 - USER 8user9 - USER 9v5-ef - V5 Envelope Functionvsock - Linux vsockwhdlc - Wellfleet HDLCwpan - IEEE 802.15.4 Wireless PANwpan-nofcs - IEEE 802.15.4 Wireless PAN with FCS not presentwpan-nonask-phy - IEEE 802.15.4 Wireless PAN non-ASK PHYx25-nettl - X.25 with nettl headersx2e-serial - X2E serial line capturex2e-xoraya - X2E Xoraya

【Linux命令】mergecap命令的用法相关推荐

  1. php 中find,Linux中find命令的用法汇总

    Linux系统中的 find 命令在查找文件时非常有用而且方便.它可以根据不同的条件来查找文件,例如权限.拥有者.修改日期/时间.文件大小等等.在这篇文章中,我们将学习如何使用 find 命令以及它所 ...

  2. linux下的zz命令,linux中cut命令的用法

    本文主要记录一下Linux中cut命令的用法. 1. cut命令使用说明 Usage: cut OPTION... [FILE]... cut命令用于选出FILE文件中每一行的某些部分,然后打印到标准 ...

  3. linux下find命令用法

    一.Linux中find常见用法示例 ·find    path    -option    [    -print ]    [ -exec    -ok    command ]    {} /; ...

  4. linux useradd(adduser)命令参数及用法详解(linux创建新用户命令)

    linux useradd(adduser)命令参数及用法详解(linux创建新用户命令) useradd可用来建立用户帐号.帐号建好之后,再用passwd设定帐号的密码.而可用userdel删除帐号 ...

  5. Linux下mknod的作用,Linux系统mknod命令用法

    欢迎来到学习啦,本文介绍Linux系统mknod命令用法 ,欢迎您阅读. mknod 用法: 名字 mknod - 建立块专用或字符专用文件 总览 mknod [options] name {bc} ...

  6. Linux中source命令的用法:修改环境变量之后立即生效

    source命令 source命令也称为"点命令",也就是一个点符号(.) source命令通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录 用法:sourc ...

  7. linux的nohup命令的用法。

    linux的nohup命令的用法. 在应用Unix/Linux时,我们一般想让某个程序在后台运行,于是我们将常会用 & 在程序结尾来让程序自动运行.比如我们要运行mysql在后台: /usr/ ...

  8. update-rc.d 更新 Linux 系统启动项 命令 用法详解

    探究 Ubuntu 下的 update-rc.d 命令:http://www.linuxdiyf.com/linux/13362.html Update-rc.d && rc.loca ...

  9. linux关机方法有哪些?有何区别_Linux关机命令大全:Linux各关机命令之间的区别和用法...

    Linux怎么用命令来进行关机/重启呢?Linux是一套免费使用和自由传播的类Unix操作系统,想使用Linux系统的关机命令必须要拿到root权限,下面给大家介绍一些Linux常用的关机命令以及各关 ...

  10. Linux中read命令的用法

    1. 简单读取 read命令接收标准输入(键盘)的输入或其他文件描述符的输入,得到输入后,read命令将数据放入一个标准变量中.下面是 read命令的最简单形式: bixiaopeng@bixiaop ...

最新文章

  1. 号外号外!RancherOS v1.2.0发布啦!
  2. Swift 函数和类
  3. python爬取的信息条数比页面显示多_Python爬取分析北京二手房数据?数据结果真的太吓人了...
  4. WPF入门(六)样式Style
  5. Windows下Maven的安装与配置
  6. Cube Or 北方大学生训练赛
  7. 命令行下(bat)使用 Lhaplus 自动 压缩 解压文件 (含参数设定说明)
  8. mac下nginx搭建
  9. (转)区块链创造了ICO,但是无法守护ICO
  10. 尼克新书《人工智能简史》全新升级 全方位解读AI历史和未来
  11. 深海迷航坐标传送代码_深海迷航全资源坐标一览 美丽水世界坐标位置介绍
  12. 计算机网络教室使用,计算机网络教室使用管理制度
  13. Nik Collection 4
  14. 成分句法分析与依存句法分析
  15. [思考] 闲时随笔一篇
  16. 如何在 Python 中异步操作数据库?aiomysql、asyncpg、aioredis 使用介绍
  17. 企鹅吞狗,狗走狐悲,狼厂危矣
  18. Java 发送QQ邮件
  19. mirosoft Edge出现闪退怎么办
  20. 3.3程序设计框架架构基础相关知识点-技术

热门文章

  1. 公司如何使用开源软件
  2. 【页面置换】页面置换算法的设计
  3. Tomcat 开启远程监控(JMX)
  4. 基于html5的城市公交查询系统,本科毕业论文 城市公交查询系统
  5. 服务器打完补丁无法进入系统,win7系统电脑更新补丁后无法进入系统怎么办
  6. vs2013+qt生成的exe无法找到入口,无法定位程序输入点与动态库*.exe,而不是DLL
  7. java学习篇(一)---从网络下载图片
  8. 把txt 转换成CHM的目录或Index
  9. 数字逻辑实验一 门电路逻辑功能及测试
  10. 【K线绘图】教你用python绘制带有买卖点的股票K线图(附送鳄鱼指标、顾比均线指标、dataframe格式化输出)