位置: 编程技术 - 正文
推荐整理分享详解Linux系统中字符串搜索命令ngrep的用法(linux系统的),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:linux 详解,linux 的ll,linux 的ll,linux中!,linux系统的,linux 的ll,linux中!,linux系统的,内容如对您有帮助,希望把文章链接给更多的朋友!
ngrep 是grep的网络版,他力求更多的grep特征,用于搜寻指定的数据包。由于安装ngrep需用到ibpcap库, 所以支持大量的操作系统和网络协议,能识别TCP、UDP和ICMP包。
安装ngrep下载地址复制代码代码如下:git clone ngrep-code进入目录复制代码代码如下:cd ngrep-code./configure --with-pcap-includes=/usr/local/include/pcapmakemake install
选项
-h is help/usage-V is version information-q is be quiet (don't print packet reception hash marks)静默模式,如果没有此开关,未匹配的数据包都以“#”显示-e is show empty packets 显示空数据包-i is ignore case 忽略大小写-v is invert match 反转匹配-R is don't do privilege revocation logic -x is print in alternate hexdump format 以进制格式显示-X is interpret match expression as hexadecimal 以进制格式匹配-w is word-regex (expression must match as a word) 整字匹配-p is don't go into promiscuous mode 不使用混杂模式-l is make stdout line buffered-D is replay pcap_dumps with their recorded time intervals -t is print timestamp every time a packet is matched在每个匹配的包之前显示时间戳-T is print delta timestamp every time a packet is matched显示上一个匹配的数据包之间的时间间隔-M is don't do multi-line match (do single-line match instead)仅进行单行匹配-I is read packet stream from pcap format file pcap_dump 从文件中读取数据进行匹配-O is dump matched packets in pcap format to pcap_dump 将匹配的数据保存到文件-n is look at only num packets 仅捕获指定数目的数据包进行查看-A is dump num packets after a match匹配到数据包后Dump随后的指定数目的数据包-s is set the bpf caplen -S is set the limitlen on matched packets-W is set the dump format (normal, byline, single, none) 设置显示格式byline将解析包中的换行符-c is force the column width to the specified size 强制显示列的宽度-P is set the non-printable display char to what is specified -F is read the bpf filter from the specified file 使用文件中定义的bpf(Berkeley Packet Filter)-N is show sub protocol number 显示由IANA定义的子协议号-d is use specified device (index) instead of the pcap default
应用举例:
捕获所有post请求(加个-W byline 参数后,将解析包中的换行符):
复制代码代码如下:ranger@ranger:~$ sudo ngrep -q -W byline "(POST).*"interface: eth0 (...0/...0)match: (POST).* T ...: -> ...: [A]POST /Hotel/OTA_HotelSearch.asmx?wsdl HTTP/1.1.Content-Type: text/xml; charset=UTF-8.SOAPAction: gzip, deflate.Content-Length: .Accept: */*.Accept-Language: zh-cn.User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0).UA-CPU: x.Accept-Encoding: gzip, deflate.Connection: close.Host: openapi.ctrip.com..<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Body> <Request xmlns=" <requestXML><Request><Header AllianceID="***" SID="***" TimeStamp="" RequestType="OTA_HotelSearch" Signature="BCDFA6DA5BAAEE7"/><HotelRequest> <RequestBody xmlns:ns=" xmlns:xsi=" xmlns:xsd=" <ns:OTA_HotelSearchRQ Version="1.0" PrimaryLangID="zh" xsi:schemaLocation=" OTA_HotelSearchRQ.xsd"
Linux应用帮助你来征服数学学习 本文为这些各种各样的教育软件和应用提供了一个介绍。数学是计算机的核心。如果有人预期一个类如GNU/Linux这样的伟大的操作系统精确而严格,那么
Linux系统怎么调整swap分区大小? 这里介绍Linux系统中调整swap大小的方法。1、使用free命令带上m参数,查看swap文件大小,官方建议在RAM是2到4.5G时,swap是RAM的2倍;如果RAM大于等于4G则swap
Linux中将执行过的命令记录到日志并发送到服务器的方法 工作中,需要把用户执行的每一个命令都记录下来,并发送到日志服务器的需求,为此我做了一个简单的解决方案。这个方案会在每个用户退出登录时
标签: linux系统的
本文链接地址:https://www.jiuchutong.com/biancheng/353427.html 转载请保留说明!友情链接: 武汉网站建设