zoukankan      html  css  js  c++  java
  • FortiGate抓包 Sniffer

    1.图形界面抓包

      系统管理--网络--数据包捕获

      

      

        

      选择添加好的数据捕获,点击"运行"开关抓包;抓取包后,可以点击"下载"将抓取的数据包保存的本地磁盘,可以用wireshark直接查看。

    2.命令格式:diagnose sniffer packet <interface> <'filter'> <verbose> <count>

      1)interface

      <interface> 指定实际的接口名称,可以是真实的物理接口名称,也可以是VLAN 的逻辑接口名称,当使用"any"关键字时,表示抓全部接口的数据包。 例:#diagnose sniffer packet port1 //表示抓物理接口为port1 的所有数据包

      #diagnose sniffer packet any //表示抓所有接口的所有数据包

      #diagnose sniffer packet port1-v10 //当在物理接口建立一个VLAN 子接口,其逻辑 接口名为port1-v10,此时表示抓port1-v10 接口的所有数据包,此处一定注意一个问题,由于抓包命令中的空格使用来区分参数字段的,

        但是在逻辑接口创建时,接口名称支持空格,考虑到今后抓包分析的方便,建议在创建逻辑接口时不要带有空格。

      2)verbose显示内容

      <verbose> 指控制抓取数据包的内容。常用选项4和6。

      1: print header of packets, //只抓取IP的原地址、源端口、目的地址、目的端口和数据包的Sequence numbers, 为系统缺省设置

      2: print header and data from ip of packets, //抓取包括IP、TCP或UDP及其内容层的payload。

      3: print header and data from ethernet of packets) ,//抓取包括Ether、IP、TCP或UDP及其内容层的payload。 可导出到文本文件使用专用的转换工具,转换为Ethereal支持文件

      4:print header of packets with interface name //与第一项类似,但包括显示收发包的接口信息

      5: print header and data from ip of packets with interface name  //与第二项类似,但包括显示收发包的接口信息

      6: print header and data from ethernet of packets (if available) with intf name  //与第三项类似,但包括显示收发包的接口信息

      3)count

      <count> 抓取的数据包的数量。

      4)filter  包过滤参数

      过滤器可以用一个表达式来表示,也可以是多个表达式进行组合;

      当表达式为连续字符串,中间没有空格字符时,不需要加单引号或者双引号。

      如diagnose sniffer packet wan1 icmp 1 10

      当过滤器表达式中间存在空格,或者是由多个过滤条表达式组合的时候,则需要将整个表达式放入单引号或者双引号之内。

      如:diagnose sniffer packet any 'host 192.168.1.11'  4  2

      diagnose sniffer packet  wan1 'icmp and host 8.8.8.8' 1 10

      4.1)none

      None或者不写任何参数,则不做任何过滤。

      FGT # diagnose sniffer packet wan1 none 1 3

      interfaces=[wan1]

      filters=[none]

      4.2)Tcp, udp, icmp,arp参数

      FGT # diagnose sniffer packet wan1 tcp 1 3

      interfaces=[wan1]

      filters=[tcp]

      FGT # diagnose sniffer packet wan1 arp 1 3

      interfaces=[wan1]

      filters=[arp]

      0.835697 arp who-has 192.168.118.211 tell 192.168.118.1

      0.955753 arp who-has 192.168.118.64 tell 192.168.118.1

      0.955780 arp who-has 192.168.118.207 tell 192.168.118.1

      4.3)src,dst参数

      指定源IP或者目的IP。

      FGT # diag sniffer pa any 'src 192.168.118.45 and dst 4.2.2.1' 4

      interfaces=[any]

      filters=[src 192.168.118.45 and dst 4.2.2.1]

      3.053283 SE in 192.168.118.45 -> 4.2.2.1: icmp: echo request

      4.055621 SE in 192.168.118.45 -> 4.2.2.1: icmp: echo request

      5.057185 SE in 192.168.118.45 -> 4.2.2.1: icmp: echo request

      6.059751 SE in 192.168.118.45 -> 4.2.2.1: icmp: echo request

      4.4)host参数

      指定主机,抓取包括该host IP地址的数据包,可以是源地址,也可以是目标地址。

      FGT # diagnose sniffer  packet  wan1 'host 8.8.8.8 ' 1 10

      interfaces=[wan1]

      filters=[host 8.8.8.8]

      5.793921 192.168.118.28 -> 8.8.8.8: icmp: echo request//目标地址

      5.833691 8.8.8.8 -> 192.168.118.28: icmp: echo reply//源地址

      4.5)port参数

      根据数据包源端口或者目标端口进行抓包。

      FGT # diagnose sniffer packet wan1 ' port 80 ' 1 3

      interfaces=[wan1]

      filters=[port 80]

      5.391804 192.168.118.28.8977 -> 83.145.92.172.80: syn 3438827760

      5.392339 83.145.92.172.80 -> 192.168.118.28.8977: syn 4238988927 ack 3438827761

      5.392842 192.168.118.28.8977 -> 83.145.92.172.80: ack 4238988928

      4.7)and 和or 参数

      表达式连接符号and 为"与"的关系,or 为"或"的关系。通过这个2参数可以将多个过滤表达式组合成一个更精确的抓包过滤器。

      FGT # diagnose sniffer  packet  wan1 ' host 8.8.8.8 and udp and port 5 3'  1 10

      interfaces=[wan1]

      filters=[host 8.8.8.8 and udp and port 53]

     

      FGT # diagnose sniffer packet wan1 ' host 8.8.8.8 or udp ' 1 6

      interfaces=[wan1]

      filters=[host 8.8.8.8 or udp] 

  • 相关阅读:
    ✨Synchronized底层实现---偏向锁
    🌞LCP 13. 寻宝
    ✨Synchronized底层实现---概述
    ⛅104. 二叉树的最大深度
    c++多线程之顺序调用类成员函数
    C++ STL实现总结
    C#小知识
    C#中HashTable和Dictionary的区别
    WPF的静态资源(StaticResource)和动态资源(DynamicResource)
    WPF之再谈MVVM
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/10091202.html
Copyright © 2011-2022 走看看