Wireshark-BPF 필터 규칙

7609 단어
                            ,          ,     filter_app      ,                 ,                ,            。         ,         tcpdump   ,                     。                 ,       tcpdump                       。

              。         (id,      )                。
             ,    type、dir   proto。

1.type
         ,       ,            。    host、net   port     。   ’host foo’, ’net 128.3’, ’port 20’。          ,       host。

2.dir
         ,            ,            。         src, dst, src or dst   src and dst。  ,’src foo’, ’dst net 128.3’, ’src or dst port ftp-data’。          ,       src or dst。  ’null’    (     slip         ),  inbound   outbound             。

3.proto
         ,           。        : ether, fddi, ip, arp, rarp, decnet,lat, sca, moprc, mopdl, tcp   udp。  ,’ether src foo’, ’arp net 128.3’, ’tcp port 21’。          ,            。  ,’src foo’  (ip   arp   rarp)src foo’ , ’netbar’   ’ (ip   arp   rarp) net bar’, ’port 53’  (tcp   udp)port 53’。

               and(&&), or(||)   not(!)        。  ,’host foo and notport ftp and not port ftp-data’。    ,          。  ,’tcp dst port ftp orftp-data or domain’        ’tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain’。

           ,          。

    dst host host1
              IP         host1,     。host1       ,       。                 host1       。

    src host host1
              IP        host1,     。          host1         。

    host host1
              IP             host1,     。                host1       。

      host          ip, arp   rarp       ,  :
    ip host host1
    :
    ether proto \ip and host host1

   host1       IP       ,            。
    ether dst ehost
                     ehost,     。              ehost       。   ehost       ,  eth0 (/etc/ethers   ),      。

    ether src ehost
                     ehost,     。             ehost       。

    ether host ehost
                           ehost,     。                   ehost       。

    gateway host
              host     ,     。    ,              host,   IP          host。  host        ,       /etc/hosts  /etc/ethers  。         :

    ether host ehost and not host host1
           host1   ehost,       ,      。

    dst net net1
              IP           net1,     。net1       (  /etc/networks  ),       。              net1       。

    src net net1
              IP          net1,     。             net1      。

    net net1
              IP               net1,         。                   net1       。

    net net1 mask mask1
           IP            mask1   net1,     。       src   dst   。

    net net1/len
           IP             net1,     ,         len。       src   dst   。

    dst port port1
              ip/tcp   ip/udp,        port1,     。port1      ,    /etc/services        。      ,         。      ,        ,       。  ,dst port 513     tcp/login      udp/who   ,  port domain     tcp/domain   udp/domain    。

    src port port1
                   port1,     。           port1       。

    port port
                       port,     ,                    tcp   udp    ,  :

    tcp src port port1
                 port1   TCP   。           port1      tcp       。

    less length
                    length,     。           length       。    :len <= length.

    greater length
                    length,     。           length       。    :len >= length.

    ip proto protocol
              IP    ,          protocol,     。            protocol   ip    。protocol      ,            :icmp, igrp,udp, nd   tcp。        tcp, udp   icmp        ,        (\) ,  C-shell     \\。

    ether broadcast
                   ,     。           。    ether     。

    ip broadcast
              IP     ,     。    0    1      ,           。

   ether multicast
                     (multicast),         。    ether     。      ’ether[0] & 1 != 0’    。

    ip multicast
              IP       ,         。    ip       。

    ether proto protocol
                      protocol,     。Protocol      ,      ,  ip, arp   rarp。            ,        (\)  。    FDDI(  ,’fddi protocol arp’),       802.2       (LLC)  ,     FDDI      。            ,         FDDI      LLC   ,   LLC       SNAP   。

    decnet src host
           DECNET       host,     ,           ’’10.123’’,    DECNET    。        DECNET   Ultrix      DECNET    。

    decnet dst host
           DECNET        host,     。

    decnet host host
           DECNET            host,     。

        ip, arp, rarp, decnet  ether proto p      ,   p         。
        tcp, udp, icmp  ip proto p      ,   p         。

    expr relop expr
                ,     ,   relop   >, =, <=, =, !=   , expr       ,    (   C     ),          [+, -, *, /, &, |],       ,              。         ,       :

    proto [ expr : size ]
        proto   ether, fddi, ip, arp, rarp, tcp, udp, or icmp   ,              。
        expr           ,             。Size     ,         ;     1, 2, 4,     1   。     len                。

           ;     1, 2, 4,     1   。     len                。
              ,’ether[0] & 1 != 0’            。   ’ip[0] & 0xf != 5’           IP   。    ’ip[6:2] & 0x1fff = 0’             0     。        tcp   udp      。  ,tcp[0]     TCP         ,        IP        。

             :
                 。     (’!’ or ’not’),     (’&&’ or ’and’)    (’||’ or ’or’)。          。               ,         。            and   ,,      ,            。  ,not host vs and ace
   not host vs and host ace      ,     not ( host vs or ace )  。                   ,         ,       。

a

좋은 웹페이지 즐겨찾기