• Snort


    Chapter 1


    Snort Overview


    This manual is based on Writing Snort Rules by Martin Roesch and further work from Chris Green cmg@snort.org.It was then maintained by Brian Caswell <bmc@snort.organd now is maintained by the Snort Team. If you have a better way to say something or find that something in the documentation is outdated, drop us a line and we will update it. If you would like to submit patches for this document, you can find the latest version of the documentation in L A TEX format in the most recent source tarball under /doc/snort_manual.tex. Small documentation updates are the easiest way to help out the Snort Project.

    1.1 Getting Started

    • Sniffer mode, 嗅探模式, 将嗅探的数据输出到控制台(屏幕)
    • Packet Logger mode, 日志模式, 将嗅探的数据输出到文件
    • Network Intrusion Detection System (NIDS) mode, 网络入侵检测(NIDS) 模式, 检测和分析网络流量, 最为复杂配置最多

    1.2 Sniffer Mode

    输出 TCP/IP packet headers :

    ./snort -v
    

    这个选项只会输出 IP TCP/UDP/ICMP headers ,

    显示 application data :

    ./snort -vd 
    

    1.3 Packet Logger Mode

    如果想把捕获的数据存入磁盘, 可用这个模式, 例如:

    ./snort -dev -l ./log
    

    使用这个选项时, log 文件夹必须存在, 否则会报错

    指定home network:

    ./snort -dev -l ./log -h 192.168.1.0/24
    

    在高速网络环境下, 可以保存为二进制模式(Binary mode), 这样会将 tcpdump 格式储存为一个二进制文件:

    ./snort -l ./log -b
    

    保存的二进制文件可以用 -r 选项载入查看:

    ./snort -dv -r packet.log
    

    Snort 支持 BPF 过滤规则, 例如想查看 log 中关于的内容 ICMP :

    ./snort -dvr packet.log icmp
    

    For more info on how to use the BPF interface, read the Snort and tcpdump man pages.

    1.4 Network Intrusion Detection System Mode

    启用NIDS模式, 可以简单的用以下命令 :

    ./snort -dev -l ./log -h 192.168.1.0/24 -c snort.conf
    

    snort.conf 是 snort 的配置文件, -c 是启用配置文件, 后面跟的是配置文件存放的路径+文件名. 关于配置文件 snort.conf .

    如果没有声明 ./log, 日志会默认存放在 /var/log/snort

    如果要长期开着IDS模式, -v 和 -e 选项应该去掉, -v 输出到屏幕太慢 可能会丢包, -e 是记录数据链接的headers :

    ./snort -d -h 192.168.1.0/24 -l ./log -c snort.conf
    

    1.4.1 NIDS Mode Output Options

    使用命令行可以快速调试, 比使用配置文件的优先级要高

    输出警报信息到 syslog 可以使用 -s 选项, 默认的警报机制是 LOG AUTHPRIV 和 LOG ALER. 详细的 syslog output configuration 之后会讲.

    例如, 用一下命令行可以记录默认的(ASCII解码)系统并且将警报信息输出到syslog :

    ./snort -c snort.conf -l ./log -h 192.168.1.0/24 -s
    

    另一组命令会记录在 /var/log/snort 默认系统, 并发送警报信息到快速警报文件(fast alert file) :

    ./snort -c snort.conf -A fast -h 192.168.1.0/24
    

    1.4.2 Understanding Standard Alert Output

    Snort生成的警报信息格式一般是这样的:

    [**] [116:56:1] (snort_decoder): T/TCP Detected [**]
    

    第一个数字是 Generator ID (GID), 表示通过Snort什么组件生成的这个警报. GID的清单可以在 Snort 文件目录的 etc/generators 查看.

    第二个数字是 Snort ID (SID), 也可以叫Signature ID. SID 的清单可以在 Snort 文件目 etc/gen-msg.map 查看. Rule-based SID 通过 sid 选项 直接写入规则(rules)文件.

    第三个数字是 revision ID. 这个数字主要用来当签名使, 通过 rev 选项, 每次执行触发规则(rendition of the rule)的时候都会增加.

    1.4.3 High Performance Configuration

    如果你想让 Snort 执行的更快 (比如在1000Mbps的环境下), 你需要用 undified2 logging 和 undified2 log reader , 比如 barnyard2 . 这会允许Snort通过二进制形式记录, 性能比写入数据库快的多.

    如果你想方便复制粘帖用文本文件记录的话, 用 'fast' 输出机制. 这样会通过 tcpdump 格式记录数据包, 产生最少的警报, 例如 :

    ./snort -b -A fast -c snort.conf
    

    1.4.4 Changing Alert Order

    默认的规则适用顺序并不一定满足所有要求. 规则的优先级如下

    Pass rules > Drop rules > Log rules

    有的时候 pass rule 会忽略一些警报, 为了获取更多信息可以通过 --alert-before-pass 选项 将 Alert rules 提前.

    一些可以用来改变顺序的命令行:

    • --alert-before-pass 强制将 alert rules 提前
    • --treat-drop-as-alert 将 drop 和 reject rusles 一起其他相关警报作为 alert 记录.
    • --process-all-events 处理所有事件.

    Pass rules 是特殊情况, 如果遇到 pass rule, 事件也会不遵守 --process-all-events 被终止.



  • 相关阅读:
    实现页面切换(动画效果实现,不用ViewPager)
    “仅仅生一个娃”--设计模式中的单例模式
    ZOJ
    【J2SE高速进阶】——多线程之synchronized
    [LeetCode] Search a 2D Matrix II
    leetCode 58.Length of Last Word (最后单词的长度) 解题思路和方法
    [CentOS]怎样解决gcc版本号冲突?
    从0开始学习 GITHUB 系列之「GITHUB 常见的几种操作」【转】
    从0开始学习 GITHUB 系列之「向GITHUB 提交代码」【转】
    从0开始学习 GITHUB 系列之「GIT 速成」【转】
  • 原文地址:https://www.cnblogs.com/ash975/p/5819482.html
Copyright © 2020-2023  润新知