threat-intel
TIP: armazena, busca e expõe IOCs via API REST (stdlib pura).
7 testes · 7 passou · 0 falhou · 0 skip
- test_detect_type0.00s
- test_add_and_lookup0.00s
- test_dedup_updates0.00s
- test_search_filters0.00s
- test_import_bulk0.00s
- test_stats0.00s
- test_rest_api_roundtrip0.52s
Entrypoints (CLI)
tip
Módulos e funções principais
tip/__init__.py
- —
tip/api.py
make_handler()serve()
tip/cli.py
main()
tip/store.py
detect_type()
Estrutura de arquivos
- LICENSE
- README.md
- pyproject.toml
- tests/test_tip.py
- threat_intel.egg-info/PKG-INFO
- threat_intel.egg-info/SOURCES.txt
- threat_intel.egg-info/dependency_links.txt
- threat_intel.egg-info/entry_points.txt
- threat_intel.egg-info/requires.txt
- threat_intel.egg-info/top_level.txt
- tip/__init__.py
- tip/api.py
- tip/cli.py
- tip/store.py
README
# Threat Intelligence Platform (TIP) 🌐
Plataforma para armazenar, consultar e compartilhar **Indicadores de Comprometimento (IOCs)** — IPs, domínios, URLs, hashes (MD5/SHA1/SHA256) e e-mails maliciosos — com **detecção automática de tipo**, busca filtrada, importação em massa e **API REST** (stdlib pura, sem dependências).
> ⚠️ Ferramenta educacional/defensiva para gestão de threat intel.
## Recursos
- **Detecção automática** do tipo de IOC
- Deduplicação inteligente (atualiza `last_seen`/confiança em vez de duplicar)
- Campos: `threat`, `source`, `confidence` (0–100), `tags`, `first_seen`, `last_seen`
- **Busca** por tipo, ameaça e confiança mínima
- **Importação em massa** de arquivos (um IOC por linha, ignora `#` comentários)
- **API REST**: `/health`, `/stats`, `/lookup`, `/search`, `POST /ioc`
- Persistência em **SQLite**
## Instalação
```bash
git clone https://github.com/Diogo-Damasceno/threat-intel.git
cd threat-intel
pip install -e .
```
## Uso (CLI)
```bash
tip add 185.220.101.5 --threat C2 --source honeypot --confidence 90
tip add evil-phish.tk --threat phishing
tip lookup 185.220.101.5
tip search --type ip --min-confidence 80
tip import iocs.txt --threat ransomware --source feed-x
tip stats
```
## API REST
```bash
tip serve --port 8088
```
```bash
# adicionar IOC
curl -X POST http://127.0.0.1:8088/ioc \
-H 'Content-Type: application/json' \
-d '{"value":"9.9.9.9","threat":"C2","confidence":95}'
# consultar
curl 'http://127.0.0.1:8088/lookup?value=9.9.9.9'
curl 'http://127.0.0.1:8088/search?type=ip&min_confidence=80'
curl http://127.0.0.1:8088/stats
```
## Integração com o portfólio
Este TIP é o *hub* central: o **Honeypot** alimenta IOCs, o **Malware Analyzer** exporta hashes/URLs, e o **Phishing Detector** consulta domínios. Juntos formam a base do **SentinelAI**.
## Testes
```bash
pip install -e '.[dev]'
pytest -q
```
## Licença
MIT
Como rodar na prática (entrada → saída):
$ threat-intel add ip 185.220.101.4 --confidence high --tag tor
IOC registrado: ip 185.220.101.4 (tor, high)
$ threat-intel lookup 185.220.101.4
ip 185.220.101.4 tags: tor confianca: high fontes: 3