
AIEngine is a next generation interactive/programmable Python/Ruby/Java/Lua and Go NIDS (Network intrusion detection system).
AIEngine 是一种下一代交互式/可编程的 Python/Ruby/Java/Lua 和 Go 网络入侵检测系统引擎,具备无需人工干预的学习能力、DNS 域名分类、垃圾邮件检测、网络数据采集、网络取证等功能。
AIEngine 还能帮助网络/安全专业人员识别流量并为 NIDS、防火墙、流量分类器等设备开发签名。
AIEngine 的主要功能包括:
更多信息请查看 docs 文件夹
要使用 AIEngine(简化版本),只需执行 aiengine 二进制文件或使用 Python/Ruby/Java/Lua 绑定。
luis@luis-xps:~/c++/aiengine/src$ ./aiengine -h
aiengine 2.1.0
Mandatory arguments:
-I [ --input ] arg Sets the network interface ,pcap file or
directory with pcap files.
Link Layer optional arguments:
-q [ --tag ] arg Selects the tag type of the ethernet layer (vlan,mpls).
TCP optional arguments:
-t [ --tcp-flows ] arg (=32768) Sets the number of TCP flows on the pool.
UDP optional arguments:
-u [ --udp-flows ] arg (=16384) Sets the number of UDP flows on the pool.
Domain optional arguments:
-D [ --domain-file ] arg Reads domain names from file.
-B [ --domain-protocol ] arg (=dns) Protocol to plug the domain-file (dns,
ssl, http).
-S [ --matched-domain ] Shows only the domains that matches.
Regex optional arguments:
-R [ --enable-signatures ] Enables the Signature engine.
-r [ --regex ] arg (=.*) Sets the regex for evaluate agains the flows.
-c [ --flow-class ] arg (=all) Uses tcp, udp or all for matches the signature
on the flows.
-m [ --matched-flows ] Shows the flows that matchs with the regex.
-M [ --matched-packet ] Shows the packet payload that matchs with
the regex.
-C [ --continue ] Continue evaluating the regex with the
next packets of the Flow.
-j [ --reject-flows ] Rejects the flows that matchs with the
regex.
-w [ --evidence ] Generates a pcap file with the matching
regex for forensic analysis.
Frequencies optional arguments:
-F [ --enable-frequencies ] Enables the Frequency engine.
-g [ --group-by ] arg (=dst-port) Groups frequencies by src-ip,dst-ip,src-por
t and dst-port.
-f [ --flow-type ] arg (=tcp) Uses tcp or udp flows.
-L [ --enable-learner ] Enables the Learner engine.
-k [ --key-learner ] arg (=80) Sets the key for the Learner engine.
-b [ --buffer-size ] arg (=64) Sets the size of the internal buffer for
generate the regex.
-Q [ --byte-quality ] arg (=80) Sets the minimum quality for the bytes of
the generated regex.
-y [ --enable-yara ] Generates a yara signature.
Optional arguments:
-n [ --stack ] arg (=lan) Sets the network stack (lan,mobile,lan6,virtual,
oflow).
-d [ --dumpflows ] Dump the flows to stdout.
-s [ --statistics ] arg (=0) Show statistics of the network stack (5 levels).
-T [ --timeout ] arg (=180) Sets the flows timeout.
-P [ --protocol ] arg Show statistics of a specific protocol of the
network stack.
-a [ --port ] arg (=0) Sets the HTTP listenting port.
-e [ --release ] Release the caches.
-l [ --release-cache ] arg Release a specific cache.
-p [ --pstatistics ] Show statistics of the process.
-o [ --summary ] Show protocol summmary statistics
(bytes,packets,% bytes,cache miss,memory).
-h [ --help ] Show help.
-v [ --version ] Show version string.
AIEngine 支持六种网络栈,具体取决于网络拓扑。
StackLan (lan) 基于 IPv4 的局域网。
StackLanIPv6 (lan6) 支持 IPv6 的局域网。
StackMobile (mobile) 用于 IPv4 的移动网络(Gn 接口)。
StackVirtual (virtual) 用于虚拟/云环境的栈,支持 VxLan 和 GRE 透明传输。
StackOpenFlow (oflow) 用于 OpenFlow 环境的栈。
StackMobileIPv6 (mobile6) 用于 IPv6 的移动网络(Gn 接口)。
AIEngine 也是一个 Python/Ruby/Java/Lua 模块,允许更灵活地集成到其他系统和功能中。Python 模块提供的主要导出对象如下:
BitcoinInfo
Cache
CoAPInfo
DCERCPInfo
DHCPInfo
DHCPv6Info
DNSInfo
DTLSInfo
DatabaseAdaptor
DomainName
DomainNameManager
Flow
FlowManager
Frequencies
FrequencyGroup
HTTPInfo
HTTPUriSet
IMAPInfo
IPAbstractSet
IPRadixTree
IPSet
IPSetManager
LearnerEngine
MQTTInfo
NetbiosInfo
NetworkStack
StackLan
StackLanIPv6
StackMobile
StackMobileIPv6
StackOpenFlow
StackVirtual
POPInfo
PacketDispatcher
PacketFrequencies
QuicInfo
Regex
RegexManager
SIPInfo
SMBInfo
SMTPInfo
SSDPInfo
SSHInfo
SSLInfo
TCPInfo
关于 Python 中类方法的完整描述
import pyaiengine
help(pyaiengine)
请查看 examples 目录以获取有用的用例,并查看 /docs 目录获取文档
您的系统至少需要安装 pcre-devel、libpcap-devel 和 boost-devel。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ make
系统根据您的需求提供以下启用/禁用功能。
这些选项只能在编译时通过 configure 脚本启用/禁用。
编译 Python 库还建议安装 boost-python3-devel 或 boost-python-devel 以及 python-devel。
编译库的第一种方式是使用 O3 编译优化,这将生成一个小型库。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make python
$ python pyai_test.py
第二种方式是通过标准的 Python 方式使用 setup.py 编译,这将生成一个比前一种更大的库。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ python setup.py build_ext -i
$ python pyai_test.py
$ python3.6 setup.py build_ext -i
$ python3.6 pyai_test.py
Python 库包含引擎提供的所有功能。
在 Ruby 上编译需要 swig 和 ruby-devel。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make ruby
$ ruby ruai_tests.rb
Ruby 库不提供引擎的所有功能。
在 Java 上编译需要 java devel 包。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make java
$ java -cp ".:/usr/share/java/junit.jar:/usr/share/java/hamcrest/core.jar:./buildjava" org.junit.runner.JUnitCore JunitTestSuite
Java 库提供引擎的部分功能,但有一些例外。
在 Lua 上编译需要 lua-devel 包。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make lua
$ lua luai_tests.lua
Lua 库提供引擎的大部分功能。
在 Go 上编译需要 swig。
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make go
$ ./goai_test
Go 库由于语言特性有一些功能限制。
您可以在 http://aiengine.readthedocs.io/en/latest/aiengine.html#performance-with-other-engines 找到不同用例与最常见 NIDS 的完整描述。
AIEngine 使用 C++11/14/17 标准开发,遵循 GPLv2 许可。
使用以下命令检出 AIEngine 源码:
$ git clone https://bitbucket.com/camp0/aiengine
如果您对特定功能感兴趣、希望推广该项目或只需帮助,请给我发邮件。贡献总是受欢迎的。
AIEngine 一直采用测试驱动开发。因此为保持同样的生命周期,新功能应在创建的新功能目录中编写单元测试,并与整个系统集成,然后集成到 /src 目录下的 main tests.cc 文件中。
如果您有一个未涵盖的用例,请随时联系我。
如果您喜欢这个项目,可以请我喝啤酒,支持比特币 :)
3DG7FhkFUuKq7VhfXdP9QpsUzfWPXu49ng