
AIEngine é um NIDS (sistema de detecção de intrusão em rede) de próxima geração, interativo/programável, para Python/Ruby/Java/Lua e Go.
O AIEngine é um mecanismo de sistema de detecção de intrusão em rede de próxima geração, interativo/programável em Python/Ruby/Java/Lua e Go, com capacidades de aprendizado sem qualquer intervenção humana, classificação de domínios DNS, detecção de spam, coletor de rede, perícia forense de rede e muitas outras.
O AIEngine também ajuda profissionais de rede/segurança a identificar tráfego e desenvolver assinaturas para usá-las em NIDS, Firewalls, classificadores de tráfego e assim por diante.
As principais funcionalidades do AIEngine são:
Consulte a pasta docs para mais informações
Para usar o AIEngine(versão reduzida) basta executar o binário aiengine ou usar o binding 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.
O AIEngine suporta seis tipos de stacks 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) Stack para ambientes virtuais/nuvem com VxLan e GRE Transparente.
StackOpenFlow (oflow) Stack para ambientes openflow.
StackMobileIPv6 (mobile6) Rede Móvel (interface Gn) para IPv6.
O AIEngine é também um módulo python/ruby/java/lua que permite ser mais flexível em termos de integração com outros sistemas e funcionalidades. Os principais objetos exportados pelo módulo python são os seguintes.
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
Para uma descrição completa dos métodos das classes em Python
import pyaiengine
help(pyaiengine)
Consulte o diretório examples para obter casos de uso úteis e consulte /docs para documentação
Você deve ter instalado em seu sistema, no mínimo, pcre-devel, libpcap-devel e boost-devel.
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ make
O sistema oferece as seguintes funcionalidades de ativar/desativar, dependendo dos seus requisitos.
Estas opções só podem ser ativadas/desativadas no momento da compilação, no script configure.
Para compilar a biblioteca Python, também são recomendados boost-python3-devel ou boost-python-devel e python-devel.
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 a forma pythonica padrão, por meio do setup.py; isso gerará um tamanho de biblioteca maior em comparação com a anterior.
$ 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
A lib python contém toda a funcionalidade que o mecanismo fornece.
Para compilar em Ruby, são necessários swig e ruby-devel.
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make ruby
$ ruby ruai_tests.rb
A lib ruby não fornece toda a funcionalidade do mecanismo.
Para compilar em Java, é necessário o pacote 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
A lib java fornece parte da funcionalidade do mecanismo, com algumas exceções.
Para compilar em Lua, é necessário o pacote lua-devel.
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make lua
$ lua luai_tests.lua
A lib lua fornece a maioria da funcionalidade do mecanismo.
Para compilar em Go, é necessário swig.
$ git clone https://bitbucket.com/camp0/aiengine
$ ./autogen.sh
$ ./configure
$ cd src
$ make go
$ ./goai_test
A lib Go tem algumas restrições funcionais devido à natureza da linguagem.
Você pode encontrar uma descrição completa de diferentes casos de uso com os NIDS mais comuns em http://aiengine.readthedocs.io/en/latest/aiengine.html#performance-with-other-engines
O AIEngine é desenvolvido com o padrão c++11/14/17 e está sob os termos da GPLv2.
Confira o código-fonte do AIEngine com
$ git clone https://bitbucket.com/camp0/aiengine
Se você estiver interessado em uma funcionalidade específica, em promover o projeto ou apenas precisar de ajuda, é só 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
Se você tiver um caso de uso que não seja coberto pelos exemplos fornecidos, sinta-se à vontade para entrar em contato comigo.
Se você gosta do projeto, pode me comprar cervejas com bitcoin :)
3DG7FhkFUuKq7VhfXdP9QpsUzfWPXu49ng