zoukankan      html  css  js  c++  java
  • Snort manual 笔记(二)

    1.5 Packet Acquisition

    Snort 2.9 引入 DAQ 代替直接调用 libpcap .

    有两种网卡特性会影响 Snort :

    ”Large Receive Offload” (LRO) and ”Generic Receive Offload” (GRO)

    Snort 建议关闭这两项 ,对于linux系统 执行以下命令行 :

    $ ethtool -K eth1 gro off
    $ ethtool -K eth1 lro off
    

    1.5.1 Configuration

    假设我们没有禁用 static modules 或者改变默认的 DAQ 类型, 我们可以像以前一样使用 interface 运行Snort 中 readback 或者 sniffing. 当然, 也可以通过以下设置选择和配置 DAQ :

    必须通过配置文件或者命令行指定好所需要的参数, 否则 -Q 会强制执行 inline, -r 会强制执行 read-file, mode默认为passive.

    -省略-

    1.5.2 pcap

    pcap 是默认的 DAQ. snort 运行任何 w/o DAQ 命令, 都是通过操作 pcap.以下命令是等价的 :

    ./snort -i <device>
    ./snort -r <file>
    ./snort --daq pcap --daq-mode passive -i <device>
    ./snort --daq pcap --daq-mode read-file -r <file>
    

    可以指定pcap buffer_size :

    ./snort --daq pcap --daq-var buffer_size=<#bytes>
    

    pcap DAQ 不记录过滤的数据包.

    1.5.3 AFPACKET

    afpacket 函数类似与 memory mapped pacp DAQ 但是不需要外部依赖库 :

    ./snort --daq afpacket -i <device>
    [--daq-var buffer_size_mb=<#MB>]
    [--daq-var debug]
    

    如果在 inline mode 中运行 afpacket, 必须设置一个或多个接口对(interface pairs), 格式如下 :

    eth0:eth1
    

    或者:

    eth0:eth1::eth2:eth3
    

    afpacket DAQ 默认分配128MB的包内存(packet memory), 可以通过以下配置修改 :

    --daq-var buffer_size_mb=<#MB>
    

    注意, 总的内存分配量比这个高, 约165.5MB(较128MB)

    1.5.4 NFQ

    NFQ 是新的改良的抓包(iptables packets)方式 :

    关于 iptables
    https://wiki.archlinux.org/index.php/Iptables_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

    1.5.5 IPQ

    IPQ 是旧的抓包(iptables packets)方式. pre-2.9 可以通过以下命令在build时启用 :

    ./configure --enable-inline / -DGIDS
    

    通过一下设置启用 :

    1.5.6 IPFW

    BSD系统可以用IPFW. pre-2.9 可以通过以下命令在build时启用 :

    ./configure --enable-ipfw / -DGIDS -DIPFW
    

    以下这条命令作废 :

    ./snort -J <port#>
    

    改为以下命令 :

    ./snort --daq ipfw [--daq-var port=<port>]
    <port> ::= 1..65535; default is 8000
    

    IPFW 只支持ip4 流量

    1.5.7 Dump

    在 snort 2.9 版本中 dump DAQ 允许尝试多种inline模式特性, 例如 injection 和 normalization.

    ./snort -i <device> --daq dump
    ./snort -r <pcap> --daq dump
    

    默认会生成一个文件名为inline-out.pcap的文件, 包括所有snort捕获和生成的包. 也可以自定义名字 :

    ./snort --daq dump --daq-var file=<name>
    

    因为dump是通过调用pcap daq. 因此也没有计数过滤的包.

    注意 dump DAQ 的inline mode 不是真正的 inline mode.此外, 在其他模式中需要用到 pcap DAQ :

    ./snort -r <pcap> -Q --daq dump --daq-var load-mode=read-file
    ./snort -i <device> -Q --daq dump --daq-var load-mode=passive
    

    1.5.8 Statistics Changes

    The Packet Wire Totals and Action Stats sections of Snort’s output include additional fields:

    Filtered count of packets filtered out and not handed to Snort for analysis.
    Injected packets Snort generated and sent, e.g. TCP resets.
    Allow packets Snort analyzed and did not take action on.
    Block packets Snort did not forward, e.g. due to a block rule.
    Replace packets Snort modified.
    Whitelist packets that caused Snort to allow a flow to pass w/o inspection by any analysis program.
    Blacklist packets that caused Snort to block a flow from passing.
    Ignore packets that caused Snort to allow a flow to pass w/o inspection by this instance of Snort.
    The action stats show ”blocked” packets instead of ”dropped” packets to avoid confusion between dropped packets (those Snort didn’t actually see) and blocked packets (those Snort did not allow to pass).



  • 相关阅读:
    git clone 慢,使用镜像
    Mysql 插入 path 插入不进去值
    os.walk 获取文件夹下所有的文件
    Manjaro安装后你需要这样做(仅有网址)
    Mysql 查询优化
    pandas df.to_csv 可保存为 txt 类型 index 设置索引 header 列名 sep 使用什么进行分隔
    pandas pd.to_markdown() 转换为 Markdown pd.to_latex() 转换为 latex
    pandas 读取txt seq分隔符类型 engine指定引擎 header 不将第一行作为列名
    pandas 读取文件时 header设置列名 index_col 设置索引 usecols 读取哪几列 parse_dates 将哪一列设置为时间类型 nrows 读取数据行数
    numpy cumprod 累乘 cumsum 累加 diff 和前一个元素做差值
  • 原文地址:https://www.cnblogs.com/ash975/p/5788661.html
Copyright © 2011-2022 走看看