
Mecanismo programável de inspeção de pacotes com NIDS, classificação de DNS, análise de frequência e geração automática de regex. Suporta bindings para Python/Ruby/Java/Lua para integração com bancos de dados e outras ferramentas de segurança.
=========
AIEngine é um motor de inspeção de pacotes interativo/programável de próxima geração, compatível com Python/Ruby/Java/Lua, com capacidades de aprendizado sem qualquer intervenção humana, funcionalidade NIDS (Sistema de Detecção de Intrusão de Rede), classificação de domínios DNS, coletor de rede, perícia forense de rede e muitas outras.
O projeto atual está em https://bitbucket.org/camp0/aiengine
AIEngine também ajuda profissionais de rede/segurança a identificar tráfego e desenvolver assinaturas para uso em NIDS, Firewalls, classificadores de tráfego e assim por diante.
As principais funcionalidades do AIEngine são:
Para usar o AIEngine (versão reduzida), basta executar o binário aiengine ou usar a vinculação python/ruby/java/lua.
luis@luis-xps:~/c++/aiengine/src$ ./aiengine -h
aiengine 1.5
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.
-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.
-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.
-e [ --release ] Release the caches.
-l [ --release-cache ] arg Release a specific cache.
-p [ --pstatistics ] Show statistics of the process.
-h [ --help ] Show help.
-v [ --version ] Show version string.
O AIEngine suporta cinco tipos de pilhas de rede dependendo da topologia de rede.
StackLan (lan) Rede Local baseada em IPv4.
StackLanIPv6 (lan6) Rede Local com suporte a IPv6.
StackMobile (mobile) Rede Móvel (interface Gn) para IPv4.
StackVirtual (virtual) Pilha para ambientes virtuais/nuvem com VxLan e GRE Transparente.
StackOpenFlow (oflow) Pilha para ambientes OpenFlow.
O AIEngine é também um módulo python/ruby/java/lua que permite maior flexibilidade em termos de integração com outros sistemas e funcionalidades. Os principais objetos que o módulo python fornece para exportação são os seguintes.
DNSInfo
BitcoinInfo
DatabaseAdaptor (Abstract class)
DomainName
DomainNameManager
Flow
FlowManager
Frequencies
FrequencyGroup
HTTPInfo
HTTPUriSet
IMAPInfo
IPAbstractSet (Abstract class)
IPSet
IPSetManager
LearnerEngine
NetworkStack (Abstract class)
StackLan
StackLanIPv6
StackMobile
StackOpenFlow
StackVirtual
POPInfo
PacketDispatcher
PacketFrequencies
Regex
RegexManager
SIPInfo
SMTPInfo
SSLInfo
MQTTInfo
CoAPInfo
Para uma descrição completa dos métodos das classes
import pyaiengine
help(pyaiengine)
Consulte as páginas wiki de configuração ou o diretório de exemplos para ver exemplos mais interessantes. [https://bitbucket.org/camp0/aiengine/wiki/Configurations]
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ make
A primeira opção para compilar a biblioteca é usar a otimização de compilação O3, isso gerará uma biblioteca pequena
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make python
$ python pyai_test.py
A segunda opção compilará a biblioteca usando o método padrão pythonico com setup.py, isso gerará um tamanho de biblioteca maior se comparado com o anterior.
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ python setup.py build_ext -i
$ python pyai_test.py
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make ruby
$ ruby ruai_tests.rb
$ 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
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make lua
$ lua luai_tests.lua
O AIEngine é desenvolvido com o padrão C++11/14 e está sob os termos da GPLv2.
Confira o código-fonte do AIEngine com
$ git clone https://bitbucket.com/camp0/aiengine
Se você está interessado em alguma funcionalidade ou precisa de ajuda, basta me enviar um e-mail. Contribuições são sempre bem-vindas.
O AIEngine foi desenvolvido usando desenvolvimento orientado a testes. Portanto, para manter o mesmo ciclo de vida, a nova funcionalidade deve ter testes unitários no diretório criado para a nova funcionalidade e, para integrar com todo o sistema, depois integrar com o arquivo principal tests.cc no diretório /src.