Giter Club home page Giter Club logo

desec_honeypot's Introduction

desec_honeypot

Python 3.5.3

Honeypot para captura de dados de intrusão.

  • Banco de dados sqlite3.
  • Armazenamento de IP, porta, mensagens, data e horário de acesso.
  • Consultas em SQL.
  • Suporte a COUNT (contagem de registros).
  • Bloqueio por IPs de origem através de comandos SQL.
  • Bloqueio de Portas através de comandos SQL.

Argumentos

Modo de usar:

usage: honeypot.py [-h] [-i IPADDR] [-p PORTS [PORTS ...]] [-q QUERY] [-e] [-v]

-h, --help show this help message and exit

-i IPADDR, --ipaddr IPADDR (IP address server)

-p PORTS [PORTS ...], --ports PORTS [PORTS ...] (List of ports to open)

-q QUERY, --query QUERY (SQL query for search in logs)

-e, --examples (Examples of SQL query)

-v, --version (show program's version number and exit)

Estrutura do banco de dados

Nome do banco de dados: logs.db

Nome das tabelas: logs, info, ports

Colunas na tabela logs:

  • log_id (integer) - Log ID
  • ip_orig (string) - Origin IP
  • port_orig (string) - Origin Port
  • ip_dst (string) - Destination IP
  • port_dst (string) - Destination Port
  • created (datetime) - format: %Y-%m-%d %H:%M:%S
  • banned (boolean) - false = 0 | true = 1

Colunas na tabela info:

  • info_id (integer) - Info ID
  • msg (string) - Message from client
  • log_fk (integer) - Logs foreign key

Colunas na tabela ports:

  • port_id (integer) - Port ID
  • port (integer) - Port number
  • blocked (boolean) - false = 0 | true = 1

Mostrar ajuda:

$ python3 honeypot.py -h

Antes de executar o Honeypot verifique o IP da máquina local.

Usando o comando ifconfig no Linux e obtendo o IP da interface de rede (eth0, eth1, enp4s0):

$ sudo ifconfig

Exemplo de execução do Honeypot ouvindo as portas 2222, 3333 e 5555:

$ python3 honeypot.py -i 192.168.1.6 -p 2222 3333 5555

Conectando ao Honeypot com netcat na porta 2222:

$ nc -v 192.168.1.6 2222

Exemplos de comandos SQL através do parâmetro [-q] [--query]

Listando todos os registros da tabela logs:

-q "SELECT * FROM logs;"

Listando todos os registros da tabela ports:

-q "SELECT * FROM ports;"

Listando os cinco últimos registros de um determinado IP ordenado por ordem de criação:

-q "SELECT * FROM logs WHERE ip_orig='192.168.1.132' ORDER BY created DESC LIMIT 5;"

Selecionando IP e porta de destino cujas portas estejam entre 22 e 80:

-q "SELECT ip_orig, port_dst FROM logs WHERE port_orig BETWEEN 2200 AND 2500;"

Selecionando IP e porta de destino que tenham sido registrados entre duas datas específicas:

-q "SELECT ip_orig, port_dst FROM logs WHERE created BETWEEN '2019-10-01 12:00:00' AND '2019-10-05 12:00:00';"

Selecionando IP de origem e mensagens pela ID de um registro:

-q "SELECT ip_orig, msg FROM logs INNER JOIN info WHERE log_id=1 AND log_id=log_fk;"

Bloqueando a conexão a um IP de origem:

-q "UPDATE logs SET banned=1 WHERE ip_orig='192.168.120.132';"

Bloqueando uma porta de destino específica no servidor:

-q "INSERT INTO ports (port, blocked) VALUES (3500, 1);"

Desbloqueando uma porta de destino específica no servidor:

-q "UPDATE ports SET blocked=0 WHERE port=3500;"

Bloqueando uma lista de portas no servidor:

-q "INSERT INTO ports (port, blocked) VALUES (2000, 1), (3000, 1), (4000, 1), (5000, 1);"

Desbloqueando uma lista de portas no servidor:

-q "UPDATE ports SET blocked=0 WHERE port IN (2000, 3000, 4000, 5000);"

Screenshots

Desec Honeypot

Desec Honeypot

Desec Honeypot

desec_honeypot's People

Contributors

brunomcuesta avatar desecsecurity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.