phishing-detector
Detector de phishing por heurísticas de URL com pontuação de risco 0-100.
10 testes · 10 passou · 0 falhou · 0 skip
- test_legit_url_low_score0.00s
- test_ip_host_flagged0.00s
- test_typosquatting_detected0.00s
- test_brand_in_subdomain0.00s
- test_at_symbol_obfuscation0.00s
- test_suspicious_tld0.00s
- test_levenshtein0.00s
- test_entropy_positive0.00s
- test_score_capped0.00s
- test_scan_text_extrai_e_ordena0.00s
Entrypoints (CLI)
phishdet
Módulos e funções principais
phishdet/__init__.py
- —
phishdet/analyzer.py
analyze_url()scan_text()— Extrai URLs de um texto e analisa cada uma.
phishdet/cli.py
main()
Estrutura de arquivos
- LICENSE
- README.md
- phishdet/__init__.py
- phishdet/analyzer.py
- phishdet/cli.py
- phishing_detector.egg-info/PKG-INFO
- phishing_detector.egg-info/SOURCES.txt
- phishing_detector.egg-info/dependency_links.txt
- phishing_detector.egg-info/entry_points.txt
- phishing_detector.egg-info/requires.txt
- phishing_detector.egg-info/top_level.txt
- pyproject.toml
- tests/test_analyzer.py
README
# Phishing Detector 🎣
Analisa uma **URL** e produz uma **pontuação de risco (0–100)** com base em heurísticas de phishing — sem depender de listas negras externas. Funciona totalmente offline, com checagens de rede (SSL) opcionais.
> ⚠️ Ferramenta educacional/defensiva. Um score baixo **não garante** que um site é seguro; um score alto indica sinais suspeitos que merecem atenção.
## Heurísticas avaliadas
| Sinal | Descrição |
|-------|-----------|
| `no_https` | URL sem TLS |
| `ip_as_host` | IP em vez de domínio |
| `at_symbol` | `@` no netloc (ofuscação) |
| `many_subdomains` | excesso de rótulos |
| `punycode` | domínio homógrafo (`xn--`) |
| `suspicious_tld` | TLD abusado (.tk, .xyz, .zip…) |
| `url_shortener` | encurtador de URL |
| `brand_in_subdomain` | marca fora do domínio registrável |
| `typosquatting` | domínio parecido com marca conhecida |
| `sensitive_words` | login/verify/secure/senha… |
| `long_url` | URL muito longa |
| `high_entropy` | domínio gerado automaticamente |
| `ssl_error` / `expired_cert` | (com `--network`) |
## Instalação
```bash
git clone https://github.com/Diogo-Damasceno/phishing-detector.git
cd phishing-detector
pip install -e .
```
## Uso
```bash
phishdet https://www.google.com
phishdet "http://paypal.secure-login.xyz/account"
phishdet --network https://exemplo.com # inclui checagem de SSL
phishdet --json "http://paypa1.com" # saída JSON
```
### Exemplo
```
URL: http://paypal.secure-login.xyz/account
Domínio: paypal.secure-login.xyz
Score: 46/100 — RISCO MÉDIO
Sinais detectados:
[+22] brand_in_subdomain: Marca 'paypal' fora do domínio registrável (secure-login.xyz)
[+15] no_https: URL não usa HTTPS
[+12] suspicious_tld: TLD frequentemente abusado: .xyz
```
## Testes
```bash
pip install -e '.[dev]'
pytest -q
```
## Licença
MIT
Como rodar na prática (entrada → saída):
$ phishing-detector 'http://g00gle-login.com/login'
homografo: g00gle (~ goog1e) IP direto: nao pontuacao de risco: 87/100 RESULTADO: SUSPEITO