位置: IT常识 - 正文

详解Linux系统中字符串搜索命令ngrep的用法(linux的sh)

编辑:rootadmin
这篇文章主要介绍了Linux系统中字符串搜索命令ngrep的用法,ngrep在grep的基础功能上又有所扩展,需要的朋友可以参考下... 15-12-17

推荐整理分享详解Linux系统中字符串搜索命令ngrep的用法(linux的sh),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:linux那些事儿,简介linux系统中的10个常用命令及功能,简介linux系统中的10个常用命令及功能,简介linux系统中的10个常用命令及功能,linux系统用法,linux 的ll,linux中!,linux中!,内容如对您有帮助,希望把文章链接给更多的朋友!

ngrep 是grep的网络版,他力求更多的grep特征,用于搜寻指定的数据包。由于安装ngrep需用到ibpcap库, 所以支持大量的操作系统和网络协议,能识别TCP、UDP和ICMP包。

安装ngrep下载地址

代码如下:git clone git://git.code.sf.net/p/ngrep/code ngrep-code详解Linux系统中字符串搜索命令ngrep的用法(linux的sh)

进入目录

代码如下: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 以16进制格式显示-X is interpret match expression as hexadecimal 以16进制格式匹配-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 (192.168.122.0/255.255.254.0)match: (POST).*

T 192.168.122.74:46048 -> 140.207.228.58:80 [A]POST /Hotel/OTA_HotelSearch.asmx?wsdl HTTP/1.1.Content-Type: text/xml; charset=UTF-8.SOAPAction: http://ctrip.com/Request.Accept-Encoding: gzip, deflate.Content-Length: 1330.Accept: */*.Accept-Language: zh-cn.User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0).UA-CPU: x86.Accept-Encoding: gzip, deflate.Connection: close.Host: openapi.ctrip.com..<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Request xmlns="http://ctrip.com/"> <requestXML>&lt;Request&gt;&lt;Header AllianceID="***" SID="***" TimeStamp="1393554304685" RequestType="OTA_HotelSearch" Signature="B166CDF5422A6DA5BA81A08036E938E7"/&gt;&lt;HotelRequest&gt; &lt;RequestBody xmlns:ns="http://www.opentravel.org/OTA/2003/05" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;ns:OTA_HotelSearchRQ Version="1.0" PrimaryLangID="zh" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 OTA_HotelSearchRQ.xsd"

本文链接地址:https://www.jiuchutong.com/zhishi/267837.html 转载请保留说明!

上一篇:2021最新win10专业版激活码/序列号/神key 附激活工具+使用教程(2021windows10专业版)

下一篇:联想笔记本E49系列进不了BIOS(联想笔记本e49系列哪款好)

  • 矿产资源补偿费计入管理费用吗
  • 核定征收需要缴税吗
  • 职工教育经费申请事由
  • 合并报表调整分录理解
  • 企业从银行借款归还应付账款
  • 资产负债表中应收账款
  • 开具了红字发票信息表的税额需要转出吗
  • 用友工资系统参数设置
  • 中外合资经营企业的经营期限
  • 对以前年度的收入调整
  • 购买的包装物用什么消毒
  • 银行汇兑计入哪个会计科目?
  • 全年一次性奖金税收优惠政策
  • 企业所得税为什么那么高
  • 土地增值税负数怎么算
  • 劳务费交增值税还要交个税吗
  • 营改增后出售以前年度的固定资产怎么申报?
  • 小微企业企业所得税怎么征收2023
  • 金税盘管理费用怎么结转
  • 安装工程发票怎么开
  • 印花税的计税依据怎么算含税还是不含税
  • 纳税人备案信息包括
  • 关于增值税的问题有哪些
  • 固定资产分期抵扣怎么申报增值税?
  • 公司注销银行账户流程
  • 如何开展分公司
  • 预收购货款的会计分录
  • 鼠标反应迟钝是什么原因
  • 企业对外捐赠设备会计分录
  • Win10家庭版安装教程
  • 法人治理包括哪些方面
  • kali渗透工具安装
  • window10没有激活码
  • 期间费用为什么叫期间费用
  • php数组函数大全
  • 企业预付工程款的会计分录怎么做
  • fg726p.exe
  • element ui el-table
  • 主播录屏软件哪个好
  • java开发和运维
  • springboot aop切面
  • 帝国cms怎么用
  • 购销合同印花税最新政策2023
  • 收到退回的企业所得税分录
  • 收到保险赔款入什么科目
  • 应付账款坏账损失的会计分录
  • 出口免税申报流程视频
  • 以摊余成本计量的债权投资与以公允价值计量且其变动
  • 个体户超额
  • 公司只有收入没有支出违法吗
  • 给员工发工资时要交税吗
  • 风险纳税人去税务局去报税可以吗
  • 转入企业银行存款利息分录
  • 会计科目中其期末余额应列入资产负债表存货项目的有
  • 挂靠人员社保缴费分录如何做?
  • 银行承兑汇票的好处
  • 没有申报未开票收入怎么办
  • 超市库存明细表
  • 应收账款的政策
  • 主板bios无法重置
  • win10怎么设置加快电脑速度
  • mac os10.11
  • 24个方法
  • win10蓝屏故障
  • 蓝屏 win7
  • cocos2dx node
  • glUnmapBuffer
  • jquery移除
  • python图像移动
  • 如何使用nodejs
  • linux终端命令行和输出在一行
  • Python HTTP客户端自定义Cookie实现实例
  • js中日期格式转换
  • nodejs inspect
  • Unity3D游戏开发pdf
  • 工具的图
  • 青海税务app
  • 分国分项抵免法
  • 发票机如何打印文件
  • 税收优惠政策有没有政府补助
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设