Montimage/mmt-security

GitHub: Montimage/mmt-security

一个基于线性时序逻辑规则引擎的流量安全检测与分析工具。

Stars: 6 | Forks: 1

# MMT-Security 本仓库包含以下文件夹: - `src`:mmt-security 的 C 代码 - `rules`:一组官方 XML 规则。使用 `make deb` 时,这些规则的编码版本(*.so)将与 mmt-sec 一起分发。所有规则(官方和用于测试的)都存储在 `rules/properties_all` 中 - `check`:用于验证 mmt-security 的示例 pcap 文件和预期结果 - `doc`:[文档](doc/) - `test`:多样化的测试代码 本仓库包含 mmt-security 工具集: - `compile_rule`:将 .xml 规则编码为共享库(.so 文件) - `rule_info`:获取一个或多个已编码规则的信息 - `mmt_sec_standalone`:使用 mmt-security 分析实时流量或 pcap 文件 - `mmt_sec_server`:分析通过互联网或 Unix 套接字从 mmt-probe 发送的元数据(调用 `messages`) # 构建 ## 先决条件 请确保您的机器具备以下条件: - *libxml2-dev, libpcap-dev, libconfuse-dev*:`sudo apt-get install libxml2-dev libpcap-dev libconfuse-dev` - 可选:*hiredis* ``` git clone https://github.com/redis/hiredis.git cd hiredis make sudo make install ldconfig ``` - [`mmt-dpi`](//github.com/montimage/mmt-dpi) - mmt-security 源代码 ``` git clone https://github.com/Montimage/mmt-security.git ``` ## 清理 ``` cd mmt-security ``` - 执行 `make clean` 清理 mmt-security 的编译对象 - 执行 `make clean-all` 清理 mmt-security 和 mmt-sdk 生成的所有编译对象。因此,当 mmt-sdk 更新后,请执行此操作。 ## 编译 - 在本地目录编译 MMT-Security:`make` - 编译 `rules` 文件夹中存在的示例规则:`make sample_rules` - 启用部分模块:`make [MODULE_NAME=1]+`。目前 `MODULE_NAME` 可以是以下之一: - `REDIS`:此模块允许输出到 Redis。因此必须安装 `hiredis` 库。 - `UPDATE_RULES`:此模块允许在运行时添加或移除规则。默认启用。若要禁用(例如不需要此功能):`MODULE_NAME=0` - 编译 mmt-security 以生成 .deb 文件以便重新分发其二进制文件:`make deb` 您将得到一个 .deb 文件,例如 `mmt-security_1.0.1_8d5d7ea_Linux_x86_64.deb`,其中包含 mmt-security 在全新机器上运行所需的一切。 要在新的基于 Debian 的机器上安装此 deb 文件,请使用:`sudo dpkg -i file_name.deb` - 在当前机器上安装 mmt-security:`make install` - 调试 MMT-Security:`make DEBUG=1` - 如果希望使用 Valgrind DRD 或 Helgrind 检查 MMT-Security,应执行 `make DEBUG=1 VALGRIND=1`。选项 `VALGRIND=1` 会添加一些指令,以允许 Valgrind 绕过通常会导致误报的原子操作。 ## 安装目录 默认情况下,MMT-Security 将被安装到 `/opt/mmt/security`。 我们可以通过在执行 `make` 和 `make install` 时为 `INSTALL_DIR` 参数指定新的目录名称来更改该目录。例如: ``` make INSTALL_DIR=/home/tata/security make install INSTALL_DIR=/home/tata/security ``` # 执行 MMT-Security 二进制文件可以通过编译源代码或安装其分发文件(*.deb)获得。 ## compile_rule 此应用程序解析 .xml 文件中的规则,然后编译为插件 .so 文件。 ``` #to generate .so file ./compile_rule rules/40.TCP_SYN_scan.so rules/40.TCP_SYN_scan.xml #to generate code c (for debug) ./compile_rule rules/40.TCP_SYN_scan.c rules/40.TCP_SYN_scan.xml -c ``` 要编译 `rules` 文件夹中的所有规则,请使用以下命令: ``` make sample_rules ``` ## rule_info 此应用程序打印已编码在二进制文件(.so)中的规则信息。 ``` #print information of all available plugins ./rule_info #print information of rules encoded in `rules/40.TCP_SYN_scan.so` ./rule_info rules/40.TCP_SYN_scan.so ``` ## mmt_sec_standalone 此应用程序可以分析 - 要么通过监控网卡实时流量, - 要么分析保存在 pcap 文件中的流量。判断结果将打印到当前屏幕。 ``` ./mmt_sec_standalone [] Option: -t : Gives the trace file to analyse. -i : Gives the interface name for live traffic analysis. -c : Gives the range of logical cores to run on, e.g., "1,3-8,16" -x : Gives the range of rules id to be excluded, e.g., "99,107-1010". -m : Attributes special rules to special threads using format (lcore:range) e.g., "(1:1-8,10-13)(2:50)(4:1007-1010)". -f : Output results to file, e.g., "/home/tata/:5" => output to folder /home/tata and each file contains reports during 5 seconds -r : Output results to redis, e.g., "localhost:6379" -g : Ignore the rest of a flow when an alert was detetected on the flow. -v : Verbose. -l : Prints the available rules then exit. -h : Prints this help. #online analysis on eth0 ./mmt_sec_standalone -i eth0 #to see all parameters, run ./mmt_sec_standalone -h #verify a pcap file ./mmt_sec_standalone -t check/pcap/16.two_successive_SYN.pcap ``` ## mmt_sec_server 此应用程序通过互联网或 Unix 套接字接收来自 mmt-probe 的元数据(调用 `messages`),然后对其进行分析。 ``` ./mmt_sec_server -h MMT-Security version 1.1.2 (14bade8 - Apr 24 2017 18:00:35) ./mmt_sec_server [
标签:AD攻击面, Clean Code, Debian打包, pcap解析, Redis集成, XML规则, 云计算, 元数据分析, 共享库, 协议分析, 协议异常, 安全工具集, 实时检测, 客户端加密, 异常检测, 搜索引擎查询, 权限提升, 流量分析工具, 线性时态逻辑, 网络安全, 网络探针, 网络攻击检测, 自动化侦查, 规则引擎, 规则编译, 运行时更新, 隐私保护