AIEngine是下一代交互式/可编程Python/Ruby/Java/Lua和Go网络入侵检测系统引擎,具有学习能力 无需任何人工干预、DNS 域分类、垃圾邮件检测、网络收集器、网络取证等等。
AIEngine 还帮助网络/安全专业人员识别流量并开发 用于在 NIDS、防火墙、流量分类器等上使用它们的签名。
(我们的blackarch直接给他集成好了)
AIEngine的主要功能有:
支持在引擎运行时与用户交互/编程。
支持 PCRE JIT 进行正则表达式匹配。
支持正则表达式图(复杂的检测模式)。
支持六种类型的 NetworkStacks(lan、mobile、lan6、virtual、oflow 和 mobile6)。
用于 IP 搜索的支持集和布隆过滤器。
在 Linux、FreeBSD 和 MacOS 等操作系统上支持 x86_64、ARM 和 MIPS 架构。
支持 HTTP、DNS 和 SSL 域匹配。
支持 HTTP、DNS、SMTP 和 SSL 的禁止域和主机。
未知流量的频率分析和自动正则表达式生成。
Yara 签名的生成。
与数据库(MySQL、Redis、Cassandra、Hadoop 等)轻松集成以进行数据关联。
与其他数据包引擎 (Netfilter) 轻松集成。
支持内存清理缓存,用于刷新存储的内存信息。
支持在网络/应用层检测 DDoS。
支持拒绝 TCP/UDP 连接。
支持实时网络取证。
支持 SSL 上的 JA3 TLS 签名。
支持比特币、CoAP、DHCPv4/DHCPv6、DNS、DTLS、GPRS、GRE、HTTP等协议, ICMPv4/ICMPv6、IMAP、IPv4/v6、Modbus、MPLS、MQTT、Netbios、NTP、OpenFlow、PPPoE、 POP、Quic、RTP、SIP、SMB、SMTP、SSDP、SSH、SSL、TCP、UDP、VLAN、VXLAN;
集成 HTTP Server,用于实时检索和配置系统。
检查 docs 文件夹以获取更多信息
使用人工智能引擎
要使用 AIEngine(reduce version) 只需执行二进制 aiengine 或使用 python/ruby/java/lua 绑定。
aiengine 2.0.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. 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 的局域网。
用于 IPv4 的 StackMobile(移动)网络移动(Gn 接口)。
StackVirtual (virtual) VxLan 和 GRE Transparent 适用于虚拟/云环境的堆栈。
StackOpenFlow (oflow) 用于开放流环境的堆栈。
StackMobileIPv6 (mobile6) 用于 IPv6 的网络移动(Gn 接口)。
将 AIEngine 与其他系统集成/编程
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)
检查目录示例以获得有用的用例,并检查 /docs 以获取文档
编译 AIEngine 二进制文件
你应该已经在你的系统中安装了 pcre-devel、libpcap-devel 和 boost-devel 作为 minimun。
$ git clone https://bitbucket.com/camp0/aiengine $ ./autogen.sh $ ./configure $ make
可选功能
系统根据您的要求提供以下启用/禁用功能。
--enable-tcpqos 启用 TCP QoS Metrics 支持以测量连接的 QoS。
--enable-bloomfilter 为 IP 查找启用布隆过滤器支持。 此选项应具有正确的库。
--enable-reject 为 StackLans 和 StackLanIPv6 对象上的中断建立连接启用 TCP/UDP 拒绝连接支持。
--enable-pythongil 为多线程应用程序启用 Python Gil 支持。
--enable-static-memory 为内存需求低的系统启用静态/固定内存支持(256 字节插槽)。
--enable-code-coverage 启用代码覆盖支持(开发)。
--enable-sanatizer 启用 sanatizer 测试支持(开发)。
--enable-ja3 启用在 JA3 格式上生成 TLS 指纹。
此选项只能在配置脚本的编译时启用/禁用。
编译 AIEngine Python 库
对于编译 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
第二个选项将使用 setup.py 使用标准的 pythonic 方式编译库,这将生成 如果与前一个相比,一个更大的库大小。
$ 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 库包含引擎提供的所有功能。
编译 AIEngine Ruby 库
为了在 Ruby 上编译,需要 swig 和 ruby-devel。
$ git clone https://bitbucket.com/camp0/aiengine $ ./autogen.sh $ ./configure $ cd src $ make ruby $ ruby ruai_tests.rb
ruby 库不提供引擎的所有功能。
编译 AIEngine Java 库
为了在 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 lib 提供了引擎的一些功能,但有一些例外。
编译 AIEngine Lua 库
为了在 Lua swig 上编译,需要 lua-devel 包。
$ git clone https://bitbucket.com/camp0/aiengine $ ./autogen.sh $ ./configure $ cd src $ make lua $ lua luai_tests.lua
lua 库提供了引擎的大部分功能。
编译 AIEngine Go 库
用于在 Go swig 上编译。
$ git clone https://bitbucket.com/camp0/aiengine $ ./autogen.sh $ ./configure $ cd src $ make go $ ./goai_test
由于语言的性质,Go 库有一些功能限制。
拓展
https://aiengine.readthedocs.io/en/latest/aiengine.html
好了今天就到这里,希望今天的内容对你有帮助,再见~