Spaces:
Sleeping
Sleeping
Commit ·
d8b87e0
0
Parent(s):
Ba7ath Deployment
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitignore +64 -0
- Ba7ath.spec +81 -0
- Ba7ath_Installer.iss +18 -0
- Dockerfile +32 -0
- README.md +11 -0
- README_BREVET_DASHBOARD.md +41 -0
- Social-Finder/Dockerfile +14 -0
- Social-Finder/README.md +121 -0
- Social-Finder/backend/app.py +503 -0
- Social-Finder/backend/requirements.txt +5 -0
- Social-Finder/backend/static/css/styles.css +322 -0
- Social-Finder/backend/static/js/scripts.js +538 -0
- Social-Finder/backend/templates/disclaimer.html +116 -0
- Social-Finder/backend/templates/index.html +186 -0
- Social-Finder/backend/templates/privacy.html +120 -0
- Social-Finder/docker-compose.yml +10 -0
- dashboard.py +36 -0
- downloads/.gitkeep +0 -0
- favicon.ico +0 -0
- fb_cookies.json +1 -0
- maigret_reports/.gitkeep +0 -0
- output.json +5 -0
- output.txt +0 -0
- pages/10_WaybackURLs.py +551 -0
- pages/11_Email_extractor.py +357 -0
- pages/12_SocialMentions.py +63 -0
- pages/13_MaigretScan.py +70 -0
- pages/14_SocialFinder.py +70 -0
- pages/15_SpiderFoot.py +70 -0
- pages/16_FB_extractor.py +1168 -0
- pages/1_BUS.py +133 -0
- pages/2_MultiComptes.py +70 -0
- pages/3_Leaks.py +84 -0
- pages/4_YouTube.py +123 -0
- pages/5_GeoFinder.py +128 -0
- pages/6_Entity_extraction.py.disabled +70 -0
- pages/7_FaceFinderOSINT.py +182 -0
- pages/8_Domain_Intel.py +303 -0
- pages/9_SubdomainFinder.py +70 -0
- reports/.gitkeep +0 -0
- requirements.txt +16 -0
- run_app.py +45 -0
- sherlock/.actor/Dockerfile +19 -0
- sherlock/.actor/README.md +93 -0
- sherlock/.actor/actor.sh +14 -0
- sherlock/.dockerignore +8 -0
- sherlock/.editorconfig +18 -0
- sherlock/.github/CODEOWNERS +15 -0
- sherlock/.github/FUNDING.yml +1 -0
- sherlock/.github/ISSUE_TEMPLATE/bug-report.yml +71 -0
.gitignore
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/*
|
| 15 |
+
!downloads/.gitkeep
|
| 16 |
+
eggs/
|
| 17 |
+
.eggs/
|
| 18 |
+
lib/
|
| 19 |
+
lib64/
|
| 20 |
+
parts/
|
| 21 |
+
sdist/
|
| 22 |
+
var/
|
| 23 |
+
wheels/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# Environment variables
|
| 31 |
+
.env
|
| 32 |
+
.env.local
|
| 33 |
+
config.py
|
| 34 |
+
|
| 35 |
+
# Virtual Environments
|
| 36 |
+
venv/
|
| 37 |
+
env/
|
| 38 |
+
ENV/
|
| 39 |
+
env.bak/
|
| 40 |
+
venv.bak/
|
| 41 |
+
|
| 42 |
+
# Streamlit
|
| 43 |
+
.streamlit/
|
| 44 |
+
|
| 45 |
+
# OSINT output data
|
| 46 |
+
reports/*
|
| 47 |
+
!reports/.gitkeep
|
| 48 |
+
maigret_reports/*
|
| 49 |
+
!maigret_reports/.gitkeep
|
| 50 |
+
|
| 51 |
+
# Ad-hoc scripts & unmanaged files
|
| 52 |
+
Site_extract.py
|
| 53 |
+
multi_comptes.py
|
| 54 |
+
Dashboard_Ba7ath.bat
|
| 55 |
+
1.13.0
|
| 56 |
+
4.28.0
|
| 57 |
+
exports/
|
| 58 |
+
*.csv
|
| 59 |
+
*.json
|
| 60 |
+
!output.json
|
| 61 |
+
*.log
|
| 62 |
+
!fb_cookies.json
|
| 63 |
+
*.jpg
|
| 64 |
+
*.png
|
Ba7ath.spec
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- mode: python ; coding: utf-8 -*-
|
| 2 |
+
import os
|
| 3 |
+
from PyInstaller.utils.hooks import copy_metadata
|
| 4 |
+
|
| 5 |
+
datas = [
|
| 6 |
+
('dashboard.py', '.'),
|
| 7 |
+
('pages', 'pages'),
|
| 8 |
+
('assets', 'assets'),
|
| 9 |
+
('output.json', '.'),
|
| 10 |
+
('logo.png', '.'),
|
| 11 |
+
('face_to_search.jpg', '.'),
|
| 12 |
+
('favicon.ico', '.'),
|
| 13 |
+
('spectre_modules', 'spectre_modules'),
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
# Copie des métadonnées Streamlit (indispensable)
|
| 17 |
+
datas += copy_metadata('streamlit')
|
| 18 |
+
|
| 19 |
+
import streamlit
|
| 20 |
+
streamlit_path = os.path.dirname(streamlit.__file__)
|
| 21 |
+
datas.append((os.path.join(streamlit_path, 'static'), 'streamlit/static'))
|
| 22 |
+
|
| 23 |
+
# Copie des outils externes dans le sous-dossier outils_externes
|
| 24 |
+
datas += [
|
| 25 |
+
('sherlock', 'outils_externes/sherlock'),
|
| 26 |
+
('spiderfoot', 'outils_externes/spiderfoot'),
|
| 27 |
+
('Social-Finder', 'outils_externes/Social-Finder'),
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
import glob
|
| 31 |
+
pages_scripts = glob.glob('pages/*.py')
|
| 32 |
+
spectre_scripts = glob.glob('spectre_modules/*.py')
|
| 33 |
+
analysis_scripts = ['run_app.py', 'dashboard.py'] + pages_scripts + spectre_scripts
|
| 34 |
+
|
| 35 |
+
a = Analysis(
|
| 36 |
+
analysis_scripts,
|
| 37 |
+
pathex=[],
|
| 38 |
+
binaries=[],
|
| 39 |
+
datas=datas,
|
| 40 |
+
hiddenimports=[
|
| 41 |
+
'config',
|
| 42 |
+
'streamlit',
|
| 43 |
+
'streamlit.runtime.scriptrunner.magic_funcs'
|
| 44 |
+
],
|
| 45 |
+
hookspath=[],
|
| 46 |
+
hooksconfig={},
|
| 47 |
+
runtime_hooks=[],
|
| 48 |
+
excludes=['torch', 'tensorflow', 'tensorboard'],
|
| 49 |
+
noarchive=False,
|
| 50 |
+
optimize=0,
|
| 51 |
+
)
|
| 52 |
+
pyz = PYZ(a.pure)
|
| 53 |
+
|
| 54 |
+
exe = EXE(
|
| 55 |
+
pyz,
|
| 56 |
+
a.scripts,
|
| 57 |
+
[],
|
| 58 |
+
exclude_binaries=True,
|
| 59 |
+
name='Ba7ath',
|
| 60 |
+
debug=False,
|
| 61 |
+
bootloader_ignore_signals=False,
|
| 62 |
+
strip=False,
|
| 63 |
+
upx=False,
|
| 64 |
+
console=True, # Laisse la console ouverte pour voir les erreurs, peut être mis à False pour prod
|
| 65 |
+
disable_windowed_traceback=False,
|
| 66 |
+
argv_emulation=False,
|
| 67 |
+
target_arch=None,
|
| 68 |
+
codesign_identity=None,
|
| 69 |
+
entitlements_file=None,
|
| 70 |
+
icon='favicon.ico'
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
coll = COLLECT(
|
| 74 |
+
exe,
|
| 75 |
+
a.binaries,
|
| 76 |
+
a.datas,
|
| 77 |
+
strip=False,
|
| 78 |
+
upx=False,
|
| 79 |
+
upx_exclude=[],
|
| 80 |
+
name='Ba7ath',
|
| 81 |
+
)
|
Ba7ath_Installer.iss
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[Setup]
|
| 2 |
+
AppName=Ba7ath OSINT Suite
|
| 3 |
+
AppVersion=1.0
|
| 4 |
+
DefaultDirName={autopf}\Ba7ath OSINT Suite
|
| 5 |
+
DefaultGroupName=Ba7ath OSINT Suite
|
| 6 |
+
OutputDir=Output
|
| 7 |
+
OutputBaseFilename=Installation_Ba7ath
|
| 8 |
+
Compression=lzma2
|
| 9 |
+
SolidCompression=yes
|
| 10 |
+
SetupIconFile=dist\Ba7ath\favicon.ico
|
| 11 |
+
UninstallDisplayIcon={app}\Ba7ath.exe
|
| 12 |
+
|
| 13 |
+
[Files]
|
| 14 |
+
Source: "dist\Ba7ath\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
| 15 |
+
|
| 16 |
+
[Icons]
|
| 17 |
+
Name: "{group}\Ba7ath OSINT Suite"; Filename: "{app}\Ba7ath.exe"
|
| 18 |
+
Name: "{autodesktop}\Ba7ath OSINT Suite"; Filename: "{app}\Ba7ath.exe"
|
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
# Mettre à jour les paquets système et installer les dépendances pour la compilation C++ (face_recognition / dlib)
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
cmake \
|
| 6 |
+
libgl1-mesa-glx \
|
| 7 |
+
build-essential \
|
| 8 |
+
git \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Créer un utilisateur non root (Recommandé par Hugging Face pour des raisons de sécurité)
|
| 12 |
+
RUN useradd -m -u 1000 user
|
| 13 |
+
|
| 14 |
+
# Définir le répertoire de travail
|
| 15 |
+
WORKDIR /app
|
| 16 |
+
|
| 17 |
+
# Copier et installer les dépendances Python
|
| 18 |
+
COPY --chown=user:user requirements.txt .
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
+
pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Copier tout le reste du projet
|
| 23 |
+
COPY --chown=user:user . .
|
| 24 |
+
|
| 25 |
+
# Basculer sur le nouvel utilisateur
|
| 26 |
+
USER user
|
| 27 |
+
|
| 28 |
+
# Exposer le port par défaut de Hugging Face
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Démarrer Streamlit sur le port 7860
|
| 32 |
+
CMD ["streamlit", "run", "dashboard.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Ba7ath OSINT Suite
|
| 3 |
+
emoji: 🕵️♂️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Ba7ath OSINT Suite
|
| 11 |
+
Tableau de bord pour OSINT.
|
README_BREVET_DASHBOARD.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🛡️ Ba7ath OSINT Suite (Dashboard) — Note de Dépôt de Propriété Intellectuelle (Brevet)
|
| 2 |
+
|
| 3 |
+
## 1. Description Générale du Projet
|
| 4 |
+
**Ba7ath OSINT Suite** est un tableau de bord analytique et d'investigation unifié (Dashboard), développé en Python (Streamlit). Il centralise et orchestre 16 modules spécialisés dans l'acquisition de renseignements en sources ouvertes (OSINT).
|
| 5 |
+
|
| 6 |
+
Sa proposition de valeur réside dans la fusion d'outils disparates (recherche de pseudos, reconnaissance faciale, dorking automatisé) au sein d'une **interface unique et souveraine**. Toutes les investigations s'exécutent localement, garantissant qu'aucune donnée de recherche ne fuite vers des serveurs tiers centralisés.
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## 2. Innovations Technologiques & Particularités (Revendications Brevetables)
|
| 11 |
+
|
| 12 |
+
### 2.1. Moteur Algorithmique de "Dorking" Social Multilingue (Module Facebook Dorking)
|
| 13 |
+
Contrairement aux outils de recherche classiques, ce module automatise la création d'opérateurs de recherche complexes (Google Dorks) spécifiquement optimisés pour l'architecture de Facebook.
|
| 14 |
+
- **Génération Dynamique de Requêtes** : L'algorithme compile des opérateurs (`site:`, `intext:`, `inurl:`, `filetype:`) en combinant inclusions et exclusions heuristiques.
|
| 15 |
+
- **Support RTL (Right-to-Left) Natif** : Traitement et encodage spécifiques pour la langue Arabe, vitaux pour l'investigation ciblée, préservant la structure bidirectionnelle lors de l'appel aux API.
|
| 16 |
+
- **Scraping "Full-Content" Anti-Troncature** : Pour contourner la limite de 160 caractères imposée par l'API de Google, le système intègre un scraper furtif qui va lire le DOM de la page Facebook ciblée (paradigmes de fallback multiples : `data-ad-preview`, `userContent`, spans RTL) pour extraire l'intégralité du texte du post, tout en évitant les blocages.
|
| 17 |
+
|
| 18 |
+
### 2.2. Pipeline de Reconnaissance Faciale & Reverse-Search (FaceFinder OSINT)
|
| 19 |
+
Une chaîne de traitement hybride (Edge + Cloud-API) pour l'investigation sur des individus :
|
| 20 |
+
1. **Détection Biométrique Locale** : Utilisation du package `face_recognition` pour détecter, dénombrer et annoter visuellement les visages sur une photographie avant tout envoi externe.
|
| 21 |
+
2. **Résolution OpenGraph Miniature (Thumbnail Resolution)** : Lorsque les API de Reverse Image Search (SerpApi, Zenserp) retournent des liens de pages web sans lien direct vers l'image, le système interroge dynamiquement les balises OpenGraph (`og:image`, `twitter:image`) pour extraire la miniature haute résolution, offrant un gain de temps majeur à l'analyste.
|
| 22 |
+
3. **Quota Manager Intégré** : Un gestionnaire local (`reverse_api_counts.json`) qui surveille et route intelligemment les requêtes vers différentes API en fonction des quotas gratuits restants, évitant les interruptions de service (Rate-Limiting).
|
| 23 |
+
|
| 24 |
+
### 2.3. Hub d'Empreinte Numérique (Multi-Comptes OSINT)
|
| 25 |
+
- **Orchestration Multi-Threads** : Le système exécute de concert plusieurs moteurs de recherche d'empreinte (comme Sherlock scannant plus de 474 plateformes, et SocialScan) pour vérifier la disponibilité ou l'occupation d'un pseudonyme.
|
| 26 |
+
- **Normalisation des Données** : Les sorties non-structurées de la ligne de commande (stdout) de divers utilitaires CLI sont parsées via Regex et unifiées dans un modèle de données cohérent (Pandas DataFrame) pour générer des rapports exportables (CSV).
|
| 27 |
+
|
| 28 |
+
### 2.4. Architecture Modulaire de type "Plug & Play"
|
| 29 |
+
- Le framework a été pensé pour que chaque module (WaybackURLs, Domain Intel, YouTube, EmailHarvester, etc.) soit isolé techniquement mais partage le même écosystème de reporting et de gestion des identifiants (API Keys gérées côté client).
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 3. Architecture Technique Décrite
|
| 34 |
+
- **Frontend / UI** : Développé via le framework Streamlit, offrant une interface réactive (*responsive*) optimisée avec des composants CSS personnalisés pour harmoniser l'expérience utilisateur (UX).
|
| 35 |
+
- **Backend / Orchestrateur** : Python 3.x gérant les appels asynchrones, le parsing (BeautifulSoup, Regex) et le routage des processus (subprocess) vers des outils OSINT externes.
|
| 36 |
+
- **Stockage & Export** : Génération de matrices de données (DataFrames) exportées nativement en JSON et CSV, stockées en local dans un dossier `reports/` sécurisé.
|
| 37 |
+
|
| 38 |
+
## 4. Cas d'Usage & Applicabilité Industrielle
|
| 39 |
+
- Veille Stratégique et e-Réputation : Traçabilité des mentions sociales, fuites de données (Leaks) ou usurpation d'identité sur les réseaux.
|
| 40 |
+
- Investigations Journalistiques : Recherche croisée sur des pages officielles, détection d'avatars et profils fantômes.
|
| 41 |
+
- Audits de Cybersécurité : Récolte d'informations en phase de reconnaissance (Footprinting) sur des domaines, adresses emails et sous-domaines.
|
Social-Finder/Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-alpine
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Sherlock viene installato da Git → serve git
|
| 6 |
+
RUN apk add --no-cache git
|
| 7 |
+
|
| 8 |
+
COPY backend/requirements.txt .
|
| 9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
+
|
| 11 |
+
COPY backend .
|
| 12 |
+
EXPOSE 3000
|
| 13 |
+
|
| 14 |
+
CMD ["python", "app.py"]
|
Social-Finder/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# 🔎 Social Finder
|
| 3 |
+
|
| 4 |
+

|
| 5 |
+

|
| 6 |
+

|
| 7 |
+

|
| 8 |
+

|
| 9 |
+
|
| 10 |
+
[](https://sfinder.mattiapasti.com)
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## 📌 Overview
|
| 15 |
+
|
| 16 |
+
**Social Finder** is an **OSINT web application** built with **Flask** and powered by [Sherlock](https://github.com/sherlock-project/sherlock).
|
| 17 |
+
It allows you to **search for a username across hundreds of social networks** and get structured results in a modern web interface.
|
| 18 |
+
|
| 19 |
+
The project is fully containerized with **Docker** and production-ready with **Gunicorn**.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## ✨ Features
|
| 24 |
+
|
| 25 |
+
- 🌐 Search usernames across multiple platforms (GitHub, Twitter, Instagram, etc.)
|
| 26 |
+
- 📊 Clear and modern dashboard interface
|
| 27 |
+
- 🐳 Docker-ready setup (easy deployment)
|
| 28 |
+
- 🔒 Privacy-focused, no data stored
|
| 29 |
+
- ⚡ Fast & concurrent checks using Sherlock
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 🛠 Tech Stack
|
| 34 |
+
|
| 35 |
+
- **Backend:** Python, Flask, Gunicorn
|
| 36 |
+
- **Frontend:** HTML, CSS, Vanilla JS
|
| 37 |
+
- **OSINT Engine:** Sherlock
|
| 38 |
+
- **Deployment:** Docker & Docker Compose
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## 🚀 Getting Started
|
| 43 |
+
|
| 44 |
+
### 🔧 Local Installation
|
| 45 |
+
```bash
|
| 46 |
+
# Clone the repository
|
| 47 |
+
git clone https://github.com/MattiaPasti/Social-Finder.git
|
| 48 |
+
cd social-finder/Social
|
| 49 |
+
|
| 50 |
+
# Install dependencies
|
| 51 |
+
pip install -r backend/requirements.txt
|
| 52 |
+
|
| 53 |
+
# Run the app
|
| 54 |
+
cd backend
|
| 55 |
+
python app.py
|
| 56 |
+
````
|
| 57 |
+
|
| 58 |
+
App will run on: `http://localhost:5000`
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
### 🐳 Docker Setup
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
# Clone the repository
|
| 66 |
+
git clone https://github.com/MattiaPasti/Social-Finder.git
|
| 67 |
+
cd social-finder/Social
|
| 68 |
+
|
| 69 |
+
# Build and run
|
| 70 |
+
docker compose up --build
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
App will run on: `http://localhost:8000`
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## 🌍 Live Demo
|
| 78 |
+
|
| 79 |
+
You can test Social Finder directly at:
|
| 80 |
+
👉 [**sfinder.mattiapasti.com**](https://sfinder.mattiapasti.com/)
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## 📜 License
|
| 85 |
+
|
| 86 |
+
This project is licensed under the **MIT License** – see the [LICENSE](LICENSE) file for details.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## 🤝 Contributing
|
| 91 |
+
|
| 92 |
+
Contributions, issues, and feature requests are welcome!
|
| 93 |
+
Feel free to open an [issue](https://github.com/MattiaPasti/social-finder/issues) or submit a pull request.
|
| 94 |
+
|
| 95 |
+
---
|
| 96 |
+
|
| 97 |
+
## 📌 Roadmap
|
| 98 |
+
|
| 99 |
+
* [ ] Add PDF export of search results
|
| 100 |
+
* [ ] Improve detection heuristics
|
| 101 |
+
* [ ] Extend supported platforms
|
| 102 |
+
* [ ] Add authentication layer for private instances
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
## 📸 Preview
|
| 107 |
+
|
| 108 |
+
<img width="1913" height="896" alt="Screenshot 2025-08-29 215135" src="https://github.com/user-attachments/assets/47c0b74f-e1c3-442f-99a5-096490183645" />
|
| 109 |
+
|
| 110 |
+
##
|
| 111 |
+
|
| 112 |
+
<img width="1885" height="894" alt="Screenshot 2025-08-29 215802" src="https://github.com/user-attachments/assets/05a6f3d8-f2f8-4198-a848-ad783e3dabb5" />
|
| 113 |
+
|
| 114 |
+
##
|
| 115 |
+
|
| 116 |
+
<img width="1890" height="901" alt="Screenshot 2025-08-29 215831" src="https://github.com/user-attachments/assets/7162ee9d-97da-4489-b15c-361263c6d8c8" />
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
---
|
| 120 |
+
|
| 121 |
+
> ⚡ Built with ❤️ for OSINT & Cybersecurity research.
|
Social-Finder/backend/app.py
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
Social Finder – API backend (optimized & stricter 404 handling)
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
import re
|
| 11 |
+
import signal
|
| 12 |
+
import subprocess
|
| 13 |
+
import time
|
| 14 |
+
import threading
|
| 15 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 16 |
+
from dataclasses import dataclass
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
from tempfile import TemporaryDirectory
|
| 19 |
+
from typing import Dict, Iterator, List, Sequence, Tuple
|
| 20 |
+
from urllib.parse import urlparse
|
| 21 |
+
|
| 22 |
+
import requests
|
| 23 |
+
from bs4 import BeautifulSoup
|
| 24 |
+
from ddgs import DDGS
|
| 25 |
+
from flask import Flask, Response, jsonify, render_template, request
|
| 26 |
+
from requests.adapters import HTTPAdapter, Retry
|
| 27 |
+
|
| 28 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 29 |
+
# Config
|
| 30 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
@dataclass(frozen=True)
|
| 34 |
+
class Config:
|
| 35 |
+
USER_AGENT: str = "Mozilla/5.0 (SocialFinder)"
|
| 36 |
+
DUCK_RATE: float = float(os.getenv("DUCK_RATE", 0.25)) # sec tra query DDG
|
| 37 |
+
PAGE_TIMEOUT: int = int(os.getenv("PAGE_TIMEOUT", 8))
|
| 38 |
+
SHERLOCK_TIMEOUT: str = os.getenv("SHERLOCK_TIMEOUT", "5")
|
| 39 |
+
SCRAPE_WORKERS: int = int(os.getenv("SCRAPE_WORKERS", 10))
|
| 40 |
+
MAX_BODY_BYTES: int = int(os.getenv("MAX_BODY_BYTES", 20_480))
|
| 41 |
+
SERPAPI_KEY: str | None = os.getenv("SERPAPI_KEY")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
CFG = Config()
|
| 45 |
+
|
| 46 |
+
INVALID_HTML_PATTERNS: set[str] = {
|
| 47 |
+
"sign in",
|
| 48 |
+
"log in",
|
| 49 |
+
"login required",
|
| 50 |
+
"you need to sign in",
|
| 51 |
+
"autenticati",
|
| 52 |
+
"registrati per continuare",
|
| 53 |
+
"captcha",
|
| 54 |
+
"devi essere loggato",
|
| 55 |
+
"area riservata",
|
| 56 |
+
"contenuto privato",
|
| 57 |
+
"restricted access",
|
| 58 |
+
"acesso restrito",
|
| 59 |
+
"accès restreint",
|
| 60 |
+
"404",
|
| 61 |
+
"page not found",
|
| 62 |
+
"error 404",
|
| 63 |
+
"error",
|
| 64 |
+
"not found",
|
| 65 |
+
"pagina non trovata",
|
| 66 |
+
"pagina non disponibile",
|
| 67 |
+
"we couldn't find",
|
| 68 |
+
"sorry, this page isn't",
|
| 69 |
+
"torna alla home",
|
| 70 |
+
"contenuto non disponibile",
|
| 71 |
+
"errore nel recupero della pagina",
|
| 72 |
+
"sito non trovato",
|
| 73 |
+
"nicht gefunden",
|
| 74 |
+
"pas trouv",
|
| 75 |
+
"no encontrada",
|
| 76 |
+
"не найдена",
|
| 77 |
+
"this page could not be found",
|
| 78 |
+
"la pagina che stavi cercando non è stata trovata",
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
ERROR_INDICATORS: tuple[str, ...] = (
|
| 82 |
+
"<title>404",
|
| 83 |
+
"<title>page not found",
|
| 84 |
+
"<title>error",
|
| 85 |
+
"<title>pagina non trovata",
|
| 86 |
+
'class="error',
|
| 87 |
+
'class="notfound',
|
| 88 |
+
'class="page-error',
|
| 89 |
+
'class="404',
|
| 90 |
+
'id="error',
|
| 91 |
+
'id="notfound',
|
| 92 |
+
'id="page-error',
|
| 93 |
+
'id="404',
|
| 94 |
+
'meta name="error"',
|
| 95 |
+
'prerender-status-code" content="404',
|
| 96 |
+
"error-page",
|
| 97 |
+
"notfound-container",
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
HARSH_404_REGEX = re.compile(r"(404|not\s*found|pagina\s*non\s*trovata)", re.IGNORECASE)
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 104 |
+
# LIMIT RATING REQUEST
|
| 105 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 106 |
+
|
| 107 |
+
RATE_WINDOW = 5 * 60 # 5 minuti
|
| 108 |
+
RATE_MAX = 1 # 1 richiesta per finestra
|
| 109 |
+
_rate_lock = threading.Lock()
|
| 110 |
+
_rate_hits = {} # { (route, ip): [t1, t2, ...] } timestamps secondi
|
| 111 |
+
|
| 112 |
+
def client_ip():
|
| 113 |
+
# Se usi Proxy/Nginx/CF potresti voler leggere X-Forwarded-For
|
| 114 |
+
fwd = request.headers.get("X-Forwarded-For", "")
|
| 115 |
+
if fwd:
|
| 116 |
+
return fwd.split(",")[0].strip()
|
| 117 |
+
return request.remote_addr or "unknown"
|
| 118 |
+
|
| 119 |
+
def rate_limit(route_key: str):
|
| 120 |
+
def decorator(fn):
|
| 121 |
+
def wrapper(*args, **kwargs):
|
| 122 |
+
ip = client_ip()
|
| 123 |
+
now = time.time()
|
| 124 |
+
key = (route_key, ip)
|
| 125 |
+
with _rate_lock:
|
| 126 |
+
hits = _rate_hits.get(key, [])
|
| 127 |
+
# tieni solo gli hit negli ultimi 5 min
|
| 128 |
+
hits = [t for t in hits if now - t < RATE_WINDOW]
|
| 129 |
+
if len(hits) >= RATE_MAX:
|
| 130 |
+
# 429 con messaggio coerente
|
| 131 |
+
if request.path == "/api/search-stream":
|
| 132 |
+
return Response(
|
| 133 |
+
"event: message\ndata: ⚠️ Limite raggiunto. Riprova tra 5 minuti.\n\n",
|
| 134 |
+
status=429,
|
| 135 |
+
mimetype="text/event-stream"
|
| 136 |
+
)
|
| 137 |
+
abort(429, description="Troppi tentativi. Riprova tra 5 minuti.")
|
| 138 |
+
hits.append(now)
|
| 139 |
+
_rate_hits[key] = hits
|
| 140 |
+
return fn(*args, **kwargs)
|
| 141 |
+
# preserva nome e docstring (opzionale)
|
| 142 |
+
wrapper.__name__ = fn.__name__
|
| 143 |
+
wrapper.__doc__ = fn.__doc__
|
| 144 |
+
return wrapper
|
| 145 |
+
return decorator
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 149 |
+
# HTTP session (retry/backoff)
|
| 150 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def build_session() -> requests.Session:
|
| 154 |
+
sess = requests.Session()
|
| 155 |
+
sess.headers.update({"User-Agent": CFG.USER_AGENT})
|
| 156 |
+
retries = Retry(
|
| 157 |
+
total=2,
|
| 158 |
+
backoff_factor=0.3,
|
| 159 |
+
status_forcelist=(429, 500, 502, 503, 504),
|
| 160 |
+
allowed_methods=("HEAD", "GET"),
|
| 161 |
+
respect_retry_after_header=True,
|
| 162 |
+
)
|
| 163 |
+
adapter = HTTPAdapter(max_retries=retries, pool_maxsize=CFG.SCRAPE_WORKERS)
|
| 164 |
+
sess.mount("http://", adapter)
|
| 165 |
+
sess.mount("https://", adapter)
|
| 166 |
+
return sess
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
SESSION = build_session()
|
| 170 |
+
|
| 171 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 172 |
+
# Helpers
|
| 173 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def match_domain(url: str, wanted: str) -> bool:
|
| 177 |
+
host = (urlparse(url).hostname or "").lower()
|
| 178 |
+
return host == wanted or host.endswith("." + wanted)
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def build_username_variants(nome: str, cognome: str) -> list[str]:
|
| 182 |
+
nome, cognome = (re.sub(r"\W+", "", s.lower()) for s in (nome, cognome))
|
| 183 |
+
base = [
|
| 184 |
+
f"{nome}{cognome}",
|
| 185 |
+
f"{cognome}{nome}",
|
| 186 |
+
f"{nome}.{cognome}",
|
| 187 |
+
f"{nome}_{cognome}",
|
| 188 |
+
f"{nome[:1]}{cognome}" if nome else "",
|
| 189 |
+
f"{cognome}{nome[:1]}" if nome and cognome else "",
|
| 190 |
+
]
|
| 191 |
+
extra = [f"{b}_" for b in base if b] + [f"{b}1" for b in base if b]
|
| 192 |
+
return sorted({v for v in base + extra if v})
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def sse(msg: str) -> str:
|
| 196 |
+
return f"data: {msg}\n\n"
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def stream_cmd(cmd: Sequence[str], label: str) -> Iterator[str]:
|
| 200 |
+
yield sse(f"▶️ {' '.join(cmd)}")
|
| 201 |
+
with subprocess.Popen(
|
| 202 |
+
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1
|
| 203 |
+
) as proc:
|
| 204 |
+
assert proc.stdout is not None
|
| 205 |
+
for line in proc.stdout:
|
| 206 |
+
yield sse(f"{label} | {line.rstrip()}")
|
| 207 |
+
yield sse(f"✅ {label} terminato (exit {proc.returncode})")
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def is_valid_page(url: str) -> Tuple[bool, str]:
|
| 211 |
+
"""Controllo avanzato validità pagina. Più severo su 404/not found."""
|
| 212 |
+
if not url.lower().startswith(("http://", "https://")):
|
| 213 |
+
return False, "URL deve iniziare con http:// o https://"
|
| 214 |
+
|
| 215 |
+
try:
|
| 216 |
+
parsed = urlparse(url)
|
| 217 |
+
if not parsed.netloc:
|
| 218 |
+
return False, "URL non valido: dominio mancante"
|
| 219 |
+
except Exception as e:
|
| 220 |
+
return False, f"Errore parsing URL: {e}"
|
| 221 |
+
|
| 222 |
+
headers = {
|
| 223 |
+
"Accept": "text/html,*/*",
|
| 224 |
+
"Accept-Encoding": "identity",
|
| 225 |
+
"Range": f"bytes=0-{CFG.MAX_BODY_BYTES - 1}",
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
try:
|
| 229 |
+
resp = SESSION.head(
|
| 230 |
+
url,
|
| 231 |
+
headers=headers,
|
| 232 |
+
allow_redirects=True,
|
| 233 |
+
timeout=CFG.PAGE_TIMEOUT,
|
| 234 |
+
verify=True,
|
| 235 |
+
)
|
| 236 |
+
if resp.status_code in (405, 501): # HEAD non supportato
|
| 237 |
+
resp = SESSION.get(
|
| 238 |
+
url,
|
| 239 |
+
headers=headers,
|
| 240 |
+
allow_redirects=True,
|
| 241 |
+
timeout=CFG.PAGE_TIMEOUT,
|
| 242 |
+
stream=True,
|
| 243 |
+
)
|
| 244 |
+
if hasattr(resp, "raw") and resp.raw:
|
| 245 |
+
resp.raw.read(CFG.MAX_BODY_BYTES)
|
| 246 |
+
resp.close()
|
| 247 |
+
|
| 248 |
+
status = resp.status_code
|
| 249 |
+
if status == 200:
|
| 250 |
+
status_reason = "200 OK"
|
| 251 |
+
elif status in (202, 204):
|
| 252 |
+
return True, f"{status} Accepted/No Content"
|
| 253 |
+
elif status in (404, 410):
|
| 254 |
+
return False, f"HTTP Status {status} (hard fail)"
|
| 255 |
+
elif 300 <= status < 400:
|
| 256 |
+
return False, f"Redirect non risolto ({status})"
|
| 257 |
+
elif 400 <= status < 500:
|
| 258 |
+
return False, f"HTTP Client Error {status}"
|
| 259 |
+
else:
|
| 260 |
+
return False, f"HTTP Server Error {status}"
|
| 261 |
+
|
| 262 |
+
ctype = resp.headers.get("content-type", "").lower()
|
| 263 |
+
if "text/html" not in ctype:
|
| 264 |
+
return True, status_reason
|
| 265 |
+
|
| 266 |
+
raw = resp.content[: CFG.MAX_BODY_BYTES]
|
| 267 |
+
soup = BeautifulSoup(raw, "html.parser")
|
| 268 |
+
main = soup.find("main") or soup.find("body") or soup
|
| 269 |
+
text = main.get_text(separator=" ", strip=True).lower()
|
| 270 |
+
html_str = str(main)
|
| 271 |
+
|
| 272 |
+
if HARSH_404_REGEX.search(text):
|
| 273 |
+
return False, f"{status_reason} + text 404"
|
| 274 |
+
if any(p in text for p in INVALID_HTML_PATTERNS):
|
| 275 |
+
return False, f"{status_reason} + pattern visibile"
|
| 276 |
+
|
| 277 |
+
indicators_hit = [ind for ind in ERROR_INDICATORS if ind in html_str]
|
| 278 |
+
if any("404" in ind or "notfound" in ind for ind in indicators_hit):
|
| 279 |
+
return False, f"{status_reason} + html 404"
|
| 280 |
+
if len(indicators_hit) >= 2:
|
| 281 |
+
return False, f"{status_reason} + multiple error indicators"
|
| 282 |
+
|
| 283 |
+
if re.search(r"<img[^>]+(404|notfound|error)[^>]*>", html_str):
|
| 284 |
+
return False, f"{status_reason} + img 404"
|
| 285 |
+
if re.search(r'class=["\'][^"\']*(error|notfound|404)[^"\']*["\']', html_str):
|
| 286 |
+
return False, f"{status_reason} + class regex"
|
| 287 |
+
|
| 288 |
+
return True, status_reason
|
| 289 |
+
|
| 290 |
+
except requests.exceptions.TooManyRedirects:
|
| 291 |
+
return False, "Troppi redirect (loop?)"
|
| 292 |
+
except requests.exceptions.SSLError:
|
| 293 |
+
return False, "Errore SSL/Certificato"
|
| 294 |
+
except requests.exceptions.Timeout:
|
| 295 |
+
return False, "Timeout connessione"
|
| 296 |
+
except requests.exceptions.ConnectionError:
|
| 297 |
+
return False, "Errore di connessione"
|
| 298 |
+
except requests.exceptions.RequestException as e:
|
| 299 |
+
return False, f"Errore richiesta: {e}"
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 303 |
+
# Core search
|
| 304 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
def search_dorks(fullname: str, seen: set[str]) -> List[str]:
|
| 308 |
+
targets = {
|
| 309 |
+
"facebook.com": f'"{fullname}" site:facebook.com',
|
| 310 |
+
"instagram.com": f'"{fullname}" site:instagram.com',
|
| 311 |
+
"linkedin.com": f'"{fullname}" site:linkedin.com',
|
| 312 |
+
"twitter.com": f'"{fullname}" site:twitter.com',
|
| 313 |
+
"tiktok.com": f'"{fullname}" site:tiktok.com',
|
| 314 |
+
"youtube.com": f'"{fullname}" site:youtube.com',
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
engine = "SerpAPI" if CFG.SERPAPI_KEY else "DuckDuckGo"
|
| 318 |
+
results: list[str] = []
|
| 319 |
+
|
| 320 |
+
for dom, query in targets.items():
|
| 321 |
+
try:
|
| 322 |
+
if CFG.SERPAPI_KEY:
|
| 323 |
+
data = SESSION.get(
|
| 324 |
+
"https://serpapi.com/search.json",
|
| 325 |
+
params={
|
| 326 |
+
"engine": "google",
|
| 327 |
+
"q": query,
|
| 328 |
+
"api_key": CFG.SERPAPI_KEY,
|
| 329 |
+
"num": 25,
|
| 330 |
+
},
|
| 331 |
+
timeout=15,
|
| 332 |
+
).json()
|
| 333 |
+
raw_links = [
|
| 334 |
+
hit.get("link", "") for hit in data.get("organic_results", [])
|
| 335 |
+
]
|
| 336 |
+
else:
|
| 337 |
+
with DDGS(proxy=None, timeout=10) as ddgs:
|
| 338 |
+
raw_links = [h["href"] for h in ddgs.text(query, max_results=40)]
|
| 339 |
+
time.sleep(CFG.DUCK_RATE)
|
| 340 |
+
except Exception:
|
| 341 |
+
raw_links = []
|
| 342 |
+
|
| 343 |
+
good = [u for u in raw_links if match_domain(u, dom) and u not in seen][:10]
|
| 344 |
+
results.extend(good)
|
| 345 |
+
seen.update(good)
|
| 346 |
+
|
| 347 |
+
return results
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def validate_links(urls: Sequence[str]) -> List[str]:
|
| 351 |
+
valid: list[str] = []
|
| 352 |
+
with ThreadPoolExecutor(max_workers=CFG.SCRAPE_WORKERS) as pool:
|
| 353 |
+
futs = {pool.submit(is_valid_page, u): u for u in urls}
|
| 354 |
+
for fut in as_completed(futs):
|
| 355 |
+
url = futs[fut]
|
| 356 |
+
ok, _ = fut.result()
|
| 357 |
+
if ok:
|
| 358 |
+
valid.append(url)
|
| 359 |
+
return valid
|
| 360 |
+
|
| 361 |
+
|
| 362 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 363 |
+
# Flask
|
| 364 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 365 |
+
|
| 366 |
+
app = Flask(__name__, static_folder="static", static_url_path="/static")
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
@app.route("/")
|
| 370 |
+
# @rate_limit("main")
|
| 371 |
+
def home():
|
| 372 |
+
return render_template("index.html")
|
| 373 |
+
|
| 374 |
+
@app.route("/disclaimer")
|
| 375 |
+
# @rate_limit("disclaimer")
|
| 376 |
+
def disclaimer():
|
| 377 |
+
return render_template("disclaimer.html")
|
| 378 |
+
|
| 379 |
+
@app.route("/privacy")
|
| 380 |
+
# @rate_limit("privacy")
|
| 381 |
+
def privacy():
|
| 382 |
+
return render_template("privacy.html")
|
| 383 |
+
|
| 384 |
+
@app.route("/api/search-stream")
|
| 385 |
+
# @rate_limit("search-stream")
|
| 386 |
+
def api_search_stream():
|
| 387 |
+
nome = request.args.get("nome", "").strip()
|
| 388 |
+
cognome = request.args.get("cognome", "").strip()
|
| 389 |
+
fullname = f"{nome} {cognome}".strip()
|
| 390 |
+
usernames = build_username_variants(nome, cognome)
|
| 391 |
+
t0 = time.time()
|
| 392 |
+
|
| 393 |
+
def generate() -> Iterator[str]:
|
| 394 |
+
yield sse(f"🔎 Avvio ricerca per: {fullname or '(nessun nome)'}")
|
| 395 |
+
yield sse(f"🧩 Username generati: {', '.join(usernames) or '(0)'}")
|
| 396 |
+
|
| 397 |
+
# 1) Sherlock
|
| 398 |
+
sherlock_links: Dict[str, List[str]] = {}
|
| 399 |
+
with TemporaryDirectory() as tmp:
|
| 400 |
+
yield sse("⏳ Esecuzione Sherlock…")
|
| 401 |
+
cmd = [
|
| 402 |
+
"sherlock",
|
| 403 |
+
*usernames,
|
| 404 |
+
"--folderoutput",
|
| 405 |
+
tmp,
|
| 406 |
+
"--print-found",
|
| 407 |
+
"--timeout",
|
| 408 |
+
CFG.SHERLOCK_TIMEOUT,
|
| 409 |
+
]
|
| 410 |
+
for chunk in stream_cmd(cmd, "sherlock"):
|
| 411 |
+
yield chunk
|
| 412 |
+
for u in usernames:
|
| 413 |
+
f = Path(tmp) / f"{u}.txt"
|
| 414 |
+
urls: list[str] = []
|
| 415 |
+
if f.exists():
|
| 416 |
+
for raw in f.read_text(encoding="utf-8").splitlines():
|
| 417 |
+
m = re.search(r"https?://\S+", raw)
|
| 418 |
+
if m:
|
| 419 |
+
urls.append(m.group(0))
|
| 420 |
+
sherlock_links[u] = sorted(set(urls))
|
| 421 |
+
yield sse(f"📦 {u}: {len(urls)} link trovati")
|
| 422 |
+
|
| 423 |
+
# dedup
|
| 424 |
+
all_links: list[str] = []
|
| 425 |
+
seen: set[str] = set()
|
| 426 |
+
for lst in sherlock_links.values():
|
| 427 |
+
for u in lst:
|
| 428 |
+
if u not in seen:
|
| 429 |
+
seen.add(u)
|
| 430 |
+
all_links.append(u)
|
| 431 |
+
|
| 432 |
+
# 2) Dorks
|
| 433 |
+
engine = "SerpAPI" if CFG.SERPAPI_KEY else "DuckDuckGo"
|
| 434 |
+
yield sse(f"⏳ Avvio dork con {engine}…")
|
| 435 |
+
dork_links = search_dorks(fullname, seen)
|
| 436 |
+
all_links.extend(dork_links)
|
| 437 |
+
yield sse(f"✅ {len(dork_links)} link validi dai dork")
|
| 438 |
+
|
| 439 |
+
# 3) Verifica
|
| 440 |
+
yield sse("⏳ Verifica validità link…")
|
| 441 |
+
valid_links: list[str] = []
|
| 442 |
+
with ThreadPoolExecutor(max_workers=CFG.SCRAPE_WORKERS) as pool:
|
| 443 |
+
futs = {pool.submit(is_valid_page, u): u for u in all_links}
|
| 444 |
+
for fut in as_completed(futs):
|
| 445 |
+
url = futs[fut]
|
| 446 |
+
ok, reason = fut.result()
|
| 447 |
+
if ok:
|
| 448 |
+
valid_links.append(url)
|
| 449 |
+
yield sse(f"🔗 {url} {'✅' if ok else '❌'} ({reason})")
|
| 450 |
+
|
| 451 |
+
yield sse(f"✅ Link validi totali: {len(valid_links)}")
|
| 452 |
+
payload = {
|
| 453 |
+
"ok": True,
|
| 454 |
+
"query": {"nome": nome, "cognome": cognome},
|
| 455 |
+
"links": valid_links,
|
| 456 |
+
}
|
| 457 |
+
elapsed = int(time.time() - t0)
|
| 458 |
+
yield sse(f"🎉 Ricerca terminata in {elapsed}s")
|
| 459 |
+
yield sse(json.dumps({"done": True, "result": payload}))
|
| 460 |
+
|
| 461 |
+
return Response(generate(), mimetype="text/event-stream")
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
@app.route("/api/search")
|
| 465 |
+
# @rate_limit("search")
|
| 466 |
+
def api_search():
|
| 467 |
+
return jsonify({"ok": True, "links": []}), 200
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
LINK_CACHE = {}
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
@app.post("/api/link-check")
|
| 474 |
+
# @rate_limit("link-check")
|
| 475 |
+
def link_check():
|
| 476 |
+
data = request.get_json(force=True, silent=True) or {}
|
| 477 |
+
url = data.get("url")
|
| 478 |
+
if not url:
|
| 479 |
+
return jsonify({"error": "missing url"}), 400
|
| 480 |
+
if url in LINK_CACHE:
|
| 481 |
+
return jsonify(LINK_CACHE[url])
|
| 482 |
+
|
| 483 |
+
valid, reason = is_valid_page(url) # implementa la tua logica
|
| 484 |
+
resp = {"url": url, "valid": valid, "reason": reason}
|
| 485 |
+
LINK_CACHE[url] = resp
|
| 486 |
+
return jsonify(resp)
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 490 |
+
# Shutdown
|
| 491 |
+
# ──────────────────────────────────────────────────────────────────────────────
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
def _graceful_exit(*_):
|
| 495 |
+
raise SystemExit(0)
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
signal.signal(signal.SIGINT, _graceful_exit)
|
| 499 |
+
signal.signal(signal.SIGTERM, _graceful_exit)
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
if __name__ == "__main__":
|
| 503 |
+
app.run("0.0.0.0", 3000, debug=True)
|
Social-Finder/backend/requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Flask==3.0.2
|
| 2 |
+
ddgs==9.4.0
|
| 3 |
+
sherlock-project @ git+https://github.com/sherlock-project/sherlock.git
|
| 4 |
+
requests==2.32.3
|
| 5 |
+
beautifulsoup4==4.13.4
|
Social-Finder/backend/static/css/styles.css
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ============================================================================
|
| 2 |
+
* Social Finder – Custom CSS
|
| 3 |
+
* ==========================================================================*/
|
| 4 |
+
|
| 5 |
+
/* Utility override */
|
| 6 |
+
.hidden {
|
| 7 |
+
display: none !important;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
/* --------------------------- RESULTS GRID ---------------------------------*/
|
| 11 |
+
.results-container {
|
| 12 |
+
display: grid;
|
| 13 |
+
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
|
| 14 |
+
gap: 1rem;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
/* --------------------------- PROFILE CARD ---------------------------------*/
|
| 18 |
+
.profile-card {
|
| 19 |
+
background: rgba(255, 255, 255, 0.9);
|
| 20 |
+
backdrop-filter: blur(6px);
|
| 21 |
+
border-radius: 1rem;
|
| 22 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
|
| 23 |
+
overflow: hidden;
|
| 24 |
+
display: flex;
|
| 25 |
+
flex-direction: column;
|
| 26 |
+
transition: transform .12s ease, box-shadow .12s ease;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.profile-card:hover {
|
| 30 |
+
transform: translateY(-2px);
|
| 31 |
+
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/* Header */
|
| 35 |
+
.card-header {
|
| 36 |
+
display: flex;
|
| 37 |
+
align-items: center;
|
| 38 |
+
gap: .8rem;
|
| 39 |
+
padding: 1rem 1.25rem .8rem;
|
| 40 |
+
border-bottom: 1px solid #e2e8f0;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.platform-icon {
|
| 44 |
+
width: 32px;
|
| 45 |
+
height: 32px;
|
| 46 |
+
border-radius: .5rem;
|
| 47 |
+
flex-shrink: 0;
|
| 48 |
+
display: inline-flex;
|
| 49 |
+
align-items: center;
|
| 50 |
+
justify-content: center;
|
| 51 |
+
color: #fff;
|
| 52 |
+
font-size: 1.1rem;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.platform-info h3 {
|
| 56 |
+
font-weight: 600;
|
| 57 |
+
font-size: 1.05rem;
|
| 58 |
+
margin: 0;
|
| 59 |
+
color: #1e293b;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.platform-info p {
|
| 63 |
+
margin: .1rem 0 0;
|
| 64 |
+
font-size: .8rem;
|
| 65 |
+
color: #475569;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.truncate {
|
| 69 |
+
overflow: hidden;
|
| 70 |
+
text-overflow: ellipsis;
|
| 71 |
+
white-space: nowrap;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/* Body */
|
| 75 |
+
.card-body {
|
| 76 |
+
padding: .9rem 1.25rem 1.1rem;
|
| 77 |
+
display: flex;
|
| 78 |
+
justify-content: space-between;
|
| 79 |
+
align-items: center;
|
| 80 |
+
gap: .5rem;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.btn {
|
| 84 |
+
background: #6366f1;
|
| 85 |
+
color: white;
|
| 86 |
+
font-size: .85rem;
|
| 87 |
+
padding: .45rem .9rem;
|
| 88 |
+
border-radius: .65rem;
|
| 89 |
+
display: inline-flex;
|
| 90 |
+
align-items: center;
|
| 91 |
+
gap: .35rem;
|
| 92 |
+
text-decoration: none;
|
| 93 |
+
transition: background .12s ease, transform .12s ease;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.btn:hover {
|
| 97 |
+
background: #4f46e5;
|
| 98 |
+
transform: scale(.98);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.validation-badge,
|
| 102 |
+
.status-badge {
|
| 103 |
+
display: inline-flex;
|
| 104 |
+
align-items: center;
|
| 105 |
+
gap: .32rem;
|
| 106 |
+
font-size: .72rem;
|
| 107 |
+
font-weight: 500;
|
| 108 |
+
padding: .18rem .55rem;
|
| 109 |
+
border-radius: .6rem;
|
| 110 |
+
letter-spacing: .02em;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.status-badge.valid,
|
| 114 |
+
.validation-badge.valid {
|
| 115 |
+
background: #dcfce7;
|
| 116 |
+
color: #166534;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.status-badge.invalid,
|
| 120 |
+
.validation-badge.invalid {
|
| 121 |
+
background: #fee2e2;
|
| 122 |
+
color: #991b1b;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.status-badge.pending,
|
| 126 |
+
.validation-badge.unknown {
|
| 127 |
+
background: #e2e8f0;
|
| 128 |
+
color: #475569;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
.reason {
|
| 132 |
+
font-size: .7rem;
|
| 133 |
+
color: #64748b;
|
| 134 |
+
margin-left: .2rem;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/* Console */
|
| 138 |
+
#console {
|
| 139 |
+
white-space: pre-wrap;
|
| 140 |
+
word-wrap: break-word;
|
| 141 |
+
font-size: .8rem;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
#console-container {
|
| 145 |
+
border-radius: 1rem;
|
| 146 |
+
overflow: hidden;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/* Loader inline */
|
| 150 |
+
.loading-spinner {
|
| 151 |
+
width: 48px;
|
| 152 |
+
height: 48px;
|
| 153 |
+
border: 4px solid #cbd5e1;
|
| 154 |
+
border-top-color: #6366f1;
|
| 155 |
+
border-radius: 50%;
|
| 156 |
+
animation: spin 0.9s linear infinite;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/* Overlay spinner */
|
| 160 |
+
.spinner-xl {
|
| 161 |
+
width: 70px;
|
| 162 |
+
height: 70px;
|
| 163 |
+
border: 6px solid rgba(0, 0, 0, 0.1);
|
| 164 |
+
border-top-color: #6366f1;
|
| 165 |
+
border-radius: 50%;
|
| 166 |
+
animation: spin 0.9s linear infinite;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
@keyframes spin {
|
| 170 |
+
to {
|
| 171 |
+
transform: rotate(360deg);
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/* Toggle dettagli: nasconde il corpo delle card */
|
| 176 |
+
#cards.details-hidden .card-body {
|
| 177 |
+
display: none;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
/* Mini animazione ingresso */
|
| 181 |
+
.fade-in {
|
| 182 |
+
opacity: 0;
|
| 183 |
+
transform: translateY(8px);
|
| 184 |
+
animation: fadeInUp 0.25s ease forwards;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
@keyframes fadeInUp {
|
| 188 |
+
to {
|
| 189 |
+
opacity: 1;
|
| 190 |
+
transform: translateY(0);
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/* Platform icon colors (solo alcune, il resto via Tailwind/brand) */
|
| 195 |
+
.platform-icon.facebook {
|
| 196 |
+
background: #1877f2;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
.platform-icon.instagram {
|
| 200 |
+
background: #e1306c;
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
.platform-icon.twitter,
|
| 204 |
+
.platform-icon.x {
|
| 205 |
+
background: #000000;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.platform-icon.linkedin {
|
| 209 |
+
background: #0a66c2;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.platform-icon.youtube {
|
| 213 |
+
background: #ff0000;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.platform-icon.tiktok {
|
| 217 |
+
background: #000000;
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
.platform-icon.github {
|
| 221 |
+
background: #24292e;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.platform-icon.gitlab {
|
| 225 |
+
background: #e24329;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
.platform-icon.reddit {
|
| 229 |
+
background: #ff4500;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.platform-icon.spotify {
|
| 233 |
+
background: #1db954;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
.platform-icon.soundcloud {
|
| 237 |
+
background: #ff7700;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.platform-icon.telegram {
|
| 241 |
+
background: #229ed9;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.platform-icon.vk {
|
| 245 |
+
background: #4c75a3;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
.platform-icon.medium {
|
| 249 |
+
background: #00ab6c;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
.platform-icon.pinterest {
|
| 253 |
+
background: #bd081c;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
.platform-icon.tumblr {
|
| 257 |
+
background: #35465c;
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.platform-icon.dribbble {
|
| 261 |
+
background: #ea4c89;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.platform-icon.behance {
|
| 265 |
+
background: #1769ff;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
.platform-icon.generic {
|
| 269 |
+
background: #f1f5f9;
|
| 270 |
+
color: #64748b;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
/* Reduce motion */
|
| 274 |
+
@media (prefers-reduced-motion: reduce) {
|
| 275 |
+
|
| 276 |
+
.loading-spinner,
|
| 277 |
+
.spinner-xl {
|
| 278 |
+
animation: none;
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/* Responsive tweaks */
|
| 283 |
+
@media (max-width: 640px) {
|
| 284 |
+
.card-header {
|
| 285 |
+
padding: .8rem 1rem .6rem;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.platform-icon {
|
| 289 |
+
width: 28px;
|
| 290 |
+
height: 28px;
|
| 291 |
+
font-size: 1rem;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.platform-info h3 {
|
| 295 |
+
font-size: .95rem;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.card-body {
|
| 299 |
+
padding: .7rem 1rem .9rem;
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
/* Aggiungi questo in fondo al file */
|
| 304 |
+
|
| 305 |
+
/* Fix per toggle dettagli - applica a tutte le card */
|
| 306 |
+
#cards.details-hidden .profile-card .card-body {
|
| 307 |
+
display: none !important;
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
/* Stile per stato iniziale */
|
| 311 |
+
#cards.details-hidden .card-body {
|
| 312 |
+
display: none;
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
.profile-card.collapsed .card-body {
|
| 316 |
+
display: none;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
/* Mostra/Nascondi INTERA CARD */
|
| 320 |
+
#cards.details-hidden .profile-card {
|
| 321 |
+
display: none !important;
|
| 322 |
+
}
|
Social-Finder/backend/static/js/scripts.js
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ============================================================================
|
| 2 |
+
* Social Finder – Frontend JS (completo) – SSE + doppio toggle + no-results finale
|
| 3 |
+
* ==========================================================================*/
|
| 4 |
+
|
| 5 |
+
/* ------------------------- CONFIG / COSTANTI ------------------------------*/
|
| 6 |
+
const PLATFORM = {
|
| 7 |
+
"9gag.com": { icon: "ri-emotion-laugh-fill", brand: "9gag", label: "9GAG" },
|
| 8 |
+
"academia.edu": { icon: "ri-graduation-cap-fill", brand: "academia", label: "Academia.edu" },
|
| 9 |
+
"apple.com": { icon: "ri-apple-fill", brand: "apple", label: "Apple Discussions" },
|
| 10 |
+
"artstation.com": { icon: "ri-brush-fill", brand: "artstation", label: "ArtStation" },
|
| 11 |
+
"biggerpockets.com": { icon: "ri-home-4-fill", brand: "biggerpockets", label: "BiggerPockets" },
|
| 12 |
+
"boardgamegeek.com": { icon: "ri-gamepad-fill", brand: "bgg", label: "BoardGameGeek" },
|
| 13 |
+
"clubhouse.com": { icon: "ri-mic-fill", brand: "clubhouse", label: "Clubhouse" },
|
| 14 |
+
"codepen.io": { icon: "ri-code-fill", brand: "codepen", label: "CodePen" },
|
| 15 |
+
"cults3d.com": { icon: "ri-cube-fill", brand: "cults3d", label: "Cults3D" },
|
| 16 |
+
"deviantart.com": { icon: "ri-palette-fill", brand: "deviantart", label: "DeviantArt" },
|
| 17 |
+
"discord.com": { icon: "ri-discord-fill", brand: "discord", label: "Discord" },
|
| 18 |
+
"dribbble.com": { icon: "ri-ball-pen-fill", brand: "dribbble", label: "Dribbble" },
|
| 19 |
+
"drive2.ru": { icon: "ri-car-fill", brand: "drive2", label: "Drive2" },
|
| 20 |
+
"duolingo.com": { icon: "ri-translate-2", brand: "duolingo", label: "Duolingo" },
|
| 21 |
+
"eyeem.com": { icon: "ri-camera-3-fill", brand: "eyeem", label: "EyeEm" },
|
| 22 |
+
"facebook.com": { icon: "ri-facebook-fill", brand: "facebook", label: "Facebook" },
|
| 23 |
+
"freesound.org": { icon: "ri-volume-up-fill", brand: "freesound", label: "Freesound" },
|
| 24 |
+
"freelance.habr.com": { icon: "ri-briefcase-4-fill", brand: "habr", label: "Freelance Habr" },
|
| 25 |
+
"geocaching.com": { icon: "ri-compass-3-fill", brand: "geocaching", label: "Geocaching" },
|
| 26 |
+
"gitlab.com": { icon: "ri-gitlab-fill", brand: "gitlab", label: "GitLab" },
|
| 27 |
+
"gitlab.gnome.org": { icon: "ri-code-box-fill", brand: "gnome", label: "GNOME GitLab" },
|
| 28 |
+
"giphy.com": { icon: "ri-image-2-fill", brand: "giphy", label: "Giphy" },
|
| 29 |
+
"habr.com": { icon: "ri-terminal-window-fill", brand: "habr", label: "Habr" },
|
| 30 |
+
"houzz.com": { icon: "ri-paint-brush-fill", brand: "houzz", label: "Houzz" },
|
| 31 |
+
"hudsonrock.com": { icon: "ri-shield-user-fill", brand: "hudsonrock", label: "HudsonRock" },
|
| 32 |
+
"imgur.com": { icon: "ri-image-fill", brand: "imgur", label: "Imgur" },
|
| 33 |
+
"instagram.com": { icon: "ri-instagram-fill", brand: "instagram", label: "Instagram" },
|
| 34 |
+
"interPals.net": { icon: "ri-user-heart-fill", brand: "interpals", label: "InterPals" },
|
| 35 |
+
"kaskus.co.id": { icon: "ri-chat-3-fill", brand: "kaskus", label: "Kaskus" },
|
| 36 |
+
"kick.com": { icon: "ri-game-fill", brand: "kick", label: "Kick" },
|
| 37 |
+
"last.fm": { icon: "ri-music-fill", brand: "lastfm", label: "Last.fm" },
|
| 38 |
+
"livelib.ru": { icon: "ri-book-read-fill", brand: "livelib", label: "LiveLib" },
|
| 39 |
+
"linkedin.com": { icon: "ri-linkedin-fill", brand: "linkedin", label: "LinkedIn" },
|
| 40 |
+
"mixcloud.com": { icon: "ri-cloud-fill", brand: "mixcloud", label: "MixCloud" },
|
| 41 |
+
"myanimelist.net": { icon: "ri-emotion-happy-fill", brand: "myanimelist", label: "MyAnimeList" },
|
| 42 |
+
"mydramalist.com": { icon: "ri-film-fill", brand: "dramalist", label: "MyDramaList" },
|
| 43 |
+
"myspace.com": { icon: "ri-user-2-fill", brand: "myspace", label: "MySpace" },
|
| 44 |
+
"omg.lol": { icon: "ri-earth-fill", brand: "omg", label: "OMG.lol" },
|
| 45 |
+
"osu.ppy.sh": { icon: "ri-circle-fill", brand: "osu", label: "osu!" },
|
| 46 |
+
"periscope.tv": { icon: "ri-eye-fill", brand: "periscope", label: "Periscope" },
|
| 47 |
+
"reddit.com": { icon: "ri-reddit-fill", brand: "reddit", label: "Reddit" },
|
| 48 |
+
"roblox.com": { icon: "ri-cube-fill", brand: "roblox", label: "Roblox" },
|
| 49 |
+
"rumble.com": { icon: "ri-volume-down-fill", brand: "rumble", label: "Rumble" },
|
| 50 |
+
"scribd.com": { icon: "ri-book-mark-fill", brand: "scribd", label: "Scribd" },
|
| 51 |
+
"slideshare.net": { icon: "ri-slideshow-2-fill", brand: "slideshare", label: "SlideShare" },
|
| 52 |
+
"smule.com": { icon: "ri-mic-fill", brand: "smule", label: "Smule" },
|
| 53 |
+
"snapchat.com": { icon: "ri-snapchat-fill", brand: "snapchat", label: "Snapchat" },
|
| 54 |
+
"soundcloud.com": { icon: "ri-soundcloud-fill", brand: "soundcloud", label: "SoundCloud" },
|
| 55 |
+
"sporcle.com": { icon: "ri-question-fill", brand: "sporcle", label: "Sporcle" },
|
| 56 |
+
"spotify.com": { icon: "ri-spotify-fill", brand: "spotify", label: "Spotify" },
|
| 57 |
+
"starcitizen.com": { icon: "ri-rocket-2-fill", brand: "starcitizen", label: "Star Citizen" },
|
| 58 |
+
"steamcommunity.com": { icon: "ri-steam-fill", brand: "steam", label: "Steam" },
|
| 59 |
+
"strava.com": { icon: "ri-run-fill", brand: "strava", label: "Strava" },
|
| 60 |
+
"telegram.org": { icon: "ri-telegram-fill", brand: "telegram", label: "Telegram" },
|
| 61 |
+
"threads.net": { icon: "ri-at-line", brand: "threads", label: "Threads" },
|
| 62 |
+
"torretgalaxy.to": { icon: "ri-cloud-download-fill", brand: "torrentgalaxy", label: "TorrentGalaxy" },
|
| 63 |
+
"trello.com": { icon: "ri-layout-grid-fill", brand: "trello", label: "Trello" },
|
| 64 |
+
"ultimate-guitar.com": { icon: "ri-guitar-fill", brand: "ultimate-guitar", label: "Ultimate Guitar" },
|
| 65 |
+
"venmo.com": { icon: "ri-bank-card-fill", brand: "venmo", label: "Venmo" },
|
| 66 |
+
"vk.com": { icon: "ri-vk-fill", brand: "vk", label: "VK" },
|
| 67 |
+
"vsco.co": { icon: "ri-camera-fill", brand: "vsco", label: "VSCO" },
|
| 68 |
+
"weblate.org": { icon: "ri-translate-2", brand: "weblate", label: "Weblate" },
|
| 69 |
+
"wikipedia.org": { icon: "ri-book-open-fill", brand: "wikipedia", label: "Wikipedia" },
|
| 70 |
+
"xboxgamertag.com": { icon: "ri-game-fill", brand: "xbox", label: "Xbox Gamertag" },
|
| 71 |
+
"youtube.com": { icon: "ri-youtube-fill", brand: "youtube", label: "YouTube" }
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
const INVALID_HTML_PATTERNS = [
|
| 75 |
+
"page not found", "pagina non trovata", "pagina non disponibile",
|
| 76 |
+
"we couldn't find", "sorry, this page isn't", "sign in", "log in", "login required",
|
| 77 |
+
"autenticati", "error 404", "not found", "torna alla home"
|
| 78 |
+
];
|
| 79 |
+
|
| 80 |
+
/* ---------------------------- STATE ---------------------------------------*/
|
| 81 |
+
const state = {
|
| 82 |
+
sherlockFinished: false,
|
| 83 |
+
pendingChecks: 0,
|
| 84 |
+
cardsCount: 0,
|
| 85 |
+
noResultTimer: null,
|
| 86 |
+
abortCtrl: null,
|
| 87 |
+
queue: [],
|
| 88 |
+
running: 0,
|
| 89 |
+
maxParallel: 5,
|
| 90 |
+
validCount: 0,
|
| 91 |
+
invalidCount: 0,
|
| 92 |
+
consoleVisible: false,
|
| 93 |
+
finishedFired: false
|
| 94 |
+
};
|
| 95 |
+
|
| 96 |
+
/* ---------------------------- DOM -----------------------------------------*/
|
| 97 |
+
const form = document.querySelector("#searchForm") || document.querySelector("#search-form");
|
| 98 |
+
const cardsContainer = document.querySelector("#cards") || document.querySelector("#cards-container");
|
| 99 |
+
const loadingOverlay = document.querySelector("#loading-overlay");
|
| 100 |
+
const loadingInline = document.querySelector("#loading-indicator");
|
| 101 |
+
const noResultsEl = document.querySelector("#no-results");
|
| 102 |
+
const consoleEl = document.querySelector("#console");
|
| 103 |
+
const dashboardEl = document.getElementById('dashboard');
|
| 104 |
+
const toggleConsoleBtn = document.getElementById('toggle-console');
|
| 105 |
+
const toggleDetailsBtn = document.getElementById('toggle-details');
|
| 106 |
+
const consoleContainer = document.getElementById('console-container');
|
| 107 |
+
|
| 108 |
+
/* counters */
|
| 109 |
+
const totalCountEl = document.getElementById('total-count');
|
| 110 |
+
const validCountEl = document.getElementById('valid-count');
|
| 111 |
+
const invalidCountEl = document.getElementById('invalid-count');
|
| 112 |
+
const pendingCountEl = document.getElementById('pending-count');
|
| 113 |
+
|
| 114 |
+
/* progress (se li usi) */
|
| 115 |
+
const verifyBox = document.querySelector("#verify-progress");
|
| 116 |
+
const vpDone = document.querySelector("#vp-done");
|
| 117 |
+
const vpTotal = document.querySelector("#vp-total");
|
| 118 |
+
|
| 119 |
+
/* ---------------------------- UTILS ---------------------------------------*/
|
| 120 |
+
const htmlEscape = s =>
|
| 121 |
+
(s ?? "").replace(/[&<>"']/g, m =>
|
| 122 |
+
({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[m])
|
| 123 |
+
);
|
| 124 |
+
|
| 125 |
+
function resolvePlatform(host) {
|
| 126 |
+
const key = Object.keys(PLATFORM).find(d => host.endsWith(d));
|
| 127 |
+
if (key) return PLATFORM[key];
|
| 128 |
+
return { icon: "ri-link-m", brand: "generic", label: host.replace(/^www\./, "") };
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
function parseHost(url) { try { return new URL(url).hostname.toLowerCase(); } catch { return ""; } }
|
| 132 |
+
|
| 133 |
+
function show(el) { el && el.classList.remove('hidden'); }
|
| 134 |
+
function hide(el) { el && el.classList.add('hidden'); }
|
| 135 |
+
|
| 136 |
+
function appendConsoleLine(text) {
|
| 137 |
+
if (!consoleEl) return;
|
| 138 |
+
consoleEl.textContent += text + "\n";
|
| 139 |
+
consoleEl.scrollTop = consoleEl.scrollHeight;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
function showLoading(on) {
|
| 143 |
+
if (loadingOverlay) {
|
| 144 |
+
loadingOverlay.classList.toggle('hidden', !on);
|
| 145 |
+
} else if (loadingInline) {
|
| 146 |
+
loadingInline.classList.toggle('hidden', !on);
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
function updateDashboard() {
|
| 151 |
+
totalCountEl.textContent = state.cardsCount;
|
| 152 |
+
validCountEl.textContent = state.validCount;
|
| 153 |
+
invalidCountEl.textContent = state.invalidCount;
|
| 154 |
+
pendingCountEl.textContent = state.pendingChecks;
|
| 155 |
+
if (state.cardsCount > 0 || state.pendingChecks > 0) {
|
| 156 |
+
show(dashboardEl);
|
| 157 |
+
} else {
|
| 158 |
+
hide(dashboardEl);
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
function startVerification(total) {
|
| 163 |
+
if (!verifyBox) return;
|
| 164 |
+
vpTotal.textContent = total;
|
| 165 |
+
vpDone.textContent = 0;
|
| 166 |
+
verifyBox.classList.remove("hidden");
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
function tickVerification() {
|
| 170 |
+
if (!verifyBox) return;
|
| 171 |
+
vpDone.textContent = Number(vpDone.textContent) + 1;
|
| 172 |
+
if (vpDone.textContent === vpTotal.textContent) {
|
| 173 |
+
verifyBox.classList.add('hidden');
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
function cssEscape(str) { return str.replace(/(["'\\])/g, "\\$1"); }
|
| 178 |
+
|
| 179 |
+
/* ---------------------------- STREAM --------------------------------------*/
|
| 180 |
+
let evtSource = null;
|
| 181 |
+
function startStream(params) {
|
| 182 |
+
stopStream();
|
| 183 |
+
const q = new URLSearchParams(params).toString();
|
| 184 |
+
evtSource = new EventSource(`/api/search-stream?${q}`);
|
| 185 |
+
showLoading(true);
|
| 186 |
+
|
| 187 |
+
evtSource.onmessage = e => {
|
| 188 |
+
const line = e.data;
|
| 189 |
+
if (!line) return;
|
| 190 |
+
appendConsoleLine(line);
|
| 191 |
+
|
| 192 |
+
// end signals
|
| 193 |
+
if (
|
| 194 |
+
line.includes("__SHERLOCK_DONE__") ||
|
| 195 |
+
line.includes('"done":true') ||
|
| 196 |
+
line.includes("✅ sherlock terminato") ||
|
| 197 |
+
line.startsWith("🎉 Ricerca terminata")
|
| 198 |
+
) {
|
| 199 |
+
state.sherlockFinished = true;
|
| 200 |
+
finalizeIfDone();
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
// JSON payload finale
|
| 204 |
+
if (line.startsWith('{')) {
|
| 205 |
+
try {
|
| 206 |
+
const obj = JSON.parse(line);
|
| 207 |
+
if (obj?.result?.links?.length) {
|
| 208 |
+
addCards(obj.result.links);
|
| 209 |
+
}
|
| 210 |
+
} catch {/* ignore */ }
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// "🔗 url ✅ (reason)"
|
| 214 |
+
if (line.startsWith('🔗 ')) {
|
| 215 |
+
const m = line.match(/^🔗\s+(\S+)\s+(✅|❌)\s+\((.+)\)$/);
|
| 216 |
+
if (m) {
|
| 217 |
+
const url = m[1];
|
| 218 |
+
const ok = m[2] === '✅';
|
| 219 |
+
const reason = m[3];
|
| 220 |
+
|
| 221 |
+
if (!cardsContainer.querySelector(`article[data-url="${CSS.escape(url)}"]`)) {
|
| 222 |
+
state.cardsCount++;
|
| 223 |
+
cardsContainer.appendChild(makeCard({ url }));
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
if (ok) {
|
| 227 |
+
state.validCount++;
|
| 228 |
+
setStatus(url, 'valid', reason);
|
| 229 |
+
} else {
|
| 230 |
+
state.invalidCount++;
|
| 231 |
+
setStatus(url, 'invalid', reason);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
updateDashboard();
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
};
|
| 238 |
+
|
| 239 |
+
evtSource.onerror = () => {
|
| 240 |
+
appendConsoleLine("❌ Stream interrotto.");
|
| 241 |
+
state.sherlockFinished = true;
|
| 242 |
+
finalizeIfDone();
|
| 243 |
+
stopStream();
|
| 244 |
+
};
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
function stopStream() {
|
| 248 |
+
if (evtSource) { evtSource.close(); evtSource = null; }
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/* ------------------------- LINK CHECK QUEUE -------------------------------*/
|
| 252 |
+
function enqueueVerification(url) {
|
| 253 |
+
state.queue.push(url);
|
| 254 |
+
pumpQueue();
|
| 255 |
+
updateDashboard();
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
function pumpQueue() {
|
| 259 |
+
while (state.running < state.maxParallel && state.queue.length) {
|
| 260 |
+
const url = state.queue.shift();
|
| 261 |
+
state.running++;
|
| 262 |
+
state.pendingChecks++;
|
| 263 |
+
updateDashboard();
|
| 264 |
+
|
| 265 |
+
verifyLink(url, state.abortCtrl?.signal)
|
| 266 |
+
.catch(() => null)
|
| 267 |
+
.then(res => updateCard(url, res))
|
| 268 |
+
.finally(() => {
|
| 269 |
+
state.running--;
|
| 270 |
+
state.pendingChecks--;
|
| 271 |
+
tickVerification();
|
| 272 |
+
finalizeIfDone();
|
| 273 |
+
pumpQueue();
|
| 274 |
+
});
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
async function verifyLink(url, signal) {
|
| 279 |
+
if (!url) return null;
|
| 280 |
+
try {
|
| 281 |
+
const res = await fetch("/api/link-check", {
|
| 282 |
+
method: "POST",
|
| 283 |
+
headers: { "Content-Type": "application/json" },
|
| 284 |
+
body: JSON.stringify({ url }),
|
| 285 |
+
signal
|
| 286 |
+
});
|
| 287 |
+
if (!res.ok) return null;
|
| 288 |
+
return await res.json();
|
| 289 |
+
} catch {
|
| 290 |
+
return null;
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
/* ----------------------------- CARDS --------------------------------------*/
|
| 295 |
+
function makeCard({ url }) {
|
| 296 |
+
if (!url) return null;
|
| 297 |
+
const host = parseHost(url);
|
| 298 |
+
const { icon, brand, label } = resolvePlatform(host);
|
| 299 |
+
|
| 300 |
+
const card = document.createElement("article");
|
| 301 |
+
card.className = "profile-card fade-in";
|
| 302 |
+
card.dataset.url = url;
|
| 303 |
+
|
| 304 |
+
const iconHTML = `<i class="${icon}"></i>`;
|
| 305 |
+
card.innerHTML = `
|
| 306 |
+
<div class="card-header">
|
| 307 |
+
<div class="platform-icon ${brand}">${iconHTML}</div>
|
| 308 |
+
<div class="platform-info">
|
| 309 |
+
<h3>${htmlEscape(label)}</h3>
|
| 310 |
+
<p class="truncate">${htmlEscape(url)}</p>
|
| 311 |
+
<div class="verification-status status-badge pending" data-state="pending">PENDING</div>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
<div class="card-body">
|
| 315 |
+
<a class="btn disabled pointer-events-none opacity-60" href="javascript:void(0)">Verifica in corso...</a>
|
| 316 |
+
</div>
|
| 317 |
+
`;
|
| 318 |
+
return card;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
function updateCard(url, res) {
|
| 322 |
+
const card = cardsContainer.querySelector(`article[data-url="${cssEscape(url)}"]`);
|
| 323 |
+
if (!card) return;
|
| 324 |
+
|
| 325 |
+
const statusEl = card.querySelector(".verification-status");
|
| 326 |
+
const btn = card.querySelector(".btn");
|
| 327 |
+
|
| 328 |
+
if (!res) {
|
| 329 |
+
statusEl.className = "verification-status validation-badge unknown";
|
| 330 |
+
statusEl.textContent = "⚠️ Verifica non riuscita";
|
| 331 |
+
if (btn) {
|
| 332 |
+
btn.textContent = "Apri comunque";
|
| 333 |
+
btn.classList.remove('disabled', 'pointer-events-none', 'opacity-60');
|
| 334 |
+
btn.href = url;
|
| 335 |
+
}
|
| 336 |
+
return;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
if (res.valid) {
|
| 340 |
+
statusEl.className = "verification-status validation-badge valid";
|
| 341 |
+
statusEl.innerHTML = `✅ Pagina verificata${res.reason ? `<small class="reason"> (${htmlEscape(res.reason)})</small>` : ""}`;
|
| 342 |
+
if (btn) {
|
| 343 |
+
btn.textContent = "Visita";
|
| 344 |
+
btn.classList.remove('disabled', 'pointer-events-none', 'opacity-60');
|
| 345 |
+
btn.href = url;
|
| 346 |
+
}
|
| 347 |
+
state.validCount++;
|
| 348 |
+
} else {
|
| 349 |
+
statusEl.className = "verification-status validation-badge invalid";
|
| 350 |
+
statusEl.innerHTML = `⚠️ Pagina non valida${res.reason ? `<small class="reason"> (${htmlEscape(res.reason)})</small>` : ""}`;
|
| 351 |
+
btn?.remove();
|
| 352 |
+
state.invalidCount++;
|
| 353 |
+
}
|
| 354 |
+
updateDashboard();
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
function setStatus(url, status, reason = '') {
|
| 358 |
+
const card = cardsContainer.querySelector(`article[data-url="${cssEscape(url)}"]`);
|
| 359 |
+
if (!card) return;
|
| 360 |
+
const statusEl = card.querySelector(".verification-status");
|
| 361 |
+
const btn = card.querySelector(".btn");
|
| 362 |
+
|
| 363 |
+
if (status === 'valid') {
|
| 364 |
+
statusEl.className = "verification-status status-badge valid";
|
| 365 |
+
statusEl.innerHTML = `✅ Pagina verificata${reason ? `<small class="reason"> (${htmlEscape(reason)})</small>` : ""}`;
|
| 366 |
+
if (btn) {
|
| 367 |
+
btn.textContent = "Visita";
|
| 368 |
+
btn.classList.remove('disabled', 'pointer-events-none', 'opacity-60');
|
| 369 |
+
btn.href = card.dataset.url;
|
| 370 |
+
}
|
| 371 |
+
} else {
|
| 372 |
+
statusEl.className = "verification-status status-badge invalid";
|
| 373 |
+
statusEl.innerHTML = `⚠️ Pagina non valida${reason ? `<small class="reason"> (${htmlEscape(reason)})</small>` : ""}`;
|
| 374 |
+
btn?.remove();
|
| 375 |
+
}
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
/* ------------------------- ADD & FINALIZE ---------------------------------*/
|
| 379 |
+
function addCards(links) {
|
| 380 |
+
if (!links?.length) return;
|
| 381 |
+
|
| 382 |
+
if (state.pendingChecks === 0 && state.queue.length === 0) {
|
| 383 |
+
startVerification(links.length);
|
| 384 |
+
} else if (verifyBox && vpTotal) {
|
| 385 |
+
vpTotal.textContent = Number(vpTotal.textContent) + links.length;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
hide(noResultsEl);
|
| 389 |
+
const frag = document.createDocumentFragment();
|
| 390 |
+
links.forEach(url => {
|
| 391 |
+
if (cardsContainer.querySelector(`article[data-url="${cssEscape(url)}"]`)) return;
|
| 392 |
+
const c = makeCard({ url });
|
| 393 |
+
if (c) {
|
| 394 |
+
frag.appendChild(c);
|
| 395 |
+
state.cardsCount++;
|
| 396 |
+
enqueueVerification(url);
|
| 397 |
+
}
|
| 398 |
+
});
|
| 399 |
+
cardsContainer.appendChild(frag);
|
| 400 |
+
updateDashboard();
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
function finalizeIfDone() {
|
| 404 |
+
// overlay off solo quando TUTTO è finito
|
| 405 |
+
const done = state.sherlockFinished && state.pendingChecks === 0 && state.queue.length === 0 && state.running === 0;
|
| 406 |
+
if (!done) return;
|
| 407 |
+
if (state.finishedFired) return;
|
| 408 |
+
state.finishedFired = true;
|
| 409 |
+
|
| 410 |
+
showLoading(false);
|
| 411 |
+
if (state.cardsCount === 0) {
|
| 412 |
+
show(noResultsEl);
|
| 413 |
+
}
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
/* ---------------------------- RESET ---------------------------------------*/
|
| 417 |
+
function fullResetUI() {
|
| 418 |
+
stopStream();
|
| 419 |
+
state.abortCtrl?.abort();
|
| 420 |
+
|
| 421 |
+
consoleEl && (consoleEl.textContent = "");
|
| 422 |
+
hide(noResultsEl);
|
| 423 |
+
cardsContainer && (cardsContainer.innerHTML = "");
|
| 424 |
+
hide(verifyBox);
|
| 425 |
+
if (vpDone) vpDone.textContent = "0";
|
| 426 |
+
if (vpTotal) vpTotal.textContent = "0";
|
| 427 |
+
|
| 428 |
+
state.sherlockFinished = false;
|
| 429 |
+
state.pendingChecks = 0;
|
| 430 |
+
state.cardsCount = 0;
|
| 431 |
+
state.noResultTimer = null;
|
| 432 |
+
state.abortCtrl = null;
|
| 433 |
+
state.queue = [];
|
| 434 |
+
state.running = 0;
|
| 435 |
+
state.validCount = 0;
|
| 436 |
+
state.invalidCount = 0;
|
| 437 |
+
state.consoleVisible = false;
|
| 438 |
+
state.finishedFired = false;
|
| 439 |
+
|
| 440 |
+
hide(dashboardEl);
|
| 441 |
+
hide(consoleContainer);
|
| 442 |
+
toggleConsoleBtn.textContent = 'Mostra console';
|
| 443 |
+
toggleDetailsBtn.textContent = 'Mostra dettagli';
|
| 444 |
+
cardsContainer.classList.add('details-hidden');
|
| 445 |
+
|
| 446 |
+
showLoading(false);
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
/* ---------------------------- EVENTS --------------------------------------*/
|
| 450 |
+
form?.addEventListener("submit", async e => {
|
| 451 |
+
e.preventDefault();
|
| 452 |
+
const nome = (form.nome ? form.nome.value : form.query.value).trim();
|
| 453 |
+
const cognome = (form.cognome ? form.cognome.value : "").trim();
|
| 454 |
+
if (!nome && !cognome) return;
|
| 455 |
+
|
| 456 |
+
fullResetUI();
|
| 457 |
+
state.abortCtrl = new AbortController();
|
| 458 |
+
|
| 459 |
+
appendConsoleLine(`[${new Date().toLocaleTimeString()}] Avvio ricerca per: ${nome} ${cognome}`);
|
| 460 |
+
|
| 461 |
+
startStream({ nome, cognome });
|
| 462 |
+
|
| 463 |
+
// eventuale fetch /api/search (se vuoi ancora usarlo)
|
| 464 |
+
const data = await safeFetchJSON(`/api/search?nome=${encodeURIComponent(nome)}&cognome=${encodeURIComponent(cognome)}`, state.abortCtrl.signal);
|
| 465 |
+
if (data?.links?.length) {
|
| 466 |
+
addCards(data.links);
|
| 467 |
+
}
|
| 468 |
+
});
|
| 469 |
+
|
| 470 |
+
toggleConsoleBtn?.addEventListener('click', () => {
|
| 471 |
+
state.consoleVisible = !state.consoleVisible;
|
| 472 |
+
if (state.consoleVisible) {
|
| 473 |
+
show(consoleContainer);
|
| 474 |
+
toggleConsoleBtn.textContent = 'Nascondi console';
|
| 475 |
+
} else {
|
| 476 |
+
hide(consoleContainer);
|
| 477 |
+
toggleConsoleBtn.textContent = 'Mostra console';
|
| 478 |
+
}
|
| 479 |
+
});
|
| 480 |
+
|
| 481 |
+
window.addEventListener("beforeunload", stopStream);
|
| 482 |
+
window.addEventListener("keydown", e => {
|
| 483 |
+
if (e.key === "Escape" && state.abortCtrl) {
|
| 484 |
+
state.abortCtrl.abort();
|
| 485 |
+
stopStream();
|
| 486 |
+
showLoading(false);
|
| 487 |
+
appendConsoleLine(`[${new Date().toLocaleTimeString()}] Ricerca interrotta.`);
|
| 488 |
+
}
|
| 489 |
+
});
|
| 490 |
+
|
| 491 |
+
/* -------------------------- SAFE FETCH JSON -------------------------------*/
|
| 492 |
+
async function safeFetchJSON(url, signal) {
|
| 493 |
+
try {
|
| 494 |
+
const res = await fetch(url, { signal });
|
| 495 |
+
if (!res.ok) return null;
|
| 496 |
+
return await res.json();
|
| 497 |
+
} catch {
|
| 498 |
+
return null;
|
| 499 |
+
}
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
/* ------------------------- TOGGLE DETAILS (GLOBAL) -----------------------*/
|
| 503 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 504 |
+
const cardsWrapper = document.getElementById('cards') || document.getElementById('cards-container');
|
| 505 |
+
const toggleDetailsBtn = document.getElementById('toggle-details');
|
| 506 |
+
|
| 507 |
+
if (!cardsWrapper || !toggleDetailsBtn) return;
|
| 508 |
+
|
| 509 |
+
// Funzione per aggiornare l'etichetta del pulsante
|
| 510 |
+
const updateToggleBtnLabel = () => {
|
| 511 |
+
const hidden = cardsWrapper.classList.contains('details-hidden');
|
| 512 |
+
toggleDetailsBtn.textContent = hidden ? 'Mostra dettagli' : 'Nascondi dettagli';
|
| 513 |
+
};
|
| 514 |
+
|
| 515 |
+
// Toggle globale dei dettagli
|
| 516 |
+
toggleDetailsBtn.addEventListener('click', () => {
|
| 517 |
+
cardsWrapper.classList.toggle('details-hidden');
|
| 518 |
+
updateToggleBtnLabel();
|
| 519 |
+
});
|
| 520 |
+
|
| 521 |
+
// Mostra il pulsante solo se ci sono card
|
| 522 |
+
const showToggleIfCards = () => {
|
| 523 |
+
const hasCards = cardsWrapper.children.length > 0;
|
| 524 |
+
toggleDetailsBtn.classList.toggle('hidden', !hasCards);
|
| 525 |
+
};
|
| 526 |
+
|
| 527 |
+
// Osserva aggiunte/rimozioni di card
|
| 528 |
+
const observer = new MutationObserver(showToggleIfCards);
|
| 529 |
+
observer.observe(cardsWrapper, { childList: true });
|
| 530 |
+
|
| 531 |
+
// Inizializza UI
|
| 532 |
+
showToggleIfCards();
|
| 533 |
+
updateToggleBtnLabel();
|
| 534 |
+
cardsWrapper.classList.add('details-hidden'); // Dettagli nascosti di default
|
| 535 |
+
});
|
| 536 |
+
|
| 537 |
+
// Inizializza UI al caricamento
|
| 538 |
+
document.addEventListener('DOMContentLoaded', fullResetUI);
|
Social-Finder/backend/templates/disclaimer.html
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="it">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<meta name="robots" content="noindex,nofollow" />
|
| 7 |
+
<title>Disclaimer — Progetto Studentesco</title>
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--bg: #0b1020;
|
| 11 |
+
--card: #0e1530;
|
| 12 |
+
--text: #e6e8ef;
|
| 13 |
+
--muted: #b5bed0;
|
| 14 |
+
--accent: #7aa2ff;
|
| 15 |
+
--line: #223055;
|
| 16 |
+
}
|
| 17 |
+
@media (prefers-color-scheme: light) {
|
| 18 |
+
:root {
|
| 19 |
+
--bg: #f7f8fb;
|
| 20 |
+
--card: #ffffff;
|
| 21 |
+
--text: #111827;
|
| 22 |
+
--muted: #4b5563;
|
| 23 |
+
--accent: #2563eb;
|
| 24 |
+
--line: #e5e7eb;
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
body {
|
| 28 |
+
margin: 0;
|
| 29 |
+
background: var(--bg);
|
| 30 |
+
color: var(--text);
|
| 31 |
+
font: 16px/1.6 system-ui, sans-serif;
|
| 32 |
+
}
|
| 33 |
+
.container {
|
| 34 |
+
max-width: 920px;
|
| 35 |
+
margin: 0 auto;
|
| 36 |
+
padding: 28px 18px 48px;
|
| 37 |
+
}
|
| 38 |
+
.card {
|
| 39 |
+
background: var(--card);
|
| 40 |
+
border: 1px solid var(--line);
|
| 41 |
+
border-radius: 18px;
|
| 42 |
+
padding: 26px;
|
| 43 |
+
}
|
| 44 |
+
h1 {
|
| 45 |
+
margin-top: 0;
|
| 46 |
+
}
|
| 47 |
+
a {
|
| 48 |
+
color: var(--accent);
|
| 49 |
+
}
|
| 50 |
+
nav.top {
|
| 51 |
+
display: flex;
|
| 52 |
+
justify-content: space-between;
|
| 53 |
+
align-items: center;
|
| 54 |
+
margin-bottom: 18px;
|
| 55 |
+
}
|
| 56 |
+
.badge {
|
| 57 |
+
padding: 0.3rem 0.6rem;
|
| 58 |
+
border: 1px solid var(--line);
|
| 59 |
+
border-radius: 999px;
|
| 60 |
+
font-size: 0.85rem;
|
| 61 |
+
color: var(--muted);
|
| 62 |
+
}
|
| 63 |
+
.nav-btn {
|
| 64 |
+
margin-left: 10px;
|
| 65 |
+
color: var(--accent);
|
| 66 |
+
text-decoration: none;
|
| 67 |
+
}
|
| 68 |
+
.nav-btn:hover {
|
| 69 |
+
text-decoration: underline;
|
| 70 |
+
}
|
| 71 |
+
footer {
|
| 72 |
+
margin-top: 28px;
|
| 73 |
+
font-size: 0.9rem;
|
| 74 |
+
color: var(--muted);
|
| 75 |
+
}
|
| 76 |
+
</style>
|
| 77 |
+
</head>
|
| 78 |
+
<body>
|
| 79 |
+
<div class="container">
|
| 80 |
+
<nav class="top">
|
| 81 |
+
<span class="badge">🎓 Progetto studentesco</span>
|
| 82 |
+
<div class="links">
|
| 83 |
+
<a class="nav-btn" href="privacy" target="_blank" rel="noopener noreferrer">Privacy</a>
|
| 84 |
+
<a class="nav-btn" href="/" target="_blank" rel="noopener noreferrer">Home</a>
|
| 85 |
+
</div>
|
| 86 |
+
</nav>
|
| 87 |
+
|
| 88 |
+
<article class="card">
|
| 89 |
+
<h1>Disclaimer</h1>
|
| 90 |
+
<p>
|
| 91 |
+
<strong>Progetto studentesco dimostrativo</strong>, creato a scopo didattico e senza fini commerciali. I contenuti sono forniti "così come sono" senza garanzie.
|
| 92 |
+
</p>
|
| 93 |
+
|
| 94 |
+
<h2>Marchi</h2>
|
| 95 |
+
<p>I marchi citati appartengono ai rispettivi proprietari. Non esiste alcuna affiliazione o approvazione.</p>
|
| 96 |
+
|
| 97 |
+
<h2>Uso</h2>
|
| 98 |
+
<p>È vietato il riutilizzo dei contenuti per scopi commerciali. L’uso è limitato a consultazione e studio.</p>
|
| 99 |
+
|
| 100 |
+
<h2>Contatti</h2>
|
| 101 |
+
<p>
|
| 102 |
+
Per segnalazioni scrivi a <a href="mailto:pastimattia772@gmail.com">pastimattia772@gmail.com</a>.
|
| 103 |
+
</p>
|
| 104 |
+
|
| 105 |
+
<footer>
|
| 106 |
+
<p>
|
| 107 |
+
© <span id="y"></span> — Progetto Studentesco • <a href="privacy" target="_blank">Privacy</a>
|
| 108 |
+
</p>
|
| 109 |
+
</footer>
|
| 110 |
+
</article>
|
| 111 |
+
</div>
|
| 112 |
+
<script>
|
| 113 |
+
document.getElementById('y').textContent = new Date().getFullYear()
|
| 114 |
+
</script>
|
| 115 |
+
</body>
|
| 116 |
+
</html>
|
Social-Finder/backend/templates/index.html
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="it">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Social Finder –</title>
|
| 7 |
+
|
| 8 |
+
<!-- Tailwind -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
|
| 11 |
+
<!-- Remix Icon -->
|
| 12 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@4.1.0/fonts/remixicon.css" />
|
| 13 |
+
|
| 14 |
+
<!-- CSS custom -->
|
| 15 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}" />
|
| 16 |
+
|
| 17 |
+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔍</text></svg>" />
|
| 18 |
+
</head>
|
| 19 |
+
|
| 20 |
+
<body class="min-h-screen bg-gradient-to-br from-slate-100 to-slate-200 flex flex-col items-center py-8 px-4 sm:px-6">
|
| 21 |
+
<!-- HEADER -->
|
| 22 |
+
<header class="text-center mb-8 max-w-3xl">
|
| 23 |
+
<h1 class="text-4xl sm:text-5xl font-extrabold bg-gradient-to-r from-indigo-500 via-purple-500 to-fuchsia-500 bg-clip-text text-transparent">Social Finder <span class="text-indigo-600">•</span> Open Version</h1>
|
| 24 |
+
<p class="mt-2 text-slate-600 text-lg">Ricerca informazioni sui social media in tempo reale</p>
|
| 25 |
+
</header>
|
| 26 |
+
|
| 27 |
+
<!-- MAIN -->
|
| 28 |
+
<main class="w-full max-w-5xl flex flex-col gap-8">
|
| 29 |
+
<!-- SEARCH CARD -->
|
| 30 |
+
<section class="bg-white/90 backdrop-blur-md rounded-2xl shadow-lg px-6 py-8">
|
| 31 |
+
<form id="searchForm" class="grid sm:grid-cols-3 gap-4 sm:gap-6 items-end">
|
| 32 |
+
<div>
|
| 33 |
+
<label for="nome" class="block font-medium text-slate-700 mb-1">Nome</label>
|
| 34 |
+
<input type="text" id="nome" name="nome" required placeholder="Mario" class="w-full rounded-xl border-2 border-slate-200 px-4 py-2.5 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 transition" />
|
| 35 |
+
</div>
|
| 36 |
+
<div>
|
| 37 |
+
<label for="cognome" class="block font-medium text-slate-700 mb-1">Cognome</label>
|
| 38 |
+
<input type="text" id="cognome" name="cognome" required placeholder="Rossi" class="w-full rounded-xl border-2 border-slate-200 px-4 py-2.5 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-100 transition" />
|
| 39 |
+
</div>
|
| 40 |
+
<button type="submit" class="inline-flex justify-center items-center gap-2 rounded-xl w-full bg-indigo-500 hover:bg-indigo-600 text-white font-semibold py-3 transition active:scale-95">
|
| 41 |
+
<i class="ri-search-line text-lg"></i>
|
| 42 |
+
Cerca
|
| 43 |
+
</button>
|
| 44 |
+
</form>
|
| 45 |
+
</section>
|
| 46 |
+
|
| 47 |
+
<!-- DASHBOARD -->
|
| 48 |
+
<section id="dashboard" class="hidden bg-white/90 backdrop-blur-md rounded-2xl shadow-lg px-6 py-4">
|
| 49 |
+
<div class="flex flex-wrap justify-between items-center gap-3">
|
| 50 |
+
<div class="flex flex-wrap items-center gap-4 text-sm sm:text-base">
|
| 51 |
+
<span class="text-slate-700">Totale: <span id="total-count">0</span></span>
|
| 52 |
+
<span class="text-green-600">Valide: <span id="valid-count">0</span></span>
|
| 53 |
+
<span class="text-red-600">Non valide: <span id="invalid-count">0</span></span>
|
| 54 |
+
<span class="text-slate-500">In corso: <span id="pending-count">0</span></span>
|
| 55 |
+
</div>
|
| 56 |
+
<div class="flex items-center gap-2">
|
| 57 |
+
<button id="toggle-console" class="text-sm bg-indigo-100 hover:bg-indigo-200 px-3 py-1 rounded-lg transition">Mostra console</button>
|
| 58 |
+
<button id="toggle-details" class="hidden text-sm bg-slate-100 hover:bg-slate-200 px-3 py-1 rounded-lg transition">Mostra dettagli</button>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
</section>
|
| 62 |
+
|
| 63 |
+
<!-- CONSOLE + RESULTS -->
|
| 64 |
+
<section class="flex flex-col gap-8">
|
| 65 |
+
<!-- CONSOLE -->
|
| 66 |
+
<div id="console-container" class="hidden w-full flex flex-col bg-slate-900/95 text-green-300 rounded-2xl shadow-lg">
|
| 67 |
+
<div class="flex justify-between px-6 py-3 font-semibold text-green-200 border-b border-slate-700 text-sm">
|
| 68 |
+
<span>Console Live</span><span>▼ Streaming</span>
|
| 69 |
+
</div>
|
| 70 |
+
<pre id="console" class="px-6 py-4 h-80 overflow-y-auto font-mono text-sm leading-relaxed"></pre>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<!-- RESULTS WRAPPER -->
|
| 74 |
+
<div class="w-full flex flex-col">
|
| 75 |
+
<!-- INLINE LOADER (fallback) -->
|
| 76 |
+
<div id="loading-indicator" class="hidden flex flex-col items-center gap-4 py-12">
|
| 77 |
+
<div class="loading-spinner"></div>
|
| 78 |
+
<p class="text-slate-600 font-medium">Analisi in corso…</p>
|
| 79 |
+
</div>
|
| 80 |
+
|
| 81 |
+
<!-- NO RESULTS -->
|
| 82 |
+
<!-- <div id="no-results"
|
| 83 |
+
class="hidden text-center bg-white/80 rounded-xl shadow px-8 py-12 flex flex-col items-center gap-4">
|
| 84 |
+
<i class="ri-search-eye-line text-5xl text-slate-400"></i>
|
| 85 |
+
<h4 class="text-xl font-semibold">Nessun profilo trovato</h4>
|
| 86 |
+
<p class="text-slate-600">Prova un nome diverso o verifica i dati inseriti</p>
|
| 87 |
+
</div> -->
|
| 88 |
+
|
| 89 |
+
<!-- CARDS GRID -->
|
| 90 |
+
<section id="cards" class="results-container"></section>
|
| 91 |
+
</div>
|
| 92 |
+
</section>
|
| 93 |
+
</main>
|
| 94 |
+
|
| 95 |
+
<!-- OVERLAY LOADER FULLSCREEN -->
|
| 96 |
+
<div id="loading-overlay" class="hidden fixed inset-0 z-[9999] bg-white/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4">
|
| 97 |
+
<div class="spinner-xl"></div>
|
| 98 |
+
<p class="text-slate-700 font-medium text-lg">Elaborazione in corso…</p>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<!-- DISCLAIMER BANNER – Student Project -->
|
| 102 |
+
<div id="edu-banner" hidden class="fixed top-0 inset-x-0 z-50">
|
| 103 |
+
<div class="mx-auto max-w-screen-xl">
|
| 104 |
+
<div class="m-3 rounded-2xl shadow-lg border bg-white/95 backdrop-blur p-4 md:p-5">
|
| 105 |
+
<div class="flex items-start gap-3">
|
| 106 |
+
<div class="shrink-0 mt-0.5">
|
| 107 |
+
<!-- Icona semplice -->
|
| 108 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" class="opacity-80">
|
| 109 |
+
<circle cx="12" cy="12" r="10" stroke-width="1.5"></circle>
|
| 110 |
+
<line x1="12" y1="8" x2="12" y2="13" stroke-width="1.5"></line>
|
| 111 |
+
<circle cx="12" cy="16.5" r="1" stroke-width="1.5"></circle>
|
| 112 |
+
</svg>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<div class="grow">
|
| 116 |
+
<p class="font-semibold">Progetto studentesco — solo dimostrazione</p>
|
| 117 |
+
<p class="text-sm leading-5 mt-1">
|
| 118 |
+
Questo sito è un <strong>prototipo a scopo didattico</strong>, senza fini commerciali. È fornito “così com’è”, senza garanzie; i marchi citati appartengono ai rispettivi proprietari e <strong>non esiste alcuna affiliazione</strong>. I contenuti potrebbero essere incompleti o imprecisi. Se qualcosa ti riguarda e vuoi la rimozione, contattami.
|
| 119 |
+
</p>
|
| 120 |
+
<div class="flex flex-wrap justify-center gap-2 mt-3 w-full">
|
| 121 |
+
<a href="/disclaimer" target="_blank" rel="noopener noreferrer" class="underline text-sm text-center flex-1">Leggi il disclaimer</a>
|
| 122 |
+
<a href="/privacy" target="_blank" rel="noopener noreferrer" class="underline text-sm text-center flex-1">Privacy</a>
|
| 123 |
+
<a href="https://www.linkedin.com/in/mattia-pasti-68a91a178" target="_blank" rel="noopener noreferrer" class="underline text-sm text-center flex-1">Guarda il mio curriculum</a>
|
| 124 |
+
<a href="https://github.com/MattiaPasti" target="_blank" rel="noopener noreferrer" class="underline text-sm text-center flex-1">Guarda altri progetti</a>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
|
| 128 |
+
<button type="button" data-close class="ml-2 rounded-lg px-3 py-2 text-sm border hover:bg-gray-50" aria-label="Chiudi banner">OK</button>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<script>
|
| 135 |
+
;(function () {
|
| 136 |
+
const KEY = 'eduBannerAck'
|
| 137 |
+
|
| 138 |
+
// Legge stato: "accepted", "rejected" o null
|
| 139 |
+
function getStatus() {
|
| 140 |
+
try {
|
| 141 |
+
return JSON.parse(localStorage.getItem(KEY))?.status || null
|
| 142 |
+
} catch {
|
| 143 |
+
return null
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
function setStatus(status) {
|
| 148 |
+
try {
|
| 149 |
+
localStorage.setItem(KEY, JSON.stringify({ status }))
|
| 150 |
+
} catch {}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 154 |
+
const banner = document.getElementById('edu-banner')
|
| 155 |
+
if (!banner) return
|
| 156 |
+
|
| 157 |
+
const status = getStatus()
|
| 158 |
+
|
| 159 |
+
// Se non accettato => mostra banner
|
| 160 |
+
if (status !== 'accepted') {
|
| 161 |
+
banner.hidden = false
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
// Bottone OK (accetta)
|
| 165 |
+
const okBtn = banner.querySelector('[data-close]')
|
| 166 |
+
if (okBtn) {
|
| 167 |
+
okBtn.addEventListener('click', () => {
|
| 168 |
+
setStatus('accepted')
|
| 169 |
+
banner.remove()
|
| 170 |
+
})
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
// ESC chiude senza accettare → rimarrà non accettato e quindi riapparirà
|
| 174 |
+
banner.addEventListener('keydown', (e) => {
|
| 175 |
+
if (e.key === 'Escape') {
|
| 176 |
+
banner.remove()
|
| 177 |
+
}
|
| 178 |
+
})
|
| 179 |
+
})
|
| 180 |
+
})()
|
| 181 |
+
</script>
|
| 182 |
+
|
| 183 |
+
<!-- JS -->
|
| 184 |
+
<script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
|
| 185 |
+
</body>
|
| 186 |
+
</html>
|
Social-Finder/backend/templates/privacy.html
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="it">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<meta name="robots" content="noindex,nofollow" />
|
| 7 |
+
<title>Informativa Privacy — Progetto Studentesco</title>
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--bg: #0b1020;
|
| 11 |
+
--card: #0e1530;
|
| 12 |
+
--text: #e6e8ef;
|
| 13 |
+
--muted: #b5bed0;
|
| 14 |
+
--accent: #7aa2ff;
|
| 15 |
+
--line: #223055;
|
| 16 |
+
}
|
| 17 |
+
@media (prefers-color-scheme: light) {
|
| 18 |
+
:root {
|
| 19 |
+
--bg: #f7f8fb;
|
| 20 |
+
--card: #ffffff;
|
| 21 |
+
--text: #111827;
|
| 22 |
+
--muted: #4b5563;
|
| 23 |
+
--accent: #2563eb;
|
| 24 |
+
--line: #e5e7eb;
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
body {
|
| 28 |
+
margin: 0;
|
| 29 |
+
background: var(--bg);
|
| 30 |
+
color: var(--text);
|
| 31 |
+
font: 16px/1.6 system-ui, sans-serif;
|
| 32 |
+
}
|
| 33 |
+
.container {
|
| 34 |
+
max-width: 920px;
|
| 35 |
+
margin: 0 auto;
|
| 36 |
+
padding: 28px 18px 48px;
|
| 37 |
+
}
|
| 38 |
+
.card {
|
| 39 |
+
background: var(--card);
|
| 40 |
+
border: 1px solid var(--line);
|
| 41 |
+
border-radius: 18px;
|
| 42 |
+
padding: 26px;
|
| 43 |
+
}
|
| 44 |
+
h1 {
|
| 45 |
+
margin-top: 0;
|
| 46 |
+
}
|
| 47 |
+
a {
|
| 48 |
+
color: var(--accent);
|
| 49 |
+
}
|
| 50 |
+
nav.top {
|
| 51 |
+
display: flex;
|
| 52 |
+
justify-content: space-between;
|
| 53 |
+
align-items: center;
|
| 54 |
+
margin-bottom: 18px;
|
| 55 |
+
}
|
| 56 |
+
.badge {
|
| 57 |
+
padding: 0.3rem 0.6rem;
|
| 58 |
+
border: 1px solid var(--line);
|
| 59 |
+
border-radius: 999px;
|
| 60 |
+
font-size: 0.85rem;
|
| 61 |
+
color: var(--muted);
|
| 62 |
+
}
|
| 63 |
+
.nav-btn {
|
| 64 |
+
margin-left: 10px;
|
| 65 |
+
color: var(--accent);
|
| 66 |
+
text-decoration: none;
|
| 67 |
+
}
|
| 68 |
+
.nav-btn:hover {
|
| 69 |
+
text-decoration: underline;
|
| 70 |
+
}
|
| 71 |
+
footer {
|
| 72 |
+
margin-top: 28px;
|
| 73 |
+
font-size: 0.9rem;
|
| 74 |
+
color: var(--muted);
|
| 75 |
+
}
|
| 76 |
+
</style>
|
| 77 |
+
</head>
|
| 78 |
+
<body>
|
| 79 |
+
<div class="container">
|
| 80 |
+
<nav class="top">
|
| 81 |
+
<span class="badge">🔒 Privacy & GDPR</span>
|
| 82 |
+
<div class="links">
|
| 83 |
+
<a class="nav-btn" href="disclaimer" target="_blank" rel="noopener noreferrer">Disclaimer</a>
|
| 84 |
+
<a class="nav-btn" href="/" target="_blank" rel="noopener noreferrer">Home</a>
|
| 85 |
+
</div>
|
| 86 |
+
</nav>
|
| 87 |
+
|
| 88 |
+
<article class="card">
|
| 89 |
+
<h1>Informativa Privacy</h1>
|
| 90 |
+
<p>
|
| 91 |
+
<strong>Titolare:</strong> Mattia Pasti — <a href="mailto:pastimattia772@gmail.com">pastimattia772@gmail.com</a>
|
| 92 |
+
</p>
|
| 93 |
+
|
| 94 |
+
<h2>Dati trattati</h2>
|
| 95 |
+
<ul>
|
| 96 |
+
<li>Dati tecnici di navigazione (IP, log errori) solo per sicurezza e diagnostica.</li>
|
| 97 |
+
<li>Cookie tecnici/localStorage (es. preferenze banner). Nessun cookie di profilazione.</li>
|
| 98 |
+
<li>Dati di contatto (solo se ci scrivi).</li>
|
| 99 |
+
</ul>
|
| 100 |
+
|
| 101 |
+
<h2>Finalità</h2>
|
| 102 |
+
<p>Dimostrazione didattica / portfolio, sicurezza tecnica, gestione contatti volontari.</p>
|
| 103 |
+
|
| 104 |
+
<h2>Diritti</h2>
|
| 105 |
+
<p>
|
| 106 |
+
Puoi chiedere accesso, rettifica o cancellazione dei tuoi dati. Per farlo scrivi a <a href="mailto:pastimattia772@gmail.com">questa email</a>.
|
| 107 |
+
</p>
|
| 108 |
+
|
| 109 |
+
<footer>
|
| 110 |
+
<p>
|
| 111 |
+
© <span id="y"></span> — Progetto Studentesco • <a href="disclaimer" target="_blank">Disclaimer</a>
|
| 112 |
+
</p>
|
| 113 |
+
</footer>
|
| 114 |
+
</article>
|
| 115 |
+
</div>
|
| 116 |
+
<script>
|
| 117 |
+
document.getElementById('y').textContent = new Date().getFullYear()
|
| 118 |
+
</script>
|
| 119 |
+
</body>
|
| 120 |
+
</html>
|
Social-Finder/docker-compose.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: "3.9"
|
| 2 |
+
|
| 3 |
+
services:
|
| 4 |
+
web:
|
| 5 |
+
build: .
|
| 6 |
+
container_name: socialfinder-flask
|
| 7 |
+
ports:
|
| 8 |
+
- "3000:3000"
|
| 9 |
+
volumes:
|
| 10 |
+
- ./backend:/app # hot-reload del codice host→container
|
dashboard.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(
|
| 4 |
+
page_title="Ba7ath OSINT Suite",
|
| 5 |
+
page_icon="🕵️♂️",
|
| 6 |
+
layout="wide"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
st.title("🕵️♂️ Ba7ath OSINT Suite")
|
| 10 |
+
st.markdown("""
|
| 11 |
+
Bienvenue dans votre **laboratoire OSINT d'investigation multi-plateformes**.
|
| 12 |
+
|
| 13 |
+
Ce dashboard vous permet :
|
| 14 |
+
- D’identifier la présence d’un username sur plus de **474 plateformes** en un clic (Ba7ath Username Search)
|
| 15 |
+
- D’analyser automatiquement l’occupation d’un pseudo/email sur les principaux réseaux (Multi-comptes OSINT)
|
| 16 |
+
- D’enrichir vos recherches par des modules professionnels (leaks, images, cartographie, ...)
|
| 17 |
+
|
| 18 |
+
**Navigation :**
|
| 19 |
+
Utilisez le menu latéral à gauche pour changer d'outil.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
> Ce kit est optimisé pour journalistes, enquêteurs, analystes et équipes de veille stratégique.<br>
|
| 24 |
+
> Toutes les analyses s’effectuent localement, les données ne sont pas partagées avec des tiers.
|
| 25 |
+
""")
|
| 26 |
+
|
| 27 |
+
# Affichage du logo à taille raisonnable
|
| 28 |
+
st.image("logo.png", caption="Ba7ath OSINT, l’investigation en mode turbo", width=200)
|
| 29 |
+
|
| 30 |
+
st.markdown("""
|
| 31 |
+
---
|
| 32 |
+
### Astuce rapide :
|
| 33 |
+
- **Changez de module à tout moment via le menu**
|
| 34 |
+
- **Sauvegardez vos résultats en CSV pour reporting**
|
| 35 |
+
- **Contactez votre expert OSINT Ba7ath pour tout ajout de fonctionnalité personnalisée**
|
| 36 |
+
""")
|
downloads/.gitkeep
ADDED
|
File without changes
|
favicon.ico
ADDED
|
|
fb_cookies.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
[{"name": "dbln", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "ps_l", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "ps_n", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "ar_debug", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "presence", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "c_user", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "fr", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "xs", "value": "", "domain": ".facebook.com", "path": "/", "expires": -1, "httpOnly": false, "secure": false, "sameSite": "Lax"}, {"name": "datr", "value": "t_ccaertQ3uQdEZuaqKUGSc4", "domain": ".facebook.com", "path": "/", "expires": 1798066106.226236, "httpOnly": true, "secure": true, "sameSite": "None"}, {"name": "sb", "value": "t_ccabEz-kYEWnCAwIBbrEZi", "domain": ".facebook.com", "path": "/", "expires": 1798066106.226411, "httpOnly": true, "secure": true, "sameSite": "None"}, {"name": "wd", "value": "1280x720", "domain": ".facebook.com", "path": "/", "expires": 1764110908, "httpOnly": false, "secure": true, "sameSite": "Lax"}, {"name": "dpr", "value": "1.0000000149011612", "domain": ".facebook.com", "path": "/", "expires": 1764110908, "httpOnly": false, "secure": true, "sameSite": "None"}]
|
maigret_reports/.gitkeep
ADDED
|
File without changes
|
output.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{"title": "Le Monde | Paris ", "description": "Le Monde, Paris. 5,795,118 likes \u00b7 336,172 talking about this \u00b7 61,768 were here. L'actualit\u00e9 de r\u00e9f\u00e9rence, par la r\u00e9daction du Monde.", "posts": []}
|
| 3 |
+
][
|
| 4 |
+
{"title": "Pr\u00e9sidence Tunisie \u0631\u0626\u0627\u0633\u0629 \u0627\u0644\u062c\u0645\u0647\u0648\u0631\u064a\u0629 \u0627\u0644\u062a\u0648\u0646\u0633\u064a\u0629", "description": "\u200ePr\u00e9sidence Tunisie \u0631\u0626\u0627\u0633\u0629 \u0627\u0644\u062c\u0645\u0647\u0648\u0631\u064a\u0629 \u0627\u0644\u062a\u0648\u0646\u0633\u064a\u0629\u200e. 2,698,878 likes \u00b7 41,296 talking about this. \u200e\u0627\u0644\u0635\u0641\u062d\u0629 \u0627\u0644\u0631\u0633\u0645\u064a\u0629 \u0644\u0631\u0626\u0627\u0633\u0629 \u0627\u0644\u062c\u0645\u0647\u0648\u0631\u064a\u0629 \u0627\u0644\u062a\u0648\u0646\u0633\u064a\u0629\u200e", "posts": []}
|
| 5 |
+
]
|
output.txt
ADDED
|
Binary file (35.7 kB). View file
|
|
|
pages/10_WaybackURLs.py
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Page Streamlit : Wayback Machine - URLs historiques
|
| 3 |
+
Module OSINT pour Ba7ath Dashboard
|
| 4 |
+
Avec filtres dynamiques d'affichage
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import streamlit as st
|
| 8 |
+
import sys
|
| 9 |
+
import os
|
| 10 |
+
import pandas as pd
|
| 11 |
+
import time
|
| 12 |
+
import urllib.parse
|
| 13 |
+
|
| 14 |
+
try:
|
| 15 |
+
from spectre_modules.wayback_urls import (
|
| 16 |
+
discover_wayback_urls,
|
| 17 |
+
download_archived_file,
|
| 18 |
+
extract_text_from_archived_page
|
| 19 |
+
)
|
| 20 |
+
except ImportError as e:
|
| 21 |
+
st.error(f"❌ Erreur d'import du module wayback_urls : {e}")
|
| 22 |
+
st.stop()
|
| 23 |
+
|
| 24 |
+
# Configuration de la page
|
| 25 |
+
st.set_page_config(page_title="Wayback URLs", page_icon="🕰️", layout="wide")
|
| 26 |
+
|
| 27 |
+
# En-tête
|
| 28 |
+
st.title("🕰️ Wayback Machine - URLs Historiques")
|
| 29 |
+
st.caption("Découverte d'URLs, fichiers et pages archivés - Archive.org")
|
| 30 |
+
|
| 31 |
+
# Avertissement légal
|
| 32 |
+
with st.expander("⚖️ Mentions légales et informations", expanded=False):
|
| 33 |
+
st.info("""
|
| 34 |
+
**Wayback Machine - Internet Archive**
|
| 35 |
+
|
| 36 |
+
📚 **Source des données** :
|
| 37 |
+
- [Internet Archive](https://web.archive.org/) - Organisation à but non lucratif
|
| 38 |
+
- Plus de 735 milliards de pages web archivées depuis 1996
|
| 39 |
+
- Accès public et gratuit via CDX API
|
| 40 |
+
|
| 41 |
+
🔍 **Cas d'usage OSINT** :
|
| 42 |
+
- Découvrir des sous-domaines historiques
|
| 43 |
+
- Trouver des fichiers sensibles supprimés (.sql, .env, .zip)
|
| 44 |
+
- Analyser l'évolution d'un site web
|
| 45 |
+
- Récupérer des documents publics disparus
|
| 46 |
+
|
| 47 |
+
⚠️ **Utilisation éthique** :
|
| 48 |
+
- Données publiques archivées légalement
|
| 49 |
+
- Respectez les robots.txt et directives légales
|
| 50 |
+
- Usage OSINT/recherche uniquement
|
| 51 |
+
""")
|
| 52 |
+
|
| 53 |
+
# Formulaire de saisie
|
| 54 |
+
st.markdown("---")
|
| 55 |
+
|
| 56 |
+
# Ligne 1 : Domaine et options de base
|
| 57 |
+
col1, col2 = st.columns([2, 1])
|
| 58 |
+
|
| 59 |
+
with col1:
|
| 60 |
+
domain_input = st.text_input(
|
| 61 |
+
"🎯 Domaine cible",
|
| 62 |
+
placeholder="exemple.com (sans http:// ni www)",
|
| 63 |
+
help="Entrez le nom de domaine à analyser"
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
with col2:
|
| 67 |
+
limit_per_page = st.selectbox(
|
| 68 |
+
"📊 Limite par page",
|
| 69 |
+
options=[1000, 5000, 10000],
|
| 70 |
+
index=2,
|
| 71 |
+
help="Nombre max d'URLs par requête (10000 = max API)"
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# Ligne 2 : Filtres API (affectent la requête)
|
| 75 |
+
st.write("**Filtres API (limitent les données récupérées)** :")
|
| 76 |
+
col3, col4 = st.columns(2)
|
| 77 |
+
|
| 78 |
+
with col3:
|
| 79 |
+
filter_status_enabled = st.checkbox("Filtrer par code HTTP", value=True)
|
| 80 |
+
if filter_status_enabled:
|
| 81 |
+
status_codes = st.multiselect(
|
| 82 |
+
"Codes HTTP à inclure",
|
| 83 |
+
options=[200, 301, 302, 400, 403, 404, 500],
|
| 84 |
+
default=[200],
|
| 85 |
+
help="Seuls ces codes seront récupérés de l'API"
|
| 86 |
+
)
|
| 87 |
+
else:
|
| 88 |
+
status_codes = None
|
| 89 |
+
|
| 90 |
+
with col4:
|
| 91 |
+
filter_mime_enabled = st.checkbox("Filtrer par MIME type (API)", value=False)
|
| 92 |
+
if filter_mime_enabled:
|
| 93 |
+
mime_types = st.multiselect(
|
| 94 |
+
"MIME types à inclure",
|
| 95 |
+
options=[
|
| 96 |
+
"text/html",
|
| 97 |
+
"application/pdf",
|
| 98 |
+
"application/zip",
|
| 99 |
+
"application/json",
|
| 100 |
+
"application/xml",
|
| 101 |
+
"text/plain"
|
| 102 |
+
],
|
| 103 |
+
help="Seuls ces types seront récupérés de l'API"
|
| 104 |
+
)
|
| 105 |
+
else:
|
| 106 |
+
mime_types = None
|
| 107 |
+
|
| 108 |
+
# Ligne 3 : Options avancées
|
| 109 |
+
st.write("**Options de téléchargement** :")
|
| 110 |
+
col5, col6 = st.columns(2)
|
| 111 |
+
|
| 112 |
+
with col5:
|
| 113 |
+
auto_download = st.checkbox(
|
| 114 |
+
"📥 Télécharger automatiquement les fichiers intéressants",
|
| 115 |
+
value=False,
|
| 116 |
+
help="Télécharge les .pdf, .zip, .sql, .env, etc."
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
with col6:
|
| 120 |
+
if auto_download:
|
| 121 |
+
max_downloads = st.number_input(
|
| 122 |
+
"Nombre max de fichiers",
|
| 123 |
+
min_value=1,
|
| 124 |
+
max_value=100,
|
| 125 |
+
value=20,
|
| 126 |
+
help="Limite pour éviter les téléchargements excessifs"
|
| 127 |
+
)
|
| 128 |
+
else:
|
| 129 |
+
max_downloads = 0
|
| 130 |
+
|
| 131 |
+
# Nettoyage de l'input
|
| 132 |
+
if domain_input:
|
| 133 |
+
domain_input = domain_input.strip().lower()
|
| 134 |
+
domain_input = domain_input.replace('http://', '').replace('https://', '')
|
| 135 |
+
domain_input = domain_input.replace('www.', '')
|
| 136 |
+
domain_input = domain_input.split('/')[0]
|
| 137 |
+
|
| 138 |
+
# Bouton de lancement
|
| 139 |
+
discover_btn = st.button("🚀 Lancer la découverte", type="primary", use_container_width=True)
|
| 140 |
+
|
| 141 |
+
# Exécution de la découverte
|
| 142 |
+
if discover_btn:
|
| 143 |
+
if not domain_input:
|
| 144 |
+
st.error("⚠️ Veuillez entrer un nom de domaine")
|
| 145 |
+
elif '.' not in domain_input or ' ' in domain_input:
|
| 146 |
+
st.error("⚠️ Format de domaine invalide")
|
| 147 |
+
else:
|
| 148 |
+
st.markdown("---")
|
| 149 |
+
|
| 150 |
+
# Barre de progression
|
| 151 |
+
progress_bar = st.progress(0, text="Initialisation...")
|
| 152 |
+
|
| 153 |
+
try:
|
| 154 |
+
# Lancement de la découverte
|
| 155 |
+
progress_bar.progress(10, text="🕰️ Interrogation de Wayback Machine...")
|
| 156 |
+
|
| 157 |
+
with st.spinner("Découverte en cours... Cela peut prendre 1-3 minutes."):
|
| 158 |
+
results = discover_wayback_urls(
|
| 159 |
+
domain=domain_input,
|
| 160 |
+
filter_status=status_codes if filter_status_enabled else None,
|
| 161 |
+
filter_mimetype=mime_types if filter_mime_enabled else None,
|
| 162 |
+
limit=limit_per_page,
|
| 163 |
+
auto_download=auto_download,
|
| 164 |
+
max_downloads=max_downloads if auto_download else 0
|
| 165 |
+
)
|
| 166 |
+
|
| 167 |
+
progress_bar.progress(100, text="✅ Découverte terminée !")
|
| 168 |
+
progress_bar.empty()
|
| 169 |
+
|
| 170 |
+
# Sauvegarder les résultats dans la session
|
| 171 |
+
st.session_state['wayback_results'] = results
|
| 172 |
+
|
| 173 |
+
except Exception as e:
|
| 174 |
+
progress_bar.empty()
|
| 175 |
+
st.error(f"❌ Erreur lors de la découverte : {str(e)}")
|
| 176 |
+
|
| 177 |
+
with st.expander("🐛 Détails de l'erreur (pour debug)"):
|
| 178 |
+
st.exception(e)
|
| 179 |
+
|
| 180 |
+
# Affichage des résultats (persiste après le clic)
|
| 181 |
+
if 'wayback_results' in st.session_state:
|
| 182 |
+
results = st.session_state['wayback_results']
|
| 183 |
+
|
| 184 |
+
if results['urls']:
|
| 185 |
+
st.success(f"✅ **{len(results['urls'])} URLs** découvertes pour **{results['domain']}**")
|
| 186 |
+
|
| 187 |
+
# ========================================
|
| 188 |
+
# FILTRES D'AFFICHAGE DYNAMIQUES
|
| 189 |
+
# ========================================
|
| 190 |
+
st.markdown("---")
|
| 191 |
+
st.subheader("🔍 Filtres d'affichage (n'affectent pas les données)")
|
| 192 |
+
|
| 193 |
+
col_filter1, col_filter2, col_filter3 = st.columns(3)
|
| 194 |
+
|
| 195 |
+
with col_filter1:
|
| 196 |
+
# Filtre par extension
|
| 197 |
+
all_extensions = sorted(set(u['extension'] for u in results['urls'] if u['extension']))
|
| 198 |
+
selected_extensions = st.multiselect(
|
| 199 |
+
"📁 Filtrer par extension",
|
| 200 |
+
options=['Toutes'] + all_extensions,
|
| 201 |
+
default=['Toutes'],
|
| 202 |
+
help="Affiche uniquement ces extensions"
|
| 203 |
+
)
|
| 204 |
+
|
| 205 |
+
with col_filter2:
|
| 206 |
+
# Filtre textuel sur URL
|
| 207 |
+
text_filter = st.text_input(
|
| 208 |
+
"🔎 Recherche textuelle",
|
| 209 |
+
placeholder="Rechercher dans les URLs...",
|
| 210 |
+
help="Filtre les URLs contenant ce texte"
|
| 211 |
+
)
|
| 212 |
+
|
| 213 |
+
with col_filter3:
|
| 214 |
+
# Filtre par hostname
|
| 215 |
+
all_hostnames = sorted(set(u['hostname'] for u in results['urls']))
|
| 216 |
+
selected_hostnames = st.multiselect(
|
| 217 |
+
"🏠 Filtrer par hostname",
|
| 218 |
+
options=['Tous'] + all_hostnames,
|
| 219 |
+
default=['Tous'],
|
| 220 |
+
help="Affiche uniquement ces hostnames"
|
| 221 |
+
)
|
| 222 |
+
|
| 223 |
+
# Appliquer les filtres
|
| 224 |
+
filtered_urls = results['urls']
|
| 225 |
+
|
| 226 |
+
# Filtre extension
|
| 227 |
+
if 'Toutes' not in selected_extensions and selected_extensions:
|
| 228 |
+
filtered_urls = [u for u in filtered_urls if u['extension'] in selected_extensions]
|
| 229 |
+
|
| 230 |
+
# Filtre textuel
|
| 231 |
+
if text_filter:
|
| 232 |
+
filtered_urls = [u for u in filtered_urls if text_filter.lower() in urllib.parse.unquote(u['url']).lower()]
|
| 233 |
+
|
| 234 |
+
# Filtre hostname
|
| 235 |
+
if 'Tous' not in selected_hostnames and selected_hostnames:
|
| 236 |
+
filtered_urls = [u for u in filtered_urls if u['hostname'] in selected_hostnames]
|
| 237 |
+
|
| 238 |
+
# Statistiques filtrées
|
| 239 |
+
st.info(f"**Affichage : {len(filtered_urls)} / {len(results['urls'])} URLs** (après filtrage)")
|
| 240 |
+
|
| 241 |
+
# ========================================
|
| 242 |
+
# FIN FILTRES
|
| 243 |
+
# ========================================
|
| 244 |
+
|
| 245 |
+
# Statistiques principales
|
| 246 |
+
stats = results.get('stats', {})
|
| 247 |
+
|
| 248 |
+
col_stat1, col_stat2, col_stat3, col_stat4 = st.columns(4)
|
| 249 |
+
with col_stat1:
|
| 250 |
+
st.metric("🌐 URLs totales", len(results['urls']))
|
| 251 |
+
with col_stat2:
|
| 252 |
+
st.metric("🏠 Sous-domaines", stats.get('unique_hostnames', 0))
|
| 253 |
+
with col_stat3:
|
| 254 |
+
st.metric("📁 Fichiers intéressants", len(stats.get('interesting_files', [])))
|
| 255 |
+
with col_stat4:
|
| 256 |
+
st.metric("📄 Pages HTML", len(stats.get('html_pages', [])))
|
| 257 |
+
|
| 258 |
+
# Affichage des téléchargements
|
| 259 |
+
if results.get('downloaded_files'):
|
| 260 |
+
st.success(f"✅ {len(results['downloaded_files'])} fichiers téléchargés dans `/downloads`")
|
| 261 |
+
|
| 262 |
+
# Organisation en onglets
|
| 263 |
+
tab1, tab2, tab3, tab4, tab5 = st.tabs([
|
| 264 |
+
"📋 Toutes les URLs",
|
| 265 |
+
"📁 Fichiers intéressants",
|
| 266 |
+
"📄 Pages HTML",
|
| 267 |
+
"📊 Statistiques",
|
| 268 |
+
"📥 Export"
|
| 269 |
+
])
|
| 270 |
+
|
| 271 |
+
# --- ONGLET : TOUTES LES URLs ---
|
| 272 |
+
with tab1:
|
| 273 |
+
st.subheader(f"Liste des URLs ({len(filtered_urls)} affichées)")
|
| 274 |
+
|
| 275 |
+
# DataFrame avec URLs filtrées
|
| 276 |
+
df_filtered = pd.DataFrame(filtered_urls)
|
| 277 |
+
|
| 278 |
+
if not df_filtered.empty:
|
| 279 |
+
# Sélection des colonnes à afficher
|
| 280 |
+
display_cols = ['hostname', 'date_archived', 'status_code',
|
| 281 |
+
'mime_type', 'extension', 'wayback_url']
|
| 282 |
+
|
| 283 |
+
st.dataframe(
|
| 284 |
+
df_filtered[display_cols],
|
| 285 |
+
width='stretch',
|
| 286 |
+
hide_index=True,
|
| 287 |
+
column_config={
|
| 288 |
+
'hostname': st.column_config.TextColumn('Hostname', width='medium'),
|
| 289 |
+
'date_archived': st.column_config.TextColumn('Date archivée', width='medium'),
|
| 290 |
+
'status_code': st.column_config.NumberColumn('HTTP', format="%d", width='small'),
|
| 291 |
+
'mime_type': st.column_config.TextColumn('MIME type', width='medium'),
|
| 292 |
+
'extension': st.column_config.TextColumn('Ext', width='small'),
|
| 293 |
+
'wayback_url': st.column_config.LinkColumn('🔗 Ouvrir', width='small')
|
| 294 |
+
}
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
# Section URLs originales copiables
|
| 298 |
+
with st.expander("📋 URLs originales (copiables)"):
|
| 299 |
+
original_urls = '\n'.join([u['url'] for u in filtered_urls[:100]])
|
| 300 |
+
st.code(original_urls)
|
| 301 |
+
|
| 302 |
+
# Liens Wayback directs
|
| 303 |
+
with st.expander("🔗 Liens Wayback Machine (10 premiers filtrés)"):
|
| 304 |
+
for url_data in filtered_urls[:10]:
|
| 305 |
+
st.markdown(f"🌐 **[{url_data['wayback_url']}]({url_data['wayback_url']})**")
|
| 306 |
+
st.caption(f" ↳ Original : `{url_data['url']}`")
|
| 307 |
+
st.markdown("---")
|
| 308 |
+
else:
|
| 309 |
+
st.warning("Aucune URL ne correspond aux filtres sélectionnés")
|
| 310 |
+
|
| 311 |
+
# --- ONGLET : FICHIERS INTÉRESSANTS ---
|
| 312 |
+
with tab2:
|
| 313 |
+
st.subheader("📁 Fichiers sensibles découverts")
|
| 314 |
+
|
| 315 |
+
interesting = stats.get('interesting_files', [])
|
| 316 |
+
|
| 317 |
+
# Appliquer les filtres aux fichiers intéressants
|
| 318 |
+
filtered_interesting = interesting
|
| 319 |
+
if 'Toutes' not in selected_extensions and selected_extensions:
|
| 320 |
+
filtered_interesting = [f for f in filtered_interesting if f['extension'] in selected_extensions]
|
| 321 |
+
if text_filter:
|
| 322 |
+
filtered_interesting = [f for f in filtered_interesting if text_filter.lower() in urllib.parse.unquote(f['url']).lower()]
|
| 323 |
+
|
| 324 |
+
if filtered_interesting:
|
| 325 |
+
st.write(f"**{len(filtered_interesting)} / {len(interesting)} fichiers** affichés (après filtrage) :")
|
| 326 |
+
|
| 327 |
+
df_interesting = pd.DataFrame(filtered_interesting)
|
| 328 |
+
|
| 329 |
+
# Affichage avec lien Wayback
|
| 330 |
+
st.dataframe(
|
| 331 |
+
df_interesting[['extension', 'date_archived', 'wayback_url']],
|
| 332 |
+
width='stretch',
|
| 333 |
+
hide_index=True,
|
| 334 |
+
column_config={
|
| 335 |
+
'extension': st.column_config.TextColumn('Type', width='small'),
|
| 336 |
+
'date_archived': st.column_config.TextColumn('Date archivée', width='medium'),
|
| 337 |
+
'wayback_url': st.column_config.LinkColumn('🔗 Ouvrir dans Wayback', width='large')
|
| 338 |
+
}
|
| 339 |
+
)
|
| 340 |
+
|
| 341 |
+
# URLs originales en expander
|
| 342 |
+
with st.expander("📋 URLs originales des fichiers"):
|
| 343 |
+
for f in filtered_interesting[:20]:
|
| 344 |
+
st.code(f['url'])
|
| 345 |
+
|
| 346 |
+
# Actions de téléchargement
|
| 347 |
+
st.write("**Actions disponibles :**")
|
| 348 |
+
|
| 349 |
+
selected_file = st.selectbox(
|
| 350 |
+
"Sélectionner un fichier à télécharger",
|
| 351 |
+
options=range(len(filtered_interesting)),
|
| 352 |
+
format_func=lambda i: f"{filtered_interesting[i]['extension']} - {filtered_interesting[i]['url'][:60]}..."
|
| 353 |
+
)
|
| 354 |
+
|
| 355 |
+
col_dl1, col_dl2 = st.columns(2)
|
| 356 |
+
|
| 357 |
+
with col_dl1:
|
| 358 |
+
if st.button("📥 Télécharger ce fichier", use_container_width=True):
|
| 359 |
+
file_data = filtered_interesting[selected_file]
|
| 360 |
+
|
| 361 |
+
with st.spinner(f"Téléchargement de {file_data['extension']}..."):
|
| 362 |
+
success, path = download_archived_file(
|
| 363 |
+
file_data['url'],
|
| 364 |
+
file_data['timestamp']
|
| 365 |
+
)
|
| 366 |
+
|
| 367 |
+
if success:
|
| 368 |
+
st.success(f"✅ Fichier sauvegardé : `{path}`")
|
| 369 |
+
else:
|
| 370 |
+
st.error("❌ Échec du téléchargement")
|
| 371 |
+
|
| 372 |
+
with col_dl2:
|
| 373 |
+
st.link_button(
|
| 374 |
+
"🔗 Ouvrir dans Wayback",
|
| 375 |
+
filtered_interesting[selected_file]['wayback_url'],
|
| 376 |
+
use_container_width=True
|
| 377 |
+
)
|
| 378 |
+
else:
|
| 379 |
+
if interesting:
|
| 380 |
+
st.info(f"{len(interesting)} fichiers trouvés mais aucun ne correspond aux filtres")
|
| 381 |
+
else:
|
| 382 |
+
st.info("Aucun fichier intéressant trouvé avec les filtres API actuels")
|
| 383 |
+
|
| 384 |
+
# --- ONGLET : PAGES HTML ---
|
| 385 |
+
with tab3:
|
| 386 |
+
st.subheader("📄 Pages HTML analysables")
|
| 387 |
+
|
| 388 |
+
html_pages = stats.get('html_pages', [])
|
| 389 |
+
|
| 390 |
+
# Appliquer les filtres textuels
|
| 391 |
+
filtered_html = html_pages
|
| 392 |
+
if text_filter:
|
| 393 |
+
filtered_html = [p for p in filtered_html if text_filter.lower() in urllib.parse.unquote(p['url']).lower()]
|
| 394 |
+
|
| 395 |
+
if filtered_html:
|
| 396 |
+
st.write(f"**{len(filtered_html)} / {len(html_pages)} pages HTML** affichées (après filtrage) :")
|
| 397 |
+
|
| 398 |
+
# Sélection d'une page
|
| 399 |
+
selected_page = st.selectbox(
|
| 400 |
+
"Sélectionner une page",
|
| 401 |
+
options=range(min(50, len(filtered_html))),
|
| 402 |
+
format_func=lambda i: f"{filtered_html[i]['date_archived']} - {filtered_html[i]['url'][:60]}..."
|
| 403 |
+
)
|
| 404 |
+
|
| 405 |
+
page_data = filtered_html[selected_page]
|
| 406 |
+
|
| 407 |
+
col_page1, col_page2 = st.columns(2)
|
| 408 |
+
|
| 409 |
+
with col_page1:
|
| 410 |
+
if st.button("📝 Extraire le texte", use_container_width=True):
|
| 411 |
+
with st.spinner("Extraction du texte en cours..."):
|
| 412 |
+
text = extract_text_from_archived_page(
|
| 413 |
+
page_data['url'],
|
| 414 |
+
page_data['timestamp']
|
| 415 |
+
)
|
| 416 |
+
|
| 417 |
+
if text:
|
| 418 |
+
st.success("✅ Texte extrait avec succès")
|
| 419 |
+
st.text_area(
|
| 420 |
+
"Contenu textuel",
|
| 421 |
+
value=text,
|
| 422 |
+
height=400
|
| 423 |
+
)
|
| 424 |
+
|
| 425 |
+
# Bouton de téléchargement du texte
|
| 426 |
+
st.download_button(
|
| 427 |
+
label="💾 Télécharger le texte",
|
| 428 |
+
data=text.encode('utf-8'),
|
| 429 |
+
file_name=f"text_{results['domain']}_{page_data['timestamp']}.txt",
|
| 430 |
+
mime="text/plain"
|
| 431 |
+
)
|
| 432 |
+
else:
|
| 433 |
+
st.error("❌ Impossible d'extraire le texte")
|
| 434 |
+
|
| 435 |
+
with col_page2:
|
| 436 |
+
st.link_button(
|
| 437 |
+
"🔗 Ouvrir dans Wayback",
|
| 438 |
+
page_data['wayback_url'],
|
| 439 |
+
use_container_width=True
|
| 440 |
+
)
|
| 441 |
+
else:
|
| 442 |
+
if html_pages:
|
| 443 |
+
st.info(f"{len(html_pages)} pages trouvées mais aucune ne correspond aux filtres")
|
| 444 |
+
else:
|
| 445 |
+
st.info("Aucune page HTML trouvée (utilisez le filtre MIME type API)")
|
| 446 |
+
|
| 447 |
+
# --- ONGLET : STATISTIQUES ---
|
| 448 |
+
with tab4:
|
| 449 |
+
st.subheader("📊 Statistiques détaillées (données complètes)")
|
| 450 |
+
|
| 451 |
+
# Codes HTTP
|
| 452 |
+
st.write("**Répartition par code HTTP :**")
|
| 453 |
+
status_codes_stats = stats.get('status_codes', {})
|
| 454 |
+
for code, count in sorted(status_codes_stats.items(), key=lambda x: -x[1]):
|
| 455 |
+
st.write(f"- **{code}** : {count} URLs")
|
| 456 |
+
|
| 457 |
+
st.markdown("---")
|
| 458 |
+
|
| 459 |
+
# MIME types
|
| 460 |
+
st.write("**Répartition par MIME type (top 10) :**")
|
| 461 |
+
mime_stats = stats.get('mime_types', {})
|
| 462 |
+
for mime, count in sorted(mime_stats.items(), key=lambda x: -x[1])[:10]:
|
| 463 |
+
st.write(f"- **{mime}** : {count} URLs")
|
| 464 |
+
|
| 465 |
+
st.markdown("---")
|
| 466 |
+
|
| 467 |
+
# Extensions
|
| 468 |
+
st.write("**Top extensions de fichiers :**")
|
| 469 |
+
ext_stats = stats.get('file_extensions', {})
|
| 470 |
+
for ext, count in sorted(ext_stats.items(), key=lambda x: -x[1])[:15]:
|
| 471 |
+
st.write(f"- **{ext}** : {count} fichiers")
|
| 472 |
+
|
| 473 |
+
# --- ONGLET : EXPORT ---
|
| 474 |
+
with tab5:
|
| 475 |
+
st.subheader("📥 Exportation des données")
|
| 476 |
+
|
| 477 |
+
# Export des données filtrées ou complètes
|
| 478 |
+
export_choice = st.radio(
|
| 479 |
+
"Que voulez-vous exporter ?",
|
| 480 |
+
options=["Données filtrées actuelles", "Toutes les données"],
|
| 481 |
+
index=0
|
| 482 |
+
)
|
| 483 |
+
|
| 484 |
+
if export_choice == "Données filtrées actuelles":
|
| 485 |
+
export_df = pd.DataFrame(filtered_urls)
|
| 486 |
+
export_label = f"filtré ({len(filtered_urls)} URLs)"
|
| 487 |
+
else:
|
| 488 |
+
export_df = pd.DataFrame(results['urls'])
|
| 489 |
+
export_label = f"complet ({len(results['urls'])} URLs)"
|
| 490 |
+
|
| 491 |
+
col_exp1, col_exp2 = st.columns(2)
|
| 492 |
+
|
| 493 |
+
with col_exp1:
|
| 494 |
+
st.download_button(
|
| 495 |
+
label=f"📥 Télécharger {export_label} (CSV)",
|
| 496 |
+
data=export_df.to_csv(index=False, encoding='utf-8-sig').encode('utf-8-sig'),
|
| 497 |
+
file_name=f"wayback_urls_{results['domain'].replace('.', '_')}_{export_choice.replace(' ', '_')}.csv",
|
| 498 |
+
mime="text/csv",
|
| 499 |
+
use_container_width=True
|
| 500 |
+
)
|
| 501 |
+
|
| 502 |
+
with col_exp2:
|
| 503 |
+
# Rapport automatique
|
| 504 |
+
if results.get('report_filename'):
|
| 505 |
+
report_path = os.path.join('reports', results['report_filename'])
|
| 506 |
+
if os.path.exists(report_path):
|
| 507 |
+
with open(report_path, 'rb') as f:
|
| 508 |
+
report_content = f.read()
|
| 509 |
+
|
| 510 |
+
st.download_button(
|
| 511 |
+
label="📄 Télécharger le rapport auto-généré",
|
| 512 |
+
data=report_content,
|
| 513 |
+
file_name=results['report_filename'],
|
| 514 |
+
mime="text/csv",
|
| 515 |
+
use_container_width=True
|
| 516 |
+
)
|
| 517 |
+
|
| 518 |
+
# Export des fichiers intéressants uniquement
|
| 519 |
+
if stats.get('interesting_files'):
|
| 520 |
+
interesting_df = pd.DataFrame(stats['interesting_files'])
|
| 521 |
+
st.download_button(
|
| 522 |
+
label="📁 Télécharger uniquement les fichiers intéressants (CSV)",
|
| 523 |
+
data=interesting_df.to_csv(index=False, encoding='utf-8-sig').encode('utf-8-sig'),
|
| 524 |
+
file_name=f"interesting_files_{results['domain'].replace('.', '_')}.csv",
|
| 525 |
+
mime="text/csv",
|
| 526 |
+
use_container_width=True
|
| 527 |
+
)
|
| 528 |
+
|
| 529 |
+
# Aperçu
|
| 530 |
+
with st.expander("👁️ Aperçu des données exportables"):
|
| 531 |
+
st.dataframe(export_df, width='stretch')
|
| 532 |
+
|
| 533 |
+
st.caption(f"""
|
| 534 |
+
📊 **Format du rapport**
|
| 535 |
+
- Colonnes : url, hostname, date_archived, status_code, mime_type, extension, wayback_url, timestamp
|
| 536 |
+
- Total d'entrées : {len(export_df)}
|
| 537 |
+
- Encodage : UTF-8 BOM (compatible Excel)
|
| 538 |
+
""")
|
| 539 |
+
|
| 540 |
+
else:
|
| 541 |
+
st.warning("⚠️ Aucune URL trouvée pour ce domaine")
|
| 542 |
+
st.info("""
|
| 543 |
+
**Raisons possibles** :
|
| 544 |
+
- Le domaine n'a jamais été archivé par Wayback Machine
|
| 545 |
+
- Les filtres API sont trop restrictifs
|
| 546 |
+
- Le domaine est trop récent
|
| 547 |
+
""")
|
| 548 |
+
|
| 549 |
+
# Pied de page
|
| 550 |
+
st.markdown("---")
|
| 551 |
+
st.caption("🕵️ Ba7ath OSINT Suite | Module Wayback Machine - Internet Archive")
|
pages/11_Email_extractor.py
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Page Streamlit : Email Harvester
|
| 3 |
+
Module OSINT pour Ba7ath Dashboard
|
| 4 |
+
Extraction passive d'emails depuis pages web publiques
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import streamlit as st
|
| 8 |
+
import sys
|
| 9 |
+
import os
|
| 10 |
+
import pandas as pd
|
| 11 |
+
import time
|
| 12 |
+
|
| 13 |
+
# Ajouter le chemin des modules
|
| 14 |
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'spectre_modules'))
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
from email_harvester import harvest_emails
|
| 18 |
+
except ImportError as e:
|
| 19 |
+
st.error(f"❌ Erreur d'import du module email_harvester : {e}")
|
| 20 |
+
st.stop()
|
| 21 |
+
|
| 22 |
+
st.set_page_config(page_title="Email extractor", page_icon="📧", layout="wide")
|
| 23 |
+
|
| 24 |
+
st.title("📧 Email extractor")
|
| 25 |
+
st.caption("Extraction passive d'emails depuis pages web publiques")
|
| 26 |
+
|
| 27 |
+
with st.expander("⚖️ Mentions légales et éthique", expanded=False):
|
| 28 |
+
st.warning("""
|
| 29 |
+
**Utilisation responsable uniquement**
|
| 30 |
+
|
| 31 |
+
⚠️ **Règles d'utilisation** :
|
| 32 |
+
- Respecte automatiquement les fichiers `robots.txt` (option désactivable ci-dessous)
|
| 33 |
+
- N'utilisez que sur des sites publics
|
| 34 |
+
- Pas de spam ni de harcèlement
|
| 35 |
+
- Respectez le RGPD et les lois locales
|
| 36 |
+
|
| 37 |
+
📚 **Sources de données** :
|
| 38 |
+
- Pages web publiques accessibles
|
| 39 |
+
- Validation DNS automatique (MX records)
|
| 40 |
+
- Emails extraits via regex + parsing HTML
|
| 41 |
+
|
| 42 |
+
🚫 **Interdit** :
|
| 43 |
+
- Utilisation commerciale sans consentement
|
| 44 |
+
- Spam ou phishing
|
| 45 |
+
- Violation de la vie privée
|
| 46 |
+
|
| 47 |
+
✅ **Cas d'usage légitimes** :
|
| 48 |
+
- Recherche de contacts professionnels publics
|
| 49 |
+
- Investigation OSINT avec autorisation
|
| 50 |
+
- Audit de sécurité (bug bounty)
|
| 51 |
+
""")
|
| 52 |
+
|
| 53 |
+
st.markdown("---")
|
| 54 |
+
|
| 55 |
+
# Mode de saisie
|
| 56 |
+
input_mode = st.radio(
|
| 57 |
+
"Mode de saisie",
|
| 58 |
+
options=["URL unique", "Batch (plusieurs URLs)"],
|
| 59 |
+
horizontal=True
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
if input_mode == "URL unique":
|
| 63 |
+
url_input = st.text_input(
|
| 64 |
+
"🌐 URL cible",
|
| 65 |
+
placeholder="https://exemple.com ou exemple.com",
|
| 66 |
+
help="Entrez l'URL de la page à analyser"
|
| 67 |
+
)
|
| 68 |
+
urls_list = [url_input] if url_input else []
|
| 69 |
+
else:
|
| 70 |
+
urls_text = st.text_area(
|
| 71 |
+
"📋 Liste d'URLs (une par ligne)",
|
| 72 |
+
placeholder="https://exemple1.com\nexemple2.com\nhttps://exemple3.com/contact",
|
| 73 |
+
height=150,
|
| 74 |
+
help="Collez une URL par ligne"
|
| 75 |
+
)
|
| 76 |
+
urls_list = [url.strip() for url in urls_text.split('\n') if url.strip()]
|
| 77 |
+
|
| 78 |
+
st.write("**Options d'extraction** :")
|
| 79 |
+
col1, col2 = st.columns(2)
|
| 80 |
+
with col1:
|
| 81 |
+
validate_dns = st.checkbox(
|
| 82 |
+
"🔍 Valider les emails (DNS MX)",
|
| 83 |
+
value=True,
|
| 84 |
+
help="Vérifie que le domaine de l'email a des MX records"
|
| 85 |
+
)
|
| 86 |
+
with col2:
|
| 87 |
+
follow_links = st.checkbox(
|
| 88 |
+
"🔗 Suivre les liens internes",
|
| 89 |
+
value=False,
|
| 90 |
+
help="⚠️ Augmente considérablement le temps de scan"
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
col3, _ = st.columns([1, 1])
|
| 94 |
+
with col3:
|
| 95 |
+
respect_robots = st.checkbox(
|
| 96 |
+
"🤖 Respecter robots.txt",
|
| 97 |
+
value=True,
|
| 98 |
+
help="Si décoché, l'outil passe outre les restrictions du site (déconseillé sans autorisation explicite)"
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
if urls_list:
|
| 102 |
+
st.info(f"📊 **{len(urls_list)} URL(s)** prêtes à être analysées")
|
| 103 |
+
|
| 104 |
+
harvest_btn = st.button("🚀 Lancer l'extraction", type="primary", use_container_width=True)
|
| 105 |
+
|
| 106 |
+
if harvest_btn:
|
| 107 |
+
if not urls_list:
|
| 108 |
+
st.error("⚠️ Veuillez entrer au moins une URL")
|
| 109 |
+
else:
|
| 110 |
+
st.markdown("---")
|
| 111 |
+
progress_bar = st.progress(0, text="Initialisation...")
|
| 112 |
+
|
| 113 |
+
try:
|
| 114 |
+
estimated_time = len(urls_list) * 3 # ~3s par URL
|
| 115 |
+
progress_bar.progress(10, text=f"⏱️ Temps estimé : {estimated_time}s")
|
| 116 |
+
with st.spinner(f"Extraction en cours sur {len(urls_list)} URL(s)..."):
|
| 117 |
+
results = harvest_emails(
|
| 118 |
+
urls=urls_list,
|
| 119 |
+
validate_dns=validate_dns,
|
| 120 |
+
follow_links=follow_links,
|
| 121 |
+
export_csv=True,
|
| 122 |
+
respect_robots_txt=respect_robots
|
| 123 |
+
)
|
| 124 |
+
progress_bar.progress(100, text="✅ Extraction terminée !")
|
| 125 |
+
progress_bar.empty()
|
| 126 |
+
st.session_state['email_results'] = results
|
| 127 |
+
|
| 128 |
+
except Exception as e:
|
| 129 |
+
progress_bar.empty()
|
| 130 |
+
st.error(f"❌ Erreur lors de l'extraction : {str(e)}")
|
| 131 |
+
|
| 132 |
+
with st.expander("🐛 Détails de l'erreur (pour debug)"):
|
| 133 |
+
st.exception(e)
|
| 134 |
+
|
| 135 |
+
# Affichage des résultats
|
| 136 |
+
if 'email_results' in st.session_state:
|
| 137 |
+
results = st.session_state['email_results']
|
| 138 |
+
|
| 139 |
+
if results['total_found'] > 0:
|
| 140 |
+
st.success(f"✅ **{results['total_found']} emails uniques** trouvés sur {len(results['urls_scanned'])} URLs")
|
| 141 |
+
|
| 142 |
+
col_stat1, col_stat2, col_stat3, col_stat4 = st.columns(4)
|
| 143 |
+
with col_stat1:
|
| 144 |
+
st.metric("📧 Emails uniques", results['total_found'])
|
| 145 |
+
with col_stat2:
|
| 146 |
+
st.metric("🌐 URLs scannées", len(results['urls_scanned']))
|
| 147 |
+
with col_stat3:
|
| 148 |
+
st.metric("✅ Succès", results['successful_scans'])
|
| 149 |
+
with col_stat4:
|
| 150 |
+
st.metric("❌ Échecs", results['failed_scans'])
|
| 151 |
+
|
| 152 |
+
tab1, tab2, tab3, tab4 = st.tabs([
|
| 153 |
+
"📧 Liste des emails",
|
| 154 |
+
"🌐 URLs scannées",
|
| 155 |
+
"📊 Statistiques",
|
| 156 |
+
"📥 Export"
|
| 157 |
+
])
|
| 158 |
+
|
| 159 |
+
with tab1:
|
| 160 |
+
st.subheader("📧 Emails extraits")
|
| 161 |
+
col_filter1, col_filter2 = st.columns(2)
|
| 162 |
+
with col_filter1:
|
| 163 |
+
all_domains = sorted(set(email['email'].split('@')[1] for email in results['all_emails']))
|
| 164 |
+
selected_domains = st.multiselect(
|
| 165 |
+
"Filtrer par domaine",
|
| 166 |
+
options=['Tous'] + all_domains,
|
| 167 |
+
default=['Tous']
|
| 168 |
+
)
|
| 169 |
+
with col_filter2:
|
| 170 |
+
dns_filter = st.selectbox(
|
| 171 |
+
"Validation DNS",
|
| 172 |
+
options=['Tous', 'Valides uniquement', 'Invalides uniquement', 'Non vérifiés']
|
| 173 |
+
)
|
| 174 |
+
|
| 175 |
+
filtered_emails = results['all_emails']
|
| 176 |
+
if 'Tous' not in selected_domains and selected_domains:
|
| 177 |
+
filtered_emails = [e for e in filtered_emails if e['email'].split('@')[1] in selected_domains]
|
| 178 |
+
if dns_filter == 'Valides uniquement':
|
| 179 |
+
filtered_emails = [e for e in filtered_emails if e.get('dns_valid') == True]
|
| 180 |
+
elif dns_filter == 'Invalides uniquement':
|
| 181 |
+
filtered_emails = [e for e in filtered_emails if e.get('dns_valid') == False]
|
| 182 |
+
elif dns_filter == 'Non vérifiés':
|
| 183 |
+
filtered_emails = [e for e in filtered_emails if e.get('dns_valid') is None]
|
| 184 |
+
|
| 185 |
+
st.info(f"**{len(filtered_emails)} / {len(results['all_emails'])} emails** affichés (après filtrage)")
|
| 186 |
+
|
| 187 |
+
if filtered_emails:
|
| 188 |
+
df_emails = pd.DataFrame(filtered_emails)
|
| 189 |
+
display_cols = ['email', 'source_url']
|
| 190 |
+
if 'dns_valid' in df_emails.columns:
|
| 191 |
+
display_cols.append('dns_valid')
|
| 192 |
+
st.dataframe(
|
| 193 |
+
df_emails[display_cols],
|
| 194 |
+
width='stretch',
|
| 195 |
+
hide_index=True,
|
| 196 |
+
column_config={
|
| 197 |
+
'email': st.column_config.TextColumn('Email', width='large'),
|
| 198 |
+
'source_url': st.column_config.LinkColumn('Source URL', width='large'),
|
| 199 |
+
'dns_valid': st.column_config.CheckboxColumn('DNS Valide', width='small')
|
| 200 |
+
}
|
| 201 |
+
)
|
| 202 |
+
with st.expander("📋 Liste d'emails (copiable)"):
|
| 203 |
+
emails_text = '\n'.join([f"{e['email']} ({e['source_url']})" for e in filtered_emails])
|
| 204 |
+
st.code(emails_text)
|
| 205 |
+
else:
|
| 206 |
+
st.warning("Aucun email ne correspond aux filtres sélectionnés")
|
| 207 |
+
|
| 208 |
+
with tab2:
|
| 209 |
+
st.subheader("🌐 URLs analysées")
|
| 210 |
+
urls_data = []
|
| 211 |
+
for scan in results['urls_scanned']:
|
| 212 |
+
urls_data.append({
|
| 213 |
+
'URL': scan['url'],
|
| 214 |
+
'Titre': scan.get('title', 'N/A')[:50] + '...' if scan.get('title') else 'N/A',
|
| 215 |
+
'Emails trouvés': scan.get('total_found', 0),
|
| 216 |
+
'Statut': scan['status'],
|
| 217 |
+
'Erreur': scan.get('error', '')[:50] if scan.get('error') else ''
|
| 218 |
+
})
|
| 219 |
+
df_urls = pd.DataFrame(urls_data)
|
| 220 |
+
st.dataframe(
|
| 221 |
+
df_urls,
|
| 222 |
+
width='stretch',
|
| 223 |
+
hide_index=True,
|
| 224 |
+
column_config={
|
| 225 |
+
'URL': st.column_config.LinkColumn('URL', width='large'),
|
| 226 |
+
'Titre': st.column_config.TextColumn('Titre', width='medium'),
|
| 227 |
+
'Emails trouvés': st.column_config.NumberColumn('Emails', format="%d", width='small'),
|
| 228 |
+
'Statut': st.column_config.TextColumn('Statut', width='small'),
|
| 229 |
+
'Erreur': st.column_config.TextColumn('Erreur', width='medium')
|
| 230 |
+
}
|
| 231 |
+
)
|
| 232 |
+
with st.expander("🔍 Détails par URL"):
|
| 233 |
+
selected_url = st.selectbox(
|
| 234 |
+
"Sélectionner une URL",
|
| 235 |
+
options=[scan['url'] for scan in results['urls_scanned']]
|
| 236 |
+
)
|
| 237 |
+
scan_detail = next((s for s in results['urls_scanned'] if s['url'] == selected_url), None)
|
| 238 |
+
if scan_detail:
|
| 239 |
+
st.json(scan_detail)
|
| 240 |
+
|
| 241 |
+
with tab3:
|
| 242 |
+
st.subheader("📊 Statistiques détaillées")
|
| 243 |
+
st.write("**Répartition par domaine d'email :**")
|
| 244 |
+
domain_counts = {}
|
| 245 |
+
for email in results['all_emails']:
|
| 246 |
+
domain = email['email'].split('@')[1]
|
| 247 |
+
domain_counts[domain] = domain_counts.get(domain, 0) + 1
|
| 248 |
+
for domain, count in sorted(domain_counts.items(), key=lambda x: -x[1])[:10]:
|
| 249 |
+
st.write(f"- **{domain}** : {count} emails")
|
| 250 |
+
st.markdown("---")
|
| 251 |
+
if validate_dns:
|
| 252 |
+
st.write("**Validation DNS :**")
|
| 253 |
+
dns_valid_count = sum(1 for e in results['all_emails'] if e.get('dns_valid') == True)
|
| 254 |
+
dns_invalid_count = sum(1 for e in results['all_emails'] if e.get('dns_valid') == False)
|
| 255 |
+
col_dns1, col_dns2 = st.columns(2)
|
| 256 |
+
with col_dns1:
|
| 257 |
+
st.metric("✅ DNS Valides", dns_valid_count)
|
| 258 |
+
with col_dns2:
|
| 259 |
+
st.metric("❌ DNS Invalides", dns_invalid_count)
|
| 260 |
+
st.markdown("---")
|
| 261 |
+
st.write("**Performance du scan :**")
|
| 262 |
+
st.write(f"- URLs scannées : {len(results['urls_scanned'])}")
|
| 263 |
+
st.write(f"- Succès : {results['successful_scans']}")
|
| 264 |
+
st.write(f"- Échecs : {results['failed_scans']}")
|
| 265 |
+
st.write(f"- Taux de réussite : {(results['successful_scans'] / len(results['urls_scanned']) * 100):.1f}%")
|
| 266 |
+
|
| 267 |
+
with tab4:
|
| 268 |
+
st.subheader("📥 Exportation des données")
|
| 269 |
+
export_choice = st.radio(
|
| 270 |
+
"Que voulez-vous exporter ?",
|
| 271 |
+
options=["Emails uniquement", "Données complètes (avec sources)"],
|
| 272 |
+
index=1
|
| 273 |
+
)
|
| 274 |
+
col_exp1, col_exp2 = st.columns(2)
|
| 275 |
+
with col_exp1:
|
| 276 |
+
if export_choice == "Emails uniquement":
|
| 277 |
+
emails_only = '\n'.join(sorted(results['unique_emails']))
|
| 278 |
+
st.download_button(
|
| 279 |
+
label="📧 Télécharger liste d'emails (TXT)",
|
| 280 |
+
data=emails_only.encode('utf-8'),
|
| 281 |
+
file_name=f"emails_{time.strftime('%Y%m%d_%H%M%S')}.txt",
|
| 282 |
+
mime="text/plain",
|
| 283 |
+
use_container_width=True
|
| 284 |
+
)
|
| 285 |
+
else:
|
| 286 |
+
export_df = pd.DataFrame(results['all_emails'])
|
| 287 |
+
export_df['timestamp'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
| 288 |
+
st.download_button(
|
| 289 |
+
label="📥 Télécharger données complètes (CSV)",
|
| 290 |
+
data=export_df.to_csv(index=False, encoding='utf-8-sig').encode('utf-8-sig'),
|
| 291 |
+
file_name=f"emails_complet_{time.strftime('%Y%m%d_%H%M%S')}.csv",
|
| 292 |
+
mime="text/csv",
|
| 293 |
+
use_container_width=True
|
| 294 |
+
)
|
| 295 |
+
with col_exp2:
|
| 296 |
+
if results.get('report_filename'):
|
| 297 |
+
report_path = os.path.join('reports', results['report_filename'])
|
| 298 |
+
if os.path.exists(report_path):
|
| 299 |
+
with open(report_path, 'rb') as f:
|
| 300 |
+
report_content = f.read()
|
| 301 |
+
st.download_button(
|
| 302 |
+
label="📄 Télécharger le rapport auto-généré",
|
| 303 |
+
data=report_content,
|
| 304 |
+
file_name=results['report_filename'],
|
| 305 |
+
mime="text/csv",
|
| 306 |
+
use_container_width=True
|
| 307 |
+
)
|
| 308 |
+
with st.expander("👁️ Aperçu des données exportables"):
|
| 309 |
+
if export_choice == "Emails uniquement":
|
| 310 |
+
st.code(emails_only)
|
| 311 |
+
else:
|
| 312 |
+
st.dataframe(export_df, width='stretch')
|
| 313 |
+
st.caption(f"""
|
| 314 |
+
📊 **Format du rapport**
|
| 315 |
+
- Total d'emails : {len(results['all_emails'])}
|
| 316 |
+
- Emails uniques : {results['total_found']}
|
| 317 |
+
- Encodage : UTF-8 {'BOM ' if export_choice != 'Emails uniquement' else ''}
|
| 318 |
+
""")
|
| 319 |
+
|
| 320 |
+
else:
|
| 321 |
+
st.warning("⚠️ Aucun email trouvé")
|
| 322 |
+
if results['failed_scans'] > 0:
|
| 323 |
+
st.error(f"❌ {results['failed_scans']} URL(s) ont échoué")
|
| 324 |
+
with st.expander("🔍 Détails des échecs"):
|
| 325 |
+
for scan in results['urls_scanned']:
|
| 326 |
+
if scan['status'] != 'success':
|
| 327 |
+
st.write(f"**{scan['url']}** : {scan.get('error', 'Erreur inconnue')}")
|
| 328 |
+
|
| 329 |
+
st.markdown("---")
|
| 330 |
+
st.caption("🕵️ Ba7ath OSINT Suite | Module Email Harvester - Extraction passive")
|
| 331 |
+
|
| 332 |
+
with st.expander("💡 Conseils d'utilisation"):
|
| 333 |
+
st.markdown("""
|
| 334 |
+
### 🎯 Meilleures pratiques
|
| 335 |
+
|
| 336 |
+
**Pages à cibler en priorité** :
|
| 337 |
+
- Pages "Contact"
|
| 338 |
+
- Pages "À propos"
|
| 339 |
+
- Pages "Équipe"
|
| 340 |
+
- Communiqués de presse
|
| 341 |
+
- Pages de support
|
| 342 |
+
|
| 343 |
+
**Optimisation** :
|
| 344 |
+
- Désactiver "Suivre les liens" pour un scan rapide
|
| 345 |
+
- Activer "Validation DNS" pour filtrer les faux emails
|
| 346 |
+
- Utiliser le mode batch pour plusieurs domaines
|
| 347 |
+
|
| 348 |
+
**Limites** :
|
| 349 |
+
- Les emails protégés par CloudFlare peuvent ne pas être détectés
|
| 350 |
+
- Les emails en images (captcha) ne sont pas extraits
|
| 351 |
+
- Respect automatique du fichier robots.txt
|
| 352 |
+
|
| 353 |
+
**Performance** :
|
| 354 |
+
- ~3 secondes par URL sans suivre les liens
|
| 355 |
+
- ~10-30 secondes avec suivi des liens (selon le site)
|
| 356 |
+
- Rate limiting automatique (2s entre requêtes)
|
| 357 |
+
""")
|
pages/12_SocialMentions.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Page Streamlit : Social Mentions Finder (Recherche mentions sur réseaux sociaux)
|
| 3 |
+
Module OSINT pour Ba7ath
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import streamlit as st
|
| 7 |
+
import sys
|
| 8 |
+
import os
|
| 9 |
+
|
| 10 |
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'spectre_modules'))
|
| 11 |
+
from social_mentions import search_social_mentions, SOCIAL_SITES
|
| 12 |
+
|
| 13 |
+
st.set_page_config(page_title="Social Mentions Finder", page_icon="🔎", layout="wide")
|
| 14 |
+
|
| 15 |
+
st.title("🔎 Recherche de mentions sur réseaux sociaux")
|
| 16 |
+
st.caption("Recherche passive : pseudo, nom, marque, email – résultats publics via DuckDuckGo")
|
| 17 |
+
|
| 18 |
+
st.markdown("---")
|
| 19 |
+
|
| 20 |
+
query = st.text_input(
|
| 21 |
+
"🔍 Mot-clé (nom, pseudo, e-mail, organisation...)",
|
| 22 |
+
placeholder="elon musk / @handle / AcmeCorp / user@gmail.com"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
platform_choices = st.multiselect(
|
| 26 |
+
"Réseaux à scanner",
|
| 27 |
+
options=list(SOCIAL_SITES.keys()),
|
| 28 |
+
default=list(SOCIAL_SITES.keys())
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
max_results = st.slider(
|
| 32 |
+
"Nb de résultats par plateforme",
|
| 33 |
+
min_value=3, max_value=30, value=10
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
cooldown = st.slider(
|
| 37 |
+
"Anti-blocage : délai entre les recherches (en s)",
|
| 38 |
+
min_value=0.5, max_value=10.0, value=1.5, step=0.5
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
if st.button("🚀 Lancer la collecte", type="primary") and query.strip():
|
| 42 |
+
st.info("⏳ Recherche en cours...")
|
| 43 |
+
results = search_social_mentions(query.strip(), platforms=platform_choices, max_results=max_results, cooldown=cooldown)
|
| 44 |
+
|
| 45 |
+
st.success("✅ Recherche terminée")
|
| 46 |
+
for platform in platform_choices:
|
| 47 |
+
hits = results.get(platform, [])
|
| 48 |
+
st.subheader(f"{platform} ({len(hits)})")
|
| 49 |
+
if not hits:
|
| 50 |
+
st.info("Aucun résultat trouvé.")
|
| 51 |
+
else:
|
| 52 |
+
for hit in hits:
|
| 53 |
+
t, u, s = hit.get("title"), hit.get("url"), hit.get("snippet")
|
| 54 |
+
if u:
|
| 55 |
+
st.markdown(f"**[{t or u}]({u})**")
|
| 56 |
+
if s:
|
| 57 |
+
st.caption(s)
|
| 58 |
+
if hit.get("error"):
|
| 59 |
+
st.error(f"Erreur : {hit['error']}")
|
| 60 |
+
st.markdown("---")
|
| 61 |
+
|
| 62 |
+
st.markdown("---")
|
| 63 |
+
st.caption("🕵️ Ba7ath OSINT Suite | Social Mentions Finder (via DuckDuckGo)")
|
pages/13_MaigretScan.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
pages/14_SocialFinder.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
pages/15_SpiderFoot.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
pages/16_FB_extractor.py
ADDED
|
@@ -0,0 +1,1168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Ba7ath OSINT Suite - Facebook Dorking Module
|
| 3 |
+
Recherche avancée Facebook avec opérateurs Google Dorking + Extraction complète
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import streamlit as st
|
| 7 |
+
from googleapiclient.discovery import build
|
| 8 |
+
import pandas as pd
|
| 9 |
+
import json
|
| 10 |
+
from datetime import datetime
|
| 11 |
+
import time
|
| 12 |
+
import os
|
| 13 |
+
import requests
|
| 14 |
+
from bs4 import BeautifulSoup
|
| 15 |
+
import re
|
| 16 |
+
from dotenv import load_dotenv
|
| 17 |
+
|
| 18 |
+
load_dotenv()
|
| 19 |
+
|
| 20 |
+
# ===== CONFIGURATION PAGE =====
|
| 21 |
+
st.set_page_config(
|
| 22 |
+
page_title="FB extractor - Ba7ath",
|
| 23 |
+
page_icon="🔍",
|
| 24 |
+
layout="wide"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
# ===== CSS HARMONISÉ AVEC LE DASHBOARD =====
|
| 28 |
+
st.markdown("""
|
| 29 |
+
<style>
|
| 30 |
+
.main-header {
|
| 31 |
+
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
|
| 32 |
+
padding: 2rem;
|
| 33 |
+
border-radius: 10px;
|
| 34 |
+
color: white;
|
| 35 |
+
text-align: center;
|
| 36 |
+
margin-bottom: 2rem;
|
| 37 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
| 38 |
+
}
|
| 39 |
+
.metric-card {
|
| 40 |
+
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
| 41 |
+
padding: 1.5rem;
|
| 42 |
+
border-radius: 8px;
|
| 43 |
+
border-left: 4px solid #3b82f6;
|
| 44 |
+
margin: 0.5rem 0;
|
| 45 |
+
}
|
| 46 |
+
.result-card {
|
| 47 |
+
background: white;
|
| 48 |
+
padding: 1.5rem;
|
| 49 |
+
border-radius: 8px;
|
| 50 |
+
border: 1px solid #e2e8f0;
|
| 51 |
+
margin-bottom: 1rem;
|
| 52 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
| 53 |
+
transition: transform 0.2s;
|
| 54 |
+
}
|
| 55 |
+
.result-card:hover {
|
| 56 |
+
transform: translateY(-2px);
|
| 57 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 58 |
+
}
|
| 59 |
+
.query-preview {
|
| 60 |
+
background: #1e293b;
|
| 61 |
+
color: #e2e8f0;
|
| 62 |
+
padding: 1rem;
|
| 63 |
+
border-radius: 6px;
|
| 64 |
+
font-family: 'Courier New', monospace;
|
| 65 |
+
font-size: 0.9em;
|
| 66 |
+
overflow-x: auto;
|
| 67 |
+
}
|
| 68 |
+
.success-banner {
|
| 69 |
+
background: #dcfce7;
|
| 70 |
+
border-left: 4px solid #22c55e;
|
| 71 |
+
color: #166534;
|
| 72 |
+
padding: 1rem;
|
| 73 |
+
border-radius: 8px;
|
| 74 |
+
margin: 1rem 0;
|
| 75 |
+
}
|
| 76 |
+
.warning-banner {
|
| 77 |
+
background: #fef3c7;
|
| 78 |
+
border-left: 4px solid #eab308;
|
| 79 |
+
color: #92400e;
|
| 80 |
+
padding: 1rem;
|
| 81 |
+
border-radius: 8px;
|
| 82 |
+
}
|
| 83 |
+
.info-box {
|
| 84 |
+
background: #dbeafe;
|
| 85 |
+
border-left: 4px solid #3b82f6;
|
| 86 |
+
color: #1e40af;
|
| 87 |
+
padding: 1rem;
|
| 88 |
+
border-radius: 8px;
|
| 89 |
+
margin: 1rem 0;
|
| 90 |
+
}
|
| 91 |
+
.full-content-badge {
|
| 92 |
+
background: #22c55e;
|
| 93 |
+
color: white;
|
| 94 |
+
padding: 0.2rem 0.5rem;
|
| 95 |
+
border-radius: 4px;
|
| 96 |
+
font-size: 0.7em;
|
| 97 |
+
margin-left: 0.5rem;
|
| 98 |
+
}
|
| 99 |
+
</style>
|
| 100 |
+
""", unsafe_allow_html=True)
|
| 101 |
+
|
| 102 |
+
# ===== INITIALISATION SESSION STATE =====
|
| 103 |
+
if 'fb_search_results' not in st.session_state:
|
| 104 |
+
st.session_state['fb_search_results'] = []
|
| 105 |
+
if 'fb_search_history' not in st.session_state:
|
| 106 |
+
st.session_state['fb_search_history'] = []
|
| 107 |
+
if 'fb_saved_queries' not in st.session_state:
|
| 108 |
+
st.session_state['fb_saved_queries'] = []
|
| 109 |
+
|
| 110 |
+
# ===== FONCTIONS UTILITAIRES =====
|
| 111 |
+
def ensure_directories():
|
| 112 |
+
"""Créer les dossiers nécessaires"""
|
| 113 |
+
for directory in ['reports', 'exports']:
|
| 114 |
+
os.makedirs(directory, exist_ok=True)
|
| 115 |
+
|
| 116 |
+
def build_dork_query(fb_url, keywords_list, operators):
|
| 117 |
+
"""Construit les requêtes Google Dorking"""
|
| 118 |
+
queries = []
|
| 119 |
+
page_name = fb_url.split('facebook.com/')[-1].strip('/')
|
| 120 |
+
|
| 121 |
+
for keyword in keywords_list:
|
| 122 |
+
query_parts = []
|
| 123 |
+
|
| 124 |
+
# Opérateur site:
|
| 125 |
+
if operators.get('use_site'):
|
| 126 |
+
query_parts.append(f'site:facebook.com/{page_name}')
|
| 127 |
+
|
| 128 |
+
# Mode de recherche
|
| 129 |
+
if operators.get('keywords_mode') == "Phrase exacte":
|
| 130 |
+
query_parts.append(f'"{keyword}"')
|
| 131 |
+
elif operators.get('keywords_mode') == "Tous les mots":
|
| 132 |
+
query_parts.append(f'allintext:{keyword}')
|
| 133 |
+
else:
|
| 134 |
+
query_parts.append(keyword)
|
| 135 |
+
|
| 136 |
+
# Opérateurs additionnels
|
| 137 |
+
if operators.get('use_inurl') and operators.get('inurl_term'):
|
| 138 |
+
query_parts.append(f'inurl:{operators["inurl_term"]}')
|
| 139 |
+
|
| 140 |
+
if operators.get('use_intext') and operators.get('intext_term'):
|
| 141 |
+
query_parts.append(f'intext:{operators["intext_term"]}')
|
| 142 |
+
|
| 143 |
+
if operators.get('use_intitle') and operators.get('intitle_term'):
|
| 144 |
+
query_parts.append(f'intitle:{operators["intitle_term"]}')
|
| 145 |
+
|
| 146 |
+
if operators.get('use_filetype') and operators.get('filetype'):
|
| 147 |
+
query_parts.append(f'filetype:{operators["filetype"]}')
|
| 148 |
+
|
| 149 |
+
# Exclusions
|
| 150 |
+
if operators.get('exclude_terms'):
|
| 151 |
+
for term in operators['exclude_terms'].split(','):
|
| 152 |
+
if term.strip():
|
| 153 |
+
query_parts.append(f'-{term.strip()}')
|
| 154 |
+
|
| 155 |
+
# Inclusions obligatoires
|
| 156 |
+
if operators.get('include_terms'):
|
| 157 |
+
for term in operators['include_terms'].split(','):
|
| 158 |
+
if term.strip():
|
| 159 |
+
query_parts.append(f'+{term.strip()}')
|
| 160 |
+
|
| 161 |
+
queries.append(' '.join(query_parts))
|
| 162 |
+
|
| 163 |
+
return queries
|
| 164 |
+
|
| 165 |
+
def extract_full_content(url):
|
| 166 |
+
"""
|
| 167 |
+
Extrait le contenu complet d'un post Facebook via scraping
|
| 168 |
+
"""
|
| 169 |
+
try:
|
| 170 |
+
headers = {
|
| 171 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
| 172 |
+
'Accept-Language': 'ar,en;q=0.9,fr;q=0.8',
|
| 173 |
+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
| 174 |
+
'Accept-Encoding': 'gzip, deflate',
|
| 175 |
+
'Connection': 'keep-alive',
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
response = requests.get(url, headers=headers, timeout=15)
|
| 179 |
+
response.encoding = 'utf-8'
|
| 180 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
| 181 |
+
|
| 182 |
+
# Liste pour stocker les contenus trouvés
|
| 183 |
+
content_texts = []
|
| 184 |
+
|
| 185 |
+
# Méthode 1: Chercher les divs avec attributs data-ad-preview
|
| 186 |
+
for div in soup.find_all('div', {'data-ad-preview': 'message'}):
|
| 187 |
+
text = div.get_text(separator=' ', strip=True)
|
| 188 |
+
if len(text) > 50:
|
| 189 |
+
content_texts.append(text)
|
| 190 |
+
|
| 191 |
+
# Méthode 2: Chercher les éléments avec classe contenant "userContent"
|
| 192 |
+
if not content_texts:
|
| 193 |
+
for elem in soup.find_all(['div', 'p'], class_=re.compile(r'userContent|_5pbx')):
|
| 194 |
+
text = elem.get_text(separator=' ', strip=True)
|
| 195 |
+
if len(text) > 50:
|
| 196 |
+
content_texts.append(text)
|
| 197 |
+
|
| 198 |
+
# Méthode 3: Chercher tous les paragraphes conséquents
|
| 199 |
+
if not content_texts:
|
| 200 |
+
for p in soup.find_all('p'):
|
| 201 |
+
text = p.get_text(separator=' ', strip=True)
|
| 202 |
+
if len(text) > 100: # Paragraphes substantiels
|
| 203 |
+
content_texts.append(text)
|
| 204 |
+
|
| 205 |
+
# Méthode 4: Chercher les spans avec direction RTL (pour l'arabe)
|
| 206 |
+
if not content_texts:
|
| 207 |
+
for span in soup.find_all('span', dir='auto'):
|
| 208 |
+
text = span.get_text(separator=' ', strip=True)
|
| 209 |
+
if len(text) > 100:
|
| 210 |
+
content_texts.append(text)
|
| 211 |
+
|
| 212 |
+
# Méthode 5: Extraire tout le texte visible (dernier recours)
|
| 213 |
+
if not content_texts:
|
| 214 |
+
# Supprimer les scripts et styles
|
| 215 |
+
for script in soup(['script', 'style', 'header', 'footer', 'nav']):
|
| 216 |
+
script.decompose()
|
| 217 |
+
|
| 218 |
+
text = soup.get_text(separator=' ', strip=True)
|
| 219 |
+
# Nettoyer les espaces multiples
|
| 220 |
+
text = re.sub(r'\s+', ' ', text)
|
| 221 |
+
if len(text) > 200:
|
| 222 |
+
content_texts.append(text[:3000]) # Limiter à 3000 caractères
|
| 223 |
+
|
| 224 |
+
# Dédupliquer et joindre
|
| 225 |
+
if content_texts:
|
| 226 |
+
# Supprimer les doublons en gardant l'ordre
|
| 227 |
+
seen = set()
|
| 228 |
+
unique_texts = []
|
| 229 |
+
for text in content_texts:
|
| 230 |
+
if text not in seen and len(text) > 50:
|
| 231 |
+
seen.add(text)
|
| 232 |
+
unique_texts.append(text)
|
| 233 |
+
|
| 234 |
+
full_text = '\n\n'.join(unique_texts)
|
| 235 |
+
|
| 236 |
+
# Limiter la longueur totale
|
| 237 |
+
if len(full_text) > 5000:
|
| 238 |
+
full_text = full_text[:5000] + '...'
|
| 239 |
+
|
| 240 |
+
return full_text
|
| 241 |
+
|
| 242 |
+
return None
|
| 243 |
+
|
| 244 |
+
except requests.exceptions.Timeout:
|
| 245 |
+
return "⏱️ Timeout: Le serveur n'a pas répondu à temps"
|
| 246 |
+
except requests.exceptions.RequestException as e:
|
| 247 |
+
return f"❌ Erreur réseau: {str(e)[:100]}"
|
| 248 |
+
except Exception as e:
|
| 249 |
+
return f"❌ Erreur extraction: {str(e)[:100]}"
|
| 250 |
+
|
| 251 |
+
def enrich_results_with_full_content(results, max_items=10):
|
| 252 |
+
"""
|
| 253 |
+
Enrichit les résultats avec le contenu complet
|
| 254 |
+
"""
|
| 255 |
+
enriched = []
|
| 256 |
+
|
| 257 |
+
progress_bar = st.progress(0)
|
| 258 |
+
status = st.empty()
|
| 259 |
+
|
| 260 |
+
for idx, result in enumerate(results[:max_items], 1):
|
| 261 |
+
status.text(f"📥 Extraction contenu complet... {idx}/{min(len(results), max_items)}")
|
| 262 |
+
|
| 263 |
+
# Extraire le contenu complet
|
| 264 |
+
full_content = extract_full_content(result['link'])
|
| 265 |
+
|
| 266 |
+
# Créer le résultat enrichi
|
| 267 |
+
enriched_result = result.copy()
|
| 268 |
+
|
| 269 |
+
if full_content and not full_content.startswith('❌') and not full_content.startswith('⏱️'):
|
| 270 |
+
enriched_result['full_content'] = full_content
|
| 271 |
+
enriched_result['content_length'] = len(full_content)
|
| 272 |
+
enriched_result['is_enriched'] = True
|
| 273 |
+
else:
|
| 274 |
+
enriched_result['full_content'] = result['snippet']
|
| 275 |
+
enriched_result['content_length'] = len(result['snippet'])
|
| 276 |
+
enriched_result['is_enriched'] = False
|
| 277 |
+
if full_content and (full_content.startswith('❌') or full_content.startswith('⏱️')):
|
| 278 |
+
enriched_result['extraction_error'] = full_content
|
| 279 |
+
|
| 280 |
+
enriched.append(enriched_result)
|
| 281 |
+
|
| 282 |
+
progress_bar.progress(idx / min(len(results), max_items))
|
| 283 |
+
time.sleep(1.5) # Pause pour éviter rate limiting
|
| 284 |
+
|
| 285 |
+
# Ajouter les résultats non-enrichis
|
| 286 |
+
if len(results) > max_items:
|
| 287 |
+
for result in results[max_items:]:
|
| 288 |
+
enriched.append({
|
| 289 |
+
**result,
|
| 290 |
+
'full_content': result['snippet'],
|
| 291 |
+
'content_length': len(result['snippet']),
|
| 292 |
+
'is_enriched': False
|
| 293 |
+
})
|
| 294 |
+
|
| 295 |
+
progress_bar.empty()
|
| 296 |
+
status.empty()
|
| 297 |
+
|
| 298 |
+
return enriched
|
| 299 |
+
|
| 300 |
+
def execute_google_search(api_key, cx, query, max_results=50, lang="ar"):
|
| 301 |
+
"""Exécute la recherche Google Custom Search"""
|
| 302 |
+
try:
|
| 303 |
+
service = build("customsearch", "v1", developerKey=api_key)
|
| 304 |
+
all_results = []
|
| 305 |
+
start = 1
|
| 306 |
+
|
| 307 |
+
progress_bar = st.progress(0)
|
| 308 |
+
status = st.empty()
|
| 309 |
+
|
| 310 |
+
while len(all_results) < max_results:
|
| 311 |
+
status.text(f"🔍 Recherche en cours... {len(all_results)}/{max_results} résultats")
|
| 312 |
+
|
| 313 |
+
params = {
|
| 314 |
+
'q': query,
|
| 315 |
+
'cx': cx,
|
| 316 |
+
'start': start,
|
| 317 |
+
'num': min(10, max_results - len(all_results))
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
if lang != "Auto":
|
| 321 |
+
params['lr'] = f"lang_{lang}"
|
| 322 |
+
|
| 323 |
+
result = service.cse().list(**params).execute()
|
| 324 |
+
|
| 325 |
+
if 'items' not in result:
|
| 326 |
+
status.success(f"✅ Recherche terminée: {len(all_results)} résultats trouvés")
|
| 327 |
+
break
|
| 328 |
+
|
| 329 |
+
for item in result['items']:
|
| 330 |
+
all_results.append({
|
| 331 |
+
'title': item.get('title', ''),
|
| 332 |
+
'link': item.get('link', ''),
|
| 333 |
+
'snippet': item.get('snippet', ''),
|
| 334 |
+
'displayLink': item.get('displayLink', ''),
|
| 335 |
+
'formattedUrl': item.get('formattedUrl', ''),
|
| 336 |
+
'timestamp': datetime.now().isoformat(),
|
| 337 |
+
'query': query
|
| 338 |
+
})
|
| 339 |
+
|
| 340 |
+
progress_bar.progress(min(len(all_results) / max_results, 1.0))
|
| 341 |
+
|
| 342 |
+
if 'queries' not in result or 'nextPage' not in result['queries']:
|
| 343 |
+
status.success(f"✅ Dernière page atteinte: {len(all_results)} résultats")
|
| 344 |
+
break
|
| 345 |
+
|
| 346 |
+
start += 10
|
| 347 |
+
time.sleep(1) # Pause pour éviter rate limiting
|
| 348 |
+
|
| 349 |
+
progress_bar.empty()
|
| 350 |
+
status.empty()
|
| 351 |
+
return all_results
|
| 352 |
+
|
| 353 |
+
except Exception as e:
|
| 354 |
+
st.error(f"❌ Erreur API: {str(e)}")
|
| 355 |
+
if "quota" in str(e).lower():
|
| 356 |
+
st.markdown("""
|
| 357 |
+
<div class="warning-banner">
|
| 358 |
+
<strong>⚠️ Quota API dépassé</strong><br>
|
| 359 |
+
Limite gratuite: 100 requêtes/jour<br>
|
| 360 |
+
Réessayez dans 24h ou utilisez une autre clé API
|
| 361 |
+
</div>
|
| 362 |
+
""", unsafe_allow_html=True)
|
| 363 |
+
return []
|
| 364 |
+
|
| 365 |
+
def save_results_to_reports(results, prefix="facebook_dorking"):
|
| 366 |
+
"""Sauvegarde dans le dossier reports/ (compatible avec l'architecture Ba7ath)"""
|
| 367 |
+
ensure_directories()
|
| 368 |
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 369 |
+
|
| 370 |
+
# JSON
|
| 371 |
+
json_file = f"reports/{prefix}_{timestamp}.json"
|
| 372 |
+
with open(json_file, 'w', encoding='utf-8') as f:
|
| 373 |
+
json.dump(results, f, ensure_ascii=False, indent=2)
|
| 374 |
+
|
| 375 |
+
# CSV
|
| 376 |
+
if results:
|
| 377 |
+
df = pd.DataFrame(results)
|
| 378 |
+
csv_file = f"reports/{prefix}_{timestamp}.csv"
|
| 379 |
+
df.to_csv(csv_file, index=False, encoding='utf-8-sig')
|
| 380 |
+
return json_file, csv_file
|
| 381 |
+
|
| 382 |
+
return json_file, None
|
| 383 |
+
|
| 384 |
+
# ===== HEADER =====
|
| 385 |
+
st.markdown("""
|
| 386 |
+
<div class="main-header">
|
| 387 |
+
<h1>🔍 Facebook Dorking OSINT</h1>
|
| 388 |
+
<p style="font-size: 1.1em; margin-top: 0.5rem;">Recherche avancée sur Facebook avec opérateurs Google</p>
|
| 389 |
+
<p style="font-size: 0.9em; opacity: 0.9; margin-top: 0.5rem;">
|
| 390 |
+
Module professionnel pour investigation sur pages Facebook publiques
|
| 391 |
+
</p>
|
| 392 |
+
</div>
|
| 393 |
+
""", unsafe_allow_html=True)
|
| 394 |
+
|
| 395 |
+
st.markdown("""
|
| 396 |
+
### 📖 À propos de ce module
|
| 397 |
+
|
| 398 |
+
Ce module vous permet d'exploiter la puissance du **Google Dorking** pour rechercher du contenu spécifique
|
| 399 |
+
sur les pages Facebook publiques, sans avoir besoin d'un compte Facebook ou d'accès administrateur.
|
| 400 |
+
|
| 401 |
+
**Cas d'usage typiques :**
|
| 402 |
+
- 🎯 Recherche de communiqués officiels (ministères, ambassades)
|
| 403 |
+
- 📰 Investigation sur des déclarations publiques
|
| 404 |
+
- 🔎 Extraction de mentions spécifiques (convocations, nominations, etc.)
|
| 405 |
+
- 📊 Analyse de communication d'organisations
|
| 406 |
+
|
| 407 |
+
**✨ Nouvelle fonctionnalité :** Extraction du contenu complet des posts (au-delà du snippet de 160 caractères)
|
| 408 |
+
|
| 409 |
+
> **Note :** Toutes les recherches respectent les limites de l'API Google (100 requêtes/jour en version gratuite).
|
| 410 |
+
> Les données ne sont pas partagées avec des tiers et restent sur votre machine.
|
| 411 |
+
""")
|
| 412 |
+
|
| 413 |
+
# ===== SIDEBAR CONFIGURATION =====
|
| 414 |
+
with st.sidebar:
|
| 415 |
+
st.markdown("### ⚙️ Configuration API")
|
| 416 |
+
|
| 417 |
+
st.markdown("""
|
| 418 |
+
<div class="info-box" style="font-size: 0.85em; margin-bottom: 1rem;">
|
| 419 |
+
<strong>ℹ️ Prérequis</strong><br>
|
| 420 |
+
Vous devez disposer d'une clé API Google Custom Search.<br>
|
| 421 |
+
<a href="https://developers.google.com/custom-search/v1/introduction" target="_blank">
|
| 422 |
+
📚 Guide de configuration
|
| 423 |
+
</a>
|
| 424 |
+
</div>
|
| 425 |
+
""", unsafe_allow_html=True)
|
| 426 |
+
|
| 427 |
+
api_key = st.text_input(
|
| 428 |
+
"🔑 Clé API Google",
|
| 429 |
+
value=os.environ.get("GOOGLE_API_KEY", ""),
|
| 430 |
+
type="password",
|
| 431 |
+
help="Votre clé API Google Custom Search"
|
| 432 |
+
)
|
| 433 |
+
|
| 434 |
+
cx = st.text_input(
|
| 435 |
+
"🎯 Search Engine ID (cx)",
|
| 436 |
+
value=os.environ.get("GOOGLE_CX", ""),
|
| 437 |
+
help="ID de votre moteur de recherche personnalisé"
|
| 438 |
+
)
|
| 439 |
+
|
| 440 |
+
if st.button("🧪 Tester la connexion API"):
|
| 441 |
+
if api_key and cx:
|
| 442 |
+
try:
|
| 443 |
+
service = build("customsearch", "v1", developerKey=api_key)
|
| 444 |
+
result = service.cse().list(q="test", cx=cx, num=1).execute()
|
| 445 |
+
st.success("✅ API fonctionnelle!")
|
| 446 |
+
st.caption(f"Requêtes restantes aujourd'hui: ~{100 - len(st.session_state.get('fb_search_history', []))}")
|
| 447 |
+
except Exception as e:
|
| 448 |
+
st.error(f"❌ Erreur: {str(e)}")
|
| 449 |
+
else:
|
| 450 |
+
st.warning("⚠️ Veuillez remplir les deux champs")
|
| 451 |
+
|
| 452 |
+
st.divider()
|
| 453 |
+
|
| 454 |
+
st.markdown("### 📊 Paramètres de recherche")
|
| 455 |
+
max_results = st.slider(
|
| 456 |
+
"Résultats max par requête",
|
| 457 |
+
min_value=10,
|
| 458 |
+
max_value=100,
|
| 459 |
+
value=50,
|
| 460 |
+
step=10,
|
| 461 |
+
help="Maximum: 100 résultats (limitation Google)"
|
| 462 |
+
)
|
| 463 |
+
|
| 464 |
+
auto_save = st.checkbox(
|
| 465 |
+
"Sauvegarde automatique",
|
| 466 |
+
value=True,
|
| 467 |
+
help="Sauvegarder automatiquement dans /reports/"
|
| 468 |
+
)
|
| 469 |
+
|
| 470 |
+
st.divider()
|
| 471 |
+
|
| 472 |
+
st.markdown("### 📈 Statistiques de session")
|
| 473 |
+
|
| 474 |
+
col1, col2 = st.columns(2)
|
| 475 |
+
col1.metric("🔍 Recherches", len(st.session_state['fb_search_history']))
|
| 476 |
+
col2.metric("📄 Résultats", len(st.session_state['fb_search_results']))
|
| 477 |
+
|
| 478 |
+
if st.session_state['fb_search_history']:
|
| 479 |
+
last_search = st.session_state['fb_search_history'][-1]
|
| 480 |
+
st.caption(f"Dernière recherche: {last_search['timestamp'][:19]}")
|
| 481 |
+
st.caption(f"Résultats obtenus: {last_search['count']}")
|
| 482 |
+
|
| 483 |
+
# ===== TABS PRINCIPALES =====
|
| 484 |
+
tab1, tab2, tab3, tab4 = st.tabs([
|
| 485 |
+
"🎯 Recherche",
|
| 486 |
+
"📊 Résultats",
|
| 487 |
+
"📖 Guide Dorking",
|
| 488 |
+
"⚡ Templates"
|
| 489 |
+
])
|
| 490 |
+
|
| 491 |
+
# ===== TAB 1: RECHERCHE =====
|
| 492 |
+
with tab1:
|
| 493 |
+
st.subheader("🎯 Configuration de la recherche")
|
| 494 |
+
|
| 495 |
+
# URL cible
|
| 496 |
+
col1, col2 = st.columns([3, 1])
|
| 497 |
+
|
| 498 |
+
with col1:
|
| 499 |
+
fb_url = st.text_input(
|
| 500 |
+
"🔗 URL de la page Facebook",
|
| 501 |
+
value="https://www.facebook.com/TunisieDiplo",
|
| 502 |
+
help="URL complète de la page Facebook à analyser",
|
| 503 |
+
placeholder="https://www.facebook.com/nom_page"
|
| 504 |
+
)
|
| 505 |
+
|
| 506 |
+
with col2:
|
| 507 |
+
account_type = st.selectbox(
|
| 508 |
+
"Type de compte",
|
| 509 |
+
["Page", "Profile", "Group"],
|
| 510 |
+
help="Type de compte Facebook"
|
| 511 |
+
)
|
| 512 |
+
|
| 513 |
+
st.divider()
|
| 514 |
+
|
| 515 |
+
# Mots-clés
|
| 516 |
+
st.subheader("🔤 Mots-clés de recherche")
|
| 517 |
+
|
| 518 |
+
col1, col2 = st.columns([2, 1])
|
| 519 |
+
|
| 520 |
+
with col1:
|
| 521 |
+
keywords_mode = st.radio(
|
| 522 |
+
"Mode de recherche",
|
| 523 |
+
["Phrase exacte", "Tous les mots", "Au moins un mot"],
|
| 524 |
+
horizontal=True,
|
| 525 |
+
help="Phrase exacte = guillemets, Tous les mots = allintext"
|
| 526 |
+
)
|
| 527 |
+
|
| 528 |
+
with col2:
|
| 529 |
+
st.markdown("**Options**")
|
| 530 |
+
rtl_support = st.checkbox("Support RTL (Arabe)", value=True)
|
| 531 |
+
|
| 532 |
+
keywords = st.text_area(
|
| 533 |
+
"Entrez vos mots-clés (un par ligne)",
|
| 534 |
+
value="استدعاء سفير\nاستدعى السفير\nسفير تونس",
|
| 535 |
+
height=120,
|
| 536 |
+
help="Chaque ligne génèrera une requête séparée"
|
| 537 |
+
)
|
| 538 |
+
|
| 539 |
+
if rtl_support:
|
| 540 |
+
st.markdown(f'<div dir="rtl" style="background: #f1f5f9; padding: 0.5rem; border-radius: 4px; font-size: 0.9em;">{keywords}</div>', unsafe_allow_html=True)
|
| 541 |
+
|
| 542 |
+
st.divider()
|
| 543 |
+
|
| 544 |
+
# Opérateurs Google
|
| 545 |
+
st.subheader("🛠️ Opérateurs Google Dorking")
|
| 546 |
+
|
| 547 |
+
col1, col2, col3 = st.columns(3)
|
| 548 |
+
|
| 549 |
+
with col1:
|
| 550 |
+
st.markdown("**📍 Localisation**")
|
| 551 |
+
use_site = st.checkbox("site:", value=True, help="Limiter à un site")
|
| 552 |
+
use_inurl = st.checkbox("inurl:", help="Mot dans l'URL")
|
| 553 |
+
inurl_term = st.text_input("Terme inurl:", disabled=not use_inurl, key="inurl", placeholder="posts")
|
| 554 |
+
|
| 555 |
+
with col2:
|
| 556 |
+
st.markdown("**📝 Contenu**")
|
| 557 |
+
use_intext = st.checkbox("intext:", help="Mot dans le texte")
|
| 558 |
+
intext_term = st.text_input("Terme intext:", disabled=not use_intext, key="intext", placeholder="officiel")
|
| 559 |
+
use_intitle = st.checkbox("intitle:", help="Mot dans le titre")
|
| 560 |
+
intitle_term = st.text_input("Terme intitle:", disabled=not use_intitle, key="intitle", placeholder="وزارة")
|
| 561 |
+
|
| 562 |
+
with col3:
|
| 563 |
+
st.markdown("**🔗 Filtres avancés**")
|
| 564 |
+
use_filetype = st.checkbox("filetype:", help="Type de fichier")
|
| 565 |
+
filetype = st.selectbox(
|
| 566 |
+
"Type de fichier",
|
| 567 |
+
["pdf", "doc", "docx", "xls", "xlsx", "jpg", "png"],
|
| 568 |
+
disabled=not use_filetype
|
| 569 |
+
)
|
| 570 |
+
|
| 571 |
+
exclude_terms = st.text_input("Exclure (séparés par ,)", placeholder="spam, publicité")
|
| 572 |
+
include_terms = st.text_input("Inclure obligatoirement", placeholder="gouvernement")
|
| 573 |
+
|
| 574 |
+
st.divider()
|
| 575 |
+
|
| 576 |
+
# Prévisualisation des requêtes
|
| 577 |
+
st.subheader("🔧 Prévisualisation des requêtes")
|
| 578 |
+
|
| 579 |
+
operators = {
|
| 580 |
+
'use_site': use_site,
|
| 581 |
+
'use_inurl': use_inurl,
|
| 582 |
+
'inurl_term': inurl_term,
|
| 583 |
+
'use_intext': use_intext,
|
| 584 |
+
'intext_term': intext_term,
|
| 585 |
+
'use_intitle': use_intitle,
|
| 586 |
+
'intitle_term': intitle_term,
|
| 587 |
+
'use_filetype': use_filetype,
|
| 588 |
+
'filetype': filetype if use_filetype else None,
|
| 589 |
+
'keywords_mode': keywords_mode,
|
| 590 |
+
'exclude_terms': exclude_terms,
|
| 591 |
+
'include_terms': include_terms
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
keywords_list = [k.strip() for k in keywords.split('\n') if k.strip()]
|
| 595 |
+
generated_queries = build_dork_query(fb_url, keywords_list, operators)
|
| 596 |
+
|
| 597 |
+
if generated_queries:
|
| 598 |
+
st.markdown(f"""
|
| 599 |
+
<div class="info-box">
|
| 600 |
+
<strong>📝 {len(generated_queries)} requête(s) générée(s)</strong><br>
|
| 601 |
+
Chaque requête consommera environ 1-10 appels API selon les résultats
|
| 602 |
+
</div>
|
| 603 |
+
""", unsafe_allow_html=True)
|
| 604 |
+
|
| 605 |
+
for i, query in enumerate(generated_queries, 1):
|
| 606 |
+
with st.expander(f"Requête {i}: {keywords_list[i-1][:50]}{'...' if len(keywords_list[i-1]) > 50 else ''}"):
|
| 607 |
+
st.markdown(f'<div class="query-preview">{query}</div>', unsafe_allow_html=True)
|
| 608 |
+
st.caption(f"Longueur: {len(query)} caractères | Mot-clé source: **{keywords_list[i-1]}**")
|
| 609 |
+
else:
|
| 610 |
+
st.warning("⚠️ Aucune requête générée. Vérifiez vos paramètres.")
|
| 611 |
+
|
| 612 |
+
st.divider()
|
| 613 |
+
|
| 614 |
+
# Boutons d'action
|
| 615 |
+
col1, col2, col3, col4 = st.columns([2, 1, 1, 1])
|
| 616 |
+
|
| 617 |
+
with col1:
|
| 618 |
+
search_btn = st.button(
|
| 619 |
+
"🚀 Lancer la recherche",
|
| 620 |
+
type="primary",
|
| 621 |
+
disabled=not api_key or not cx or not generated_queries
|
| 622 |
+
)
|
| 623 |
+
|
| 624 |
+
with col2:
|
| 625 |
+
lang = st.selectbox(
|
| 626 |
+
"Langue",
|
| 627 |
+
["ar", "fr", "en", "Auto"],
|
| 628 |
+
format_func=lambda x: {"ar": "🇹🇳 AR", "fr": "🇫🇷 FR", "en": "🇬🇧 EN", "Auto": "🌍 Auto"}[x]
|
| 629 |
+
)
|
| 630 |
+
|
| 631 |
+
with col3:
|
| 632 |
+
save_query_btn = st.button("💾 Sauvegarder config", disabled=not generated_queries)
|
| 633 |
+
|
| 634 |
+
with col4:
|
| 635 |
+
if st.button("🗑️ Réinitialiser"):
|
| 636 |
+
st.rerun()
|
| 637 |
+
|
| 638 |
+
# Exécution de la recherche
|
| 639 |
+
if search_btn:
|
| 640 |
+
with st.spinner("🔍 Recherche en cours..."):
|
| 641 |
+
all_results = []
|
| 642 |
+
|
| 643 |
+
# Barre de progression globale
|
| 644 |
+
main_progress = st.progress(0)
|
| 645 |
+
main_status = st.empty()
|
| 646 |
+
|
| 647 |
+
for idx, query in enumerate(generated_queries, 1):
|
| 648 |
+
main_status.info(f"📡 Requête {idx}/{len(generated_queries)}: {keywords_list[idx-1][:60]}...")
|
| 649 |
+
|
| 650 |
+
results = execute_google_search(api_key, cx, query, max_results, lang)
|
| 651 |
+
all_results.extend(results)
|
| 652 |
+
|
| 653 |
+
main_progress.progress(idx / len(generated_queries))
|
| 654 |
+
|
| 655 |
+
if idx < len(generated_queries):
|
| 656 |
+
time.sleep(2) # Pause entre requêtes
|
| 657 |
+
|
| 658 |
+
main_progress.empty()
|
| 659 |
+
main_status.empty()
|
| 660 |
+
|
| 661 |
+
# Dédupliquer par lien
|
| 662 |
+
unique_dict = {r['link']: r for r in all_results}
|
| 663 |
+
unique_results = list(unique_dict.values())
|
| 664 |
+
|
| 665 |
+
# NOUVELLE FONCTIONNALITÉ: Proposition d'extraction complète
|
| 666 |
+
if unique_results:
|
| 667 |
+
st.divider()
|
| 668 |
+
st.subheader("📥 Extraction du contenu complet")
|
| 669 |
+
|
| 670 |
+
st.markdown("""
|
| 671 |
+
<div class="info-box">
|
| 672 |
+
<strong>💡 Option avancée</strong><br>
|
| 673 |
+
L'API Google limite les extraits à ~160 caractères.
|
| 674 |
+
Activez l'extraction complète pour récupérer le texte intégral des posts.
|
| 675 |
+
</div>
|
| 676 |
+
""", unsafe_allow_html=True)
|
| 677 |
+
|
| 678 |
+
col1, col2 = st.columns([1, 1])
|
| 679 |
+
|
| 680 |
+
with col1:
|
| 681 |
+
extract_full = st.checkbox(
|
| 682 |
+
"✨ Extraire le contenu complet des posts",
|
| 683 |
+
value=False,
|
| 684 |
+
help="Télécharge les pages complètes (plus lent, ~2 sec/post)"
|
| 685 |
+
)
|
| 686 |
+
|
| 687 |
+
with col2:
|
| 688 |
+
if extract_full:
|
| 689 |
+
max_extract = st.slider(
|
| 690 |
+
"Nombre de posts à enrichir",
|
| 691 |
+
min_value=5,
|
| 692 |
+
max_value=min(50, len(unique_results)),
|
| 693 |
+
value=min(10, len(unique_results)),
|
| 694 |
+
help="Limiter pour éviter les timeouts"
|
| 695 |
+
)
|
| 696 |
+
|
| 697 |
+
if extract_full and st.button("🚀 Lancer l'extraction complète", type="primary"):
|
| 698 |
+
st.info(f"📥 Extraction en cours de {max_extract} post(s)...")
|
| 699 |
+
|
| 700 |
+
with st.spinner("Extraction du contenu complet..."):
|
| 701 |
+
unique_results = enrich_results_with_full_content(unique_results, max_extract)
|
| 702 |
+
|
| 703 |
+
enriched_count = sum(1 for r in unique_results if r.get('is_enriched', False))
|
| 704 |
+
st.success(f"✅ {enriched_count}/{max_extract} posts enrichis avec succès!")
|
| 705 |
+
|
| 706 |
+
# Stocker en session
|
| 707 |
+
st.session_state['fb_search_results'] = unique_results
|
| 708 |
+
st.session_state['fb_search_history'].append({
|
| 709 |
+
'timestamp': datetime.now().isoformat(),
|
| 710 |
+
'count': len(unique_results),
|
| 711 |
+
'queries': generated_queries,
|
| 712 |
+
'keywords': keywords_list
|
| 713 |
+
})
|
| 714 |
+
|
| 715 |
+
# Sauvegarde automatique
|
| 716 |
+
if auto_save and unique_results:
|
| 717 |
+
json_file, csv_file = save_results_to_reports(unique_results)
|
| 718 |
+
st.success(f"💾 Résultats sauvegardés:\n- {json_file}\n- {csv_file}")
|
| 719 |
+
|
| 720 |
+
# Affichage résumé
|
| 721 |
+
st.markdown(f"""
|
| 722 |
+
<div class="success-banner">
|
| 723 |
+
<strong>✅ Recherche terminée avec succès!</strong><br><br>
|
| 724 |
+
📊 <strong>{len(unique_results)}</strong> résultats uniques trouvés<br>
|
| 725 |
+
📝 <strong>{len(all_results)}</strong> résultats total<br>
|
| 726 |
+
🗑️ <strong>{len(all_results) - len(unique_results)}</strong> doublons supprimés<br>
|
| 727 |
+
🔍 <strong>{len(generated_queries)}</strong> requêtes exécutées
|
| 728 |
+
</div>
|
| 729 |
+
""", unsafe_allow_html=True)
|
| 730 |
+
|
| 731 |
+
st.balloons()
|
| 732 |
+
st.info("👉 Consultez l'onglet **📊 Résultats** pour voir les détails")
|
| 733 |
+
|
| 734 |
+
# Sauvegarde configuration
|
| 735 |
+
if save_query_btn:
|
| 736 |
+
ensure_directories()
|
| 737 |
+
config = {
|
| 738 |
+
'timestamp': datetime.now().isoformat(),
|
| 739 |
+
'facebook_url': fb_url,
|
| 740 |
+
'keywords': keywords_list,
|
| 741 |
+
'operators': operators,
|
| 742 |
+
'queries': generated_queries
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
filename = f"reports/fb_config_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
|
| 746 |
+
with open(filename, 'w', encoding='utf-8') as f:
|
| 747 |
+
json.dump(config, f, ensure_ascii=False, indent=2)
|
| 748 |
+
|
| 749 |
+
st.session_state['fb_saved_queries'].append(config)
|
| 750 |
+
st.success(f"✅ Configuration sauvegardée: {filename}")
|
| 751 |
+
|
| 752 |
+
# ===== TAB 2: RÉSULTATS =====
|
| 753 |
+
with tab2:
|
| 754 |
+
if st.session_state.get('fb_search_results'):
|
| 755 |
+
results = st.session_state['fb_search_results']
|
| 756 |
+
df = pd.DataFrame(results)
|
| 757 |
+
|
| 758 |
+
# Compter les résultats enrichis
|
| 759 |
+
enriched_count = sum(1 for r in results if r.get('is_enriched', False))
|
| 760 |
+
|
| 761 |
+
# Métriques en haut
|
| 762 |
+
st.subheader("📊 Vue d'ensemble des résultats")
|
| 763 |
+
|
| 764 |
+
col1, col2, col3, col4 = st.columns(4)
|
| 765 |
+
col1.metric("📊 Total résultats", len(results))
|
| 766 |
+
col2.metric("🌐 Domaines uniques", df['displayLink'].nunique())
|
| 767 |
+
col3.metric("✨ Contenu complet", enriched_count)
|
| 768 |
+
col4.metric("📝 Requêtes", len(df['query'].unique()))
|
| 769 |
+
|
| 770 |
+
st.divider()
|
| 771 |
+
|
| 772 |
+
# Filtres et tri
|
| 773 |
+
col1, col2, col3 = st.columns([2, 1, 1])
|
| 774 |
+
|
| 775 |
+
with col1:
|
| 776 |
+
search_filter = st.text_input(
|
| 777 |
+
"🔎 Filtrer les résultats",
|
| 778 |
+
placeholder="Rechercher dans titres, snippets, URLs...",
|
| 779 |
+
key="filter_results"
|
| 780 |
+
)
|
| 781 |
+
|
| 782 |
+
with col2:
|
| 783 |
+
sort_option = st.selectbox(
|
| 784 |
+
"Trier par",
|
| 785 |
+
["Pertinence (défaut)", "Titre A-Z", "URL", "Contenu complet d'abord"]
|
| 786 |
+
)
|
| 787 |
+
|
| 788 |
+
with col3:
|
| 789 |
+
items_per_page = st.selectbox(
|
| 790 |
+
"Résultats/page",
|
| 791 |
+
[10, 25, 50, 100],
|
| 792 |
+
index=1
|
| 793 |
+
)
|
| 794 |
+
|
| 795 |
+
# Application filtres
|
| 796 |
+
display_df = df.copy()
|
| 797 |
+
|
| 798 |
+
if search_filter:
|
| 799 |
+
# Recherche dans snippet OU full_content
|
| 800 |
+
if 'full_content' in df.columns:
|
| 801 |
+
mask = (
|
| 802 |
+
df['title'].str.contains(search_filter, case=False, na=False) |
|
| 803 |
+
df['snippet'].str.contains(search_filter, case=False, na=False) |
|
| 804 |
+
df['full_content'].str.contains(search_filter, case=False, na=False) |
|
| 805 |
+
df['link'].str.contains(search_filter, case=False, na=False)
|
| 806 |
+
)
|
| 807 |
+
else:
|
| 808 |
+
mask = (
|
| 809 |
+
df['title'].str.contains(search_filter, case=False, na=False) |
|
| 810 |
+
df['snippet'].str.contains(search_filter, case=False, na=False) |
|
| 811 |
+
df['link'].str.contains(search_filter, case=False, na=False)
|
| 812 |
+
)
|
| 813 |
+
display_df = df[mask]
|
| 814 |
+
|
| 815 |
+
# Tri
|
| 816 |
+
if sort_option == "Titre A-Z":
|
| 817 |
+
display_df = display_df.sort_values('title')
|
| 818 |
+
elif sort_option == "URL":
|
| 819 |
+
display_df = display_df.sort_values('link')
|
| 820 |
+
elif sort_option == "Contenu complet d'abord":
|
| 821 |
+
if 'is_enriched' in display_df.columns:
|
| 822 |
+
display_df = display_df.sort_values('is_enriched', ascending=False)
|
| 823 |
+
|
| 824 |
+
st.info(f"📋 Affichage de **{len(display_df)}** résultat(s) sur **{len(results)}** total")
|
| 825 |
+
|
| 826 |
+
# Pagination
|
| 827 |
+
total_items = len(display_df)
|
| 828 |
+
total_pages = (total_items - 1) // items_per_page + 1 if total_items > 0 else 1
|
| 829 |
+
|
| 830 |
+
if total_pages > 1:
|
| 831 |
+
page = st.selectbox(
|
| 832 |
+
f"Page (1-{total_pages})",
|
| 833 |
+
range(1, total_pages + 1),
|
| 834 |
+
format_func=lambda x: f"Page {x}/{total_pages}"
|
| 835 |
+
)
|
| 836 |
+
start_idx = (page - 1) * items_per_page
|
| 837 |
+
end_idx = min(start_idx + items_per_page, total_items)
|
| 838 |
+
page_df = display_df.iloc[start_idx:end_idx]
|
| 839 |
+
else:
|
| 840 |
+
page_df = display_df
|
| 841 |
+
|
| 842 |
+
st.divider()
|
| 843 |
+
|
| 844 |
+
# Affichage des résultats
|
| 845 |
+
for idx, row in page_df.iterrows():
|
| 846 |
+
# Déterminer quel contenu afficher
|
| 847 |
+
is_enriched = row.get('is_enriched', False)
|
| 848 |
+
display_content = row.get('full_content', row['snippet'])
|
| 849 |
+
content_length = row.get('content_length', len(display_content))
|
| 850 |
+
|
| 851 |
+
st.markdown(f"""
|
| 852 |
+
<div class="result-card">
|
| 853 |
+
<h3 style="margin: 0 0 0.5rem 0;">
|
| 854 |
+
<a href="{row['link']}" target="_blank" style="color: #1e40af; text-decoration: none;">
|
| 855 |
+
{row['title']}
|
| 856 |
+
</a>
|
| 857 |
+
{f'<span class="full-content-badge">✨ CONTENU COMPLET</span>' if is_enriched else ''}
|
| 858 |
+
</h3>
|
| 859 |
+
<p style="color: #64748b; font-size: 0.9em; margin: 0.3rem 0;">
|
| 860 |
+
🔗 {row['formattedUrl']} • 📏 {content_length} caractères
|
| 861 |
+
</p>
|
| 862 |
+
<div style="color: #334155; margin: 0.8rem 0; max-height: 400px; overflow-y: auto; padding: 0.8rem; background: {'#f0fdf4' if is_enriched else '#f8fafc'}; border-radius: 4px; border-left: 3px solid {'#22c55e' if is_enriched else '#cbd5e1'};">
|
| 863 |
+
{display_content}
|
| 864 |
+
</div>
|
| 865 |
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid #e2e8f0;">
|
| 866 |
+
<small style="color: #94a3b8;">
|
| 867 |
+
📅 {row['timestamp'][:19].replace('T', ' ')}
|
| 868 |
+
</small>
|
| 869 |
+
<small style="color: #94a3b8;">
|
| 870 |
+
🔍 Requête: {row['query'][:60]}...
|
| 871 |
+
</small>
|
| 872 |
+
</div>
|
| 873 |
+
</div>
|
| 874 |
+
""", unsafe_allow_html=True)
|
| 875 |
+
|
| 876 |
+
# Afficher erreur d'extraction si présente
|
| 877 |
+
if 'extraction_error' in row:
|
| 878 |
+
st.caption(f"⚠️ {row['extraction_error']}")
|
| 879 |
+
|
| 880 |
+
st.divider()
|
| 881 |
+
|
| 882 |
+
# Export
|
| 883 |
+
st.subheader("💾 Export des données")
|
| 884 |
+
|
| 885 |
+
col1, col2, col3, col4 = st.columns(4)
|
| 886 |
+
|
| 887 |
+
with col1:
|
| 888 |
+
json_data = display_df.to_json(orient='records', force_ascii=False, indent=2)
|
| 889 |
+
st.download_button(
|
| 890 |
+
"📄 Télécharger JSON",
|
| 891 |
+
json_data,
|
| 892 |
+
f"ba7ath_fb_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json",
|
| 893 |
+
"application/json"
|
| 894 |
+
)
|
| 895 |
+
|
| 896 |
+
with col2:
|
| 897 |
+
csv_data = display_df.to_csv(index=False, encoding='utf-8-sig')
|
| 898 |
+
st.download_button(
|
| 899 |
+
"📊 Télécharger CSV",
|
| 900 |
+
csv_data,
|
| 901 |
+
f"ba7ath_fb_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv",
|
| 902 |
+
"text/csv"
|
| 903 |
+
)
|
| 904 |
+
|
| 905 |
+
with col3:
|
| 906 |
+
# Export liste URLs
|
| 907 |
+
urls = "\n".join(display_df['link'].tolist())
|
| 908 |
+
st.download_button(
|
| 909 |
+
"🔗 Liste URLs",
|
| 910 |
+
urls,
|
| 911 |
+
f"urls_{datetime.now().strftime('%Y%m%d_%H%M%S')}.txt",
|
| 912 |
+
"text/plain"
|
| 913 |
+
)
|
| 914 |
+
|
| 915 |
+
with col4:
|
| 916 |
+
if st.button("💾 Sauvegarder localement"):
|
| 917 |
+
json_f, csv_f = save_results_to_reports(display_df.to_dict('records'))
|
| 918 |
+
st.success(f"✅ Sauvegardé!\n{json_f}\n{csv_f}")
|
| 919 |
+
|
| 920 |
+
# Statistiques avancées
|
| 921 |
+
with st.expander("📈 Statistiques avancées"):
|
| 922 |
+
col1, col2 = st.columns(2)
|
| 923 |
+
|
| 924 |
+
with col1:
|
| 925 |
+
st.markdown("**Distribution par domaine**")
|
| 926 |
+
domain_counts = display_df['displayLink'].value_counts().head(10)
|
| 927 |
+
st.bar_chart(domain_counts)
|
| 928 |
+
|
| 929 |
+
with col2:
|
| 930 |
+
st.markdown("**Longueur des contenus**")
|
| 931 |
+
if 'content_length' in display_df.columns:
|
| 932 |
+
st.line_chart(display_df['content_length'])
|
| 933 |
+
else:
|
| 934 |
+
display_df['snippet_len'] = display_df['snippet'].str.len()
|
| 935 |
+
st.line_chart(display_df['snippet_len'])
|
| 936 |
+
|
| 937 |
+
else:
|
| 938 |
+
st.markdown("""
|
| 939 |
+
<div class="info-box">
|
| 940 |
+
<h3 style="margin-top: 0;">ℹ️ Aucun résultat disponible</h3>
|
| 941 |
+
<p>Lancez une recherche dans l'onglet <strong>🎯 Recherche</strong> pour voir les résultats ici.</p>
|
| 942 |
+
</div>
|
| 943 |
+
""", unsafe_allow_html=True)
|
| 944 |
+
|
| 945 |
+
if st.button("🔄 Charger un exemple de démonstration"):
|
| 946 |
+
st.session_state['fb_search_results'] = [
|
| 947 |
+
{
|
| 948 |
+
'title': 'Exemple - Ministère des Affaires Étrangères de Tunisie',
|
| 949 |
+
'link': 'https://www.facebook.com/TunisieDiplo/posts/123456789',
|
| 950 |
+
'snippet': 'استدعاء سفير الجمهورية التونسية في باريس للتشاور حول القضايا الدبلوماسية...',
|
| 951 |
+
'displayLink': 'facebook.com',
|
| 952 |
+
'formattedUrl': 'www.facebook.com › TunisieDiplo › posts',
|
| 953 |
+
'timestamp': datetime.now().isoformat(),
|
| 954 |
+
'query': 'site:facebook.com/TunisieDiplo "استدعاء سفير"'
|
| 955 |
+
}
|
| 956 |
+
]
|
| 957 |
+
st.rerun()
|
| 958 |
+
|
| 959 |
+
# ===== TAB 3: GUIDE =====
|
| 960 |
+
with tab3:
|
| 961 |
+
st.subheader("📖 Guide complet des opérateurs Google Dorking")
|
| 962 |
+
|
| 963 |
+
st.markdown("""
|
| 964 |
+
Les opérateurs Google (Google Dorks) sont des commandes spéciales qui affinent vos recherches.
|
| 965 |
+
Combinez-les pour des résultats ultra-précis.
|
| 966 |
+
""")
|
| 967 |
+
|
| 968 |
+
# Guide par catégorie
|
| 969 |
+
operators_guide = {
|
| 970 |
+
"🎯 Ciblage de domaine": {
|
| 971 |
+
"site:": {
|
| 972 |
+
"desc": "Limite la recherche à un domaine/site spécifique",
|
| 973 |
+
"ex": "site:facebook.com/TunisieDiplo",
|
| 974 |
+
"usage": "Rechercher uniquement sur une page Facebook donnée"
|
| 975 |
+
},
|
| 976 |
+
"inurl:": {
|
| 977 |
+
"desc": "Le mot doit apparaître dans l'URL",
|
| 978 |
+
"ex": "inurl:posts",
|
| 979 |
+
"usage": "Trouver des publications (posts dans l'URL)"
|
| 980 |
+
}
|
| 981 |
+
},
|
| 982 |
+
"📝 Contenu textuel": {
|
| 983 |
+
"intext:": {
|
| 984 |
+
"desc": "Le mot doit être dans le texte de la page",
|
| 985 |
+
"ex": 'intext:"استدعاء سفير"',
|
| 986 |
+
"usage": "Chercher dans le contenu réel de la page"
|
| 987 |
+
},
|
| 988 |
+
"allintext:": {
|
| 989 |
+
"desc": "Tous les mots doivent être dans le texte",
|
| 990 |
+
"ex": "allintext:ambassador tunisia recall",
|
| 991 |
+
"usage": "Tous les termes présents obligatoirement"
|
| 992 |
+
},
|
| 993 |
+
"intitle:": {
|
| 994 |
+
"desc": "Le mot doit être dans le titre",
|
| 995 |
+
"ex": "intitle:وزارة",
|
| 996 |
+
"usage": "Rechercher dans les titres uniquement"
|
| 997 |
+
}
|
| 998 |
+
},
|
| 999 |
+
"📁 Fichiers et formats": {
|
| 1000 |
+
"filetype:": {
|
| 1001 |
+
"desc": "Chercher un type de fichier spécifique",
|
| 1002 |
+
"ex": "filetype:pdf rapport",
|
| 1003 |
+
"usage": "Trouver des PDF, DOC, XLS, etc."
|
| 1004 |
+
}
|
| 1005 |
+
},
|
| 1006 |
+
"🎛️ Modificateurs": {
|
| 1007 |
+
'"phrase"': {
|
| 1008 |
+
"desc": "Recherche de phrase exacte",
|
| 1009 |
+
"ex": '"استدعاء سفير تونس"',
|
| 1010 |
+
"usage": "La phrase doit apparaître telle quelle"
|
| 1011 |
+
},
|
| 1012 |
+
"-terme": {
|
| 1013 |
+
"desc": "Exclure un mot des résultats",
|
| 1014 |
+
"ex": "tunisie -football",
|
| 1015 |
+
"usage": "Éliminer résultats non pertinents"
|
| 1016 |
+
},
|
| 1017 |
+
"OR": {
|
| 1018 |
+
"desc": "L'un ou l'autre terme",
|
| 1019 |
+
"ex": "tunisia OR tunisie",
|
| 1020 |
+
"usage": "Recherche multilingue"
|
| 1021 |
+
},
|
| 1022 |
+
"*": {
|
| 1023 |
+
"desc": "Joker (remplace n'importe quel mot)",
|
| 1024 |
+
"ex": "tunisie * ambassadeur",
|
| 1025 |
+
"usage": "Chercher avec mot inconnu au milieu"
|
| 1026 |
+
}
|
| 1027 |
+
}
|
| 1028 |
+
}
|
| 1029 |
+
|
| 1030 |
+
for category, ops in operators_guide.items():
|
| 1031 |
+
st.markdown(f"### {category}")
|
| 1032 |
+
|
| 1033 |
+
for op, details in ops.items():
|
| 1034 |
+
with st.expander(f"**`{op}`** - {details['desc']}"):
|
| 1035 |
+
col1, col2 = st.columns(2)
|
| 1036 |
+
|
| 1037 |
+
with col1:
|
| 1038 |
+
st.markdown("**📋 Exemple:**")
|
| 1039 |
+
st.code(details['ex'], language="text")
|
| 1040 |
+
|
| 1041 |
+
with col2:
|
| 1042 |
+
st.markdown("**💡 Utilisation:**")
|
| 1043 |
+
st.info(details['usage'])
|
| 1044 |
+
|
| 1045 |
+
st.divider()
|
| 1046 |
+
|
| 1047 |
+
# Exemples avancés
|
| 1048 |
+
st.subheader("🔥 Exemples de recherches OSINT avancées")
|
| 1049 |
+
|
| 1050 |
+
examples = [
|
| 1051 |
+
{
|
| 1052 |
+
"title": "Convocations d'ambassadeurs tunisiens",
|
| 1053 |
+
"query": 'site:facebook.com/TunisieDiplo "استدعاء سفير" OR "recall ambassador"',
|
| 1054 |
+
"explain": "Recherche bilingue (AR/EN) de convocations sur la page du ministère"
|
| 1055 |
+
},
|
| 1056 |
+
{
|
| 1057 |
+
"title": "Communiqués officiels sans publicités",
|
| 1058 |
+
"query": 'site:facebook.com/TunisieDiplo "بيان رسمي" -إعلان -sponsored',
|
| 1059 |
+
"explain": "Communiqués officiels en excluant les contenus publicitaires"
|
| 1060 |
+
},
|
| 1061 |
+
{
|
| 1062 |
+
"title": "Documents PDF du ministère",
|
| 1063 |
+
"query": 'site:diplomatie.gov.tn filetype:pdf "rapport annuel"',
|
| 1064 |
+
"explain": "Rapports PDF officiels du site gouvernemental"
|
| 1065 |
+
},
|
| 1066 |
+
{
|
| 1067 |
+
"title": "Mentions de pays spécifiques",
|
| 1068 |
+
"query": 'site:facebook.com/TunisieDiplo (فرنسا OR ألمانيا OR إيطاليا)',
|
| 1069 |
+
"explain": "Posts mentionnant France, Allemagne ou Italie"
|
| 1070 |
+
}
|
| 1071 |
+
]
|
| 1072 |
+
|
| 1073 |
+
for ex in examples:
|
| 1074 |
+
with st.expander(f"🎯 {ex['title']}"):
|
| 1075 |
+
st.code(ex['query'], language="text")
|
| 1076 |
+
st.caption(f"💭 Explication: {ex['explain']}")
|
| 1077 |
+
if st.button(f"📋 Copier cette requête", key=f"copy_{ex['title']}"):
|
| 1078 |
+
st.toast("✅ Requête copiée dans le presse-papier!")
|
| 1079 |
+
|
| 1080 |
+
# ===== TAB 4: TEMPLATES =====
|
| 1081 |
+
with tab4:
|
| 1082 |
+
st.subheader("⚡ Templates de requêtes pré-configurés")
|
| 1083 |
+
|
| 1084 |
+
st.markdown("""
|
| 1085 |
+
Utilisez ces templates prêts à l'emploi pour vos investigations courantes.
|
| 1086 |
+
Cliquez sur un template pour le charger dans l'onglet Recherche.
|
| 1087 |
+
""")
|
| 1088 |
+
|
| 1089 |
+
templates = {
|
| 1090 |
+
"🇹🇳 Diplomatie Tunisienne": [
|
| 1091 |
+
{
|
| 1092 |
+
"name": "Convocations ambassadeurs",
|
| 1093 |
+
"url": "https://www.facebook.com/TunisieDiplo",
|
| 1094 |
+
"keywords": ["استدعاء سفير", "recall ambassador", "convocation ambassadeur"],
|
| 1095 |
+
"desc": "Recherche de convocations d'ambassadeurs tunisiens"
|
| 1096 |
+
},
|
| 1097 |
+
{
|
| 1098 |
+
"name": "Communiqués officiels",
|
| 1099 |
+
"url": "https://www.facebook.com/TunisieDiplo",
|
| 1100 |
+
"keywords": ["بيان رسمي", "communiqué officiel", "déclaration"],
|
| 1101 |
+
"desc": "Communications officielles du ministère"
|
| 1102 |
+
},
|
| 1103 |
+
{
|
| 1104 |
+
"name": "Relations bilatérales",
|
| 1105 |
+
"url": "https://www.facebook.com/TunisieDiplo",
|
| 1106 |
+
"keywords": ["علاقات ثنائية", "coopération", "اتفاقية"],
|
| 1107 |
+
"desc": "Accords et coopération internationale"
|
| 1108 |
+
}
|
| 1109 |
+
],
|
| 1110 |
+
"📰 Investigation Médiatique": [
|
| 1111 |
+
{
|
| 1112 |
+
"name": "Scandales et controverses",
|
| 1113 |
+
"url": "https://www.facebook.com/",
|
| 1114 |
+
"keywords": ["فضيحة", "scandale", "controverse"],
|
| 1115 |
+
"desc": "Recherche de contenus sensibles"
|
| 1116 |
+
},
|
| 1117 |
+
{
|
| 1118 |
+
"name": "Déclarations officielles",
|
| 1119 |
+
"url": "https://www.facebook.com/",
|
| 1120 |
+
"keywords": ["تصريح رسمي", "déclaration", "statement"],
|
| 1121 |
+
"desc": "Déclarations de personnalités"
|
| 1122 |
+
}
|
| 1123 |
+
]
|
| 1124 |
+
}
|
| 1125 |
+
|
| 1126 |
+
for category, tmpl_list in templates.items():
|
| 1127 |
+
st.markdown(f"### {category}")
|
| 1128 |
+
|
| 1129 |
+
cols = st.columns(2)
|
| 1130 |
+
|
| 1131 |
+
for idx, tmpl in enumerate(tmpl_list):
|
| 1132 |
+
with cols[idx % 2]:
|
| 1133 |
+
with st.container():
|
| 1134 |
+
st.markdown(f"**{tmpl['name']}**")
|
| 1135 |
+
st.caption(tmpl['desc'])
|
| 1136 |
+
|
| 1137 |
+
with st.expander("👁️ Détails"):
|
| 1138 |
+
st.write(f"**URL:** {tmpl['url']}")
|
| 1139 |
+
st.write(f"**Mots-clés:**")
|
| 1140 |
+
for kw in tmpl['keywords']:
|
| 1141 |
+
st.code(kw)
|
| 1142 |
+
|
| 1143 |
+
if st.button(f"📥 Utiliser ce template", key=f"use_{category}_{idx}"):
|
| 1144 |
+
st.session_state['loaded_template'] = tmpl
|
| 1145 |
+
st.success(f"✅ Template '{tmpl['name']}' chargé!")
|
| 1146 |
+
st.info("💡 Passez à l'onglet **🎯 Recherche** pour l'utiliser")
|
| 1147 |
+
|
| 1148 |
+
st.divider()
|
| 1149 |
+
|
| 1150 |
+
# ===== FOOTER =====
|
| 1151 |
+
st.divider()
|
| 1152 |
+
st.markdown("""
|
| 1153 |
+
<div style='text-align: center; color: #64748b; padding: 1.5rem; background: #f8fafc; border-radius: 8px;'>
|
| 1154 |
+
<p style="margin: 0.5rem 0;"><strong>Ba7ath OSINT Suite</strong> - Module Facebook Dorking v1.1</p>
|
| 1155 |
+
<p style="margin: 0.5rem 0; font-size: 0.9em;">
|
| 1156 |
+
Développé pour le journalisme d'investigation en Tunisie 🇹🇳
|
| 1157 |
+
</p>
|
| 1158 |
+
<p style="margin: 0.5rem 0; font-size: 0.85em; color: #94a3b8;">
|
| 1159 |
+
⚠️ Utilisation responsable uniquement • Respectez les lois sur la protection des données
|
| 1160 |
+
</p>
|
| 1161 |
+
<p style="margin: 0.5rem 0; font-size: 0.85em;">
|
| 1162 |
+
📧 Support: ba7ath@protonmail.com | 💻 Ba7ath Project
|
| 1163 |
+
</p>
|
| 1164 |
+
</div>
|
| 1165 |
+
""", unsafe_allow_html=True)
|
| 1166 |
+
|
| 1167 |
+
# Initialiser les dossiers au démarrage
|
| 1168 |
+
ensure_directories()
|
pages/1_BUS.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import subprocess
|
| 4 |
+
import os
|
| 5 |
+
import sys
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
# Définition du chemin des outils externes
|
| 10 |
+
if getattr(sys, 'frozen', False):
|
| 11 |
+
# En mode exécutable (PyInstaller)
|
| 12 |
+
EXT_TOOLS_DIR = os.path.join(os.path.dirname(sys.executable), 'outils_externes')
|
| 13 |
+
else:
|
| 14 |
+
# En mode développement
|
| 15 |
+
EXT_TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 16 |
+
|
| 17 |
+
SHERLOCK_DIR = os.path.join(EXT_TOOLS_DIR, 'sherlock')
|
| 18 |
+
ALL_SITES_PATH = os.path.join(SHERLOCK_DIR, 'all_sites.txt')
|
| 19 |
+
SHERLOCK_SCRIPT = os.path.join(SHERLOCK_DIR, 'sherlock_project', 'sherlock.py')
|
| 20 |
+
|
| 21 |
+
st.set_page_config(page_title="BUS", page_icon="🔍", layout="wide")
|
| 22 |
+
|
| 23 |
+
# Charger la liste des sites
|
| 24 |
+
try:
|
| 25 |
+
with open(ALL_SITES_PATH, 'r', encoding='utf-8') as f:
|
| 26 |
+
ALL_SITES = sorted(set(line.strip() for line in f if line.strip()))
|
| 27 |
+
except Exception as e:
|
| 28 |
+
ALL_SITES = []
|
| 29 |
+
st.error(f"Erreur de lecture de {ALL_SITES_PATH}: {e}")
|
| 30 |
+
|
| 31 |
+
CATEGORIES = {
|
| 32 |
+
"Réseaux sociaux": ["Facebook", "Twitter", "Instagram", "LinkedIn", "TikTok", "Snapchat", "Reddit", "VK", "Tumblr", "Pinterest", "YouTube"],
|
| 33 |
+
"Développement/Code": ["GitHub", "GitLab", "BitBucket", "Codewars", "Codepen", "StackOverflow"],
|
| 34 |
+
"Crypto/Finance": ["Venmo", "Coinvote", "CashApp", "Patreon", "BuyMeACoffee", "Revolut"],
|
| 35 |
+
"Musique/Vidéo": ["SoundCloud", "Spotify", "Bandcamp", "MixCloud", "DailyMotion", "Vimeo"],
|
| 36 |
+
"Divers/Forums": ["Quora", "4chan", "Disqus", "Forum Ophilia", "BoardGameGeek", "Warrior Forum"],
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
st.header("BUS – Recherche avancée")
|
| 40 |
+
|
| 41 |
+
if "selected_sites" not in st.session_state:
|
| 42 |
+
st.session_state["selected_sites"] = []
|
| 43 |
+
|
| 44 |
+
if "last_result" not in st.session_state:
|
| 45 |
+
st.session_state["last_result"] = ""
|
| 46 |
+
|
| 47 |
+
if "last_found_links" not in st.session_state:
|
| 48 |
+
st.session_state["last_found_links"] = {}
|
| 49 |
+
|
| 50 |
+
type_choice = st.selectbox("Type de recherche :", ["Tout", "Par catégorie"])
|
| 51 |
+
|
| 52 |
+
if type_choice == "Tout":
|
| 53 |
+
if not st.session_state["selected_sites"] or set(st.session_state["selected_sites"]) != set(ALL_SITES):
|
| 54 |
+
st.session_state["selected_sites"] = ALL_SITES
|
| 55 |
+
elif type_choice == "Par catégorie":
|
| 56 |
+
category = st.selectbox("Catégorie :", list(CATEGORIES.keys()))
|
| 57 |
+
cat_sites = [site for site in CATEGORIES[category] if site in ALL_SITES]
|
| 58 |
+
if not st.session_state["selected_sites"] or set(st.session_state["selected_sites"]) != set(cat_sites):
|
| 59 |
+
st.session_state["selected_sites"] = cat_sites
|
| 60 |
+
|
| 61 |
+
col1, col2 = st.columns([1, 4])
|
| 62 |
+
with col1:
|
| 63 |
+
if st.button("Tout sélectionner"):
|
| 64 |
+
if type_choice == "Tout":
|
| 65 |
+
st.session_state["selected_sites"] = ALL_SITES
|
| 66 |
+
elif type_choice == "Par catégorie":
|
| 67 |
+
st.session_state["selected_sites"] = cat_sites
|
| 68 |
+
if st.button("Tout désélectionner"):
|
| 69 |
+
st.session_state["selected_sites"] = []
|
| 70 |
+
|
| 71 |
+
selected_sites = st.multiselect(
|
| 72 |
+
"Plateformes à analyser :", ALL_SITES,
|
| 73 |
+
key="selected_sites"
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
username = st.text_input("Username à tester :", key="ba7ath_input")
|
| 77 |
+
timeout = st.slider("Timeout maximum par site (secondes) :", min_value=2, max_value=20, value=11)
|
| 78 |
+
|
| 79 |
+
if st.button("Lancer Ba7ath Username Search", key="ba7ath_btn"):
|
| 80 |
+
if not username or not selected_sites:
|
| 81 |
+
st.warning("Remplissez tous les champs.")
|
| 82 |
+
else:
|
| 83 |
+
if len(selected_sites) == len(ALL_SITES):
|
| 84 |
+
sites_args = ""
|
| 85 |
+
else:
|
| 86 |
+
sites_args = " ".join([f'--site "{site}"' for site in selected_sites])
|
| 87 |
+
command = (
|
| 88 |
+
f'"{sys.executable}" "{SHERLOCK_SCRIPT}" '
|
| 89 |
+
f'{username} {sites_args} --timeout {timeout} --print-found'
|
| 90 |
+
)
|
| 91 |
+
st.info(f"Commande lancée : {command}")
|
| 92 |
+
result = subprocess.getoutput(command)
|
| 93 |
+
st.session_state["last_result"] = result
|
| 94 |
+
found_links = {}
|
| 95 |
+
for line in result.splitlines():
|
| 96 |
+
line = line.strip()
|
| 97 |
+
if line.startswith("[+]") and ":" in line and "http" in line:
|
| 98 |
+
site = line.split(":", 1)[0][3:].strip()
|
| 99 |
+
urls = re.findall(r"(https?://[^\s\]\)]+)", line)
|
| 100 |
+
if urls:
|
| 101 |
+
url = max(urls, key=len)
|
| 102 |
+
found_links[site] = url
|
| 103 |
+
st.session_state["last_found_links"] = found_links
|
| 104 |
+
|
| 105 |
+
found_links = st.session_state.get("last_found_links", {})
|
| 106 |
+
result = st.session_state.get("last_result", "")
|
| 107 |
+
|
| 108 |
+
if found_links:
|
| 109 |
+
st.success(f"{len(found_links)} résultats trouvés :")
|
| 110 |
+
st.markdown("| Plateforme | Lien | Date | Statut |\n|---|---|---|---|")
|
| 111 |
+
date = datetime.now().strftime("%d/%m/%Y %H:%M")
|
| 112 |
+
results = []
|
| 113 |
+
for site, url in found_links.items():
|
| 114 |
+
st.markdown(f"| {site} | [{url}]({url}) | {date} | Trouvé |")
|
| 115 |
+
results.append({
|
| 116 |
+
"Plateforme": site,
|
| 117 |
+
"Lien": url,
|
| 118 |
+
"Date": date,
|
| 119 |
+
"Statut": "Trouvé"
|
| 120 |
+
})
|
| 121 |
+
df = pd.DataFrame(results)
|
| 122 |
+
csv = df.to_csv(index=False).encode("utf-8")
|
| 123 |
+
st.download_button(
|
| 124 |
+
label="Télécharger les résultats en CSV",
|
| 125 |
+
data=csv,
|
| 126 |
+
file_name=f"ba7ath_{username}_results.csv",
|
| 127 |
+
mime="text/csv"
|
| 128 |
+
)
|
| 129 |
+
else:
|
| 130 |
+
st.warning("Aucun résultat trouvé sur les plateformes sélectionnées.")
|
| 131 |
+
|
| 132 |
+
with st.expander("Afficher la sortie brute Ba7ath"):
|
| 133 |
+
st.text(result)
|
pages/2_MultiComptes.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
pages/3_Leaks.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import webbrowser
|
| 3 |
+
import requests
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
st.header("Recherche de leaks / Data Breach par email ou username")
|
| 7 |
+
|
| 8 |
+
target = st.text_input("Email ou username à vérifier (HaveIBeenPwned, XposedOrNot, LeakCheck):", key="leaks_input")
|
| 9 |
+
|
| 10 |
+
# HIBP (web)
|
| 11 |
+
st.markdown("⚠️ L'utilisation de l'API HIBP nécessite une clé — mais vous pouvez vérifier manuellement sur le site :", unsafe_allow_html=True)
|
| 12 |
+
if st.button("Vérifier sur le site HaveIBeenPwned", key="hibp_btn"):
|
| 13 |
+
if not target:
|
| 14 |
+
st.warning("Veuillez entrer un email à vérifier.")
|
| 15 |
+
else:
|
| 16 |
+
hibp_url = f"https://haveibeenpwned.com/account/{target}"
|
| 17 |
+
st.info(f"Ouvre la page HIBP dans un nouvel onglet pour : `{target}`")
|
| 18 |
+
st.markdown(f"[Lien direct vers HIBP avec ce compte ➜]({hibp_url})", unsafe_allow_html=True)
|
| 19 |
+
webbrowser.open_new_tab(hibp_url)
|
| 20 |
+
|
| 21 |
+
st.markdown("---")
|
| 22 |
+
|
| 23 |
+
# XposedOrNot (email) - API ouverte
|
| 24 |
+
if st.button("Vérifier sur XposedOrNot API", key="xon_btn"):
|
| 25 |
+
if not target or "@" not in target:
|
| 26 |
+
st.warning("Veuillez entrer un email (format ...) pour XposedOrNot.")
|
| 27 |
+
else:
|
| 28 |
+
api_url = f"https://api.xposedornot.com/v1/check-email/{target}"
|
| 29 |
+
resp = requests.get(api_url)
|
| 30 |
+
if resp.status_code == 200:
|
| 31 |
+
info = resp.json()
|
| 32 |
+
if info.get("breaches"):
|
| 33 |
+
st.success(f"{target} trouvé dans {len(info['breaches'])} breaches (XposedOrNot) !")
|
| 34 |
+
df = pd.DataFrame(info["breaches"])
|
| 35 |
+
st.dataframe(df)
|
| 36 |
+
st.download_button(
|
| 37 |
+
label="Télécharger en CSV (XposedOrNot)",
|
| 38 |
+
data=df.to_csv(index=False).encode("utf-8"),
|
| 39 |
+
file_name=f"xposedornot_{target}_results.csv",
|
| 40 |
+
mime="text/csv"
|
| 41 |
+
)
|
| 42 |
+
else:
|
| 43 |
+
st.info(f"Aucun leak trouvé pour {target} sur XposedOrNot.")
|
| 44 |
+
else:
|
| 45 |
+
st.error(f"Erreur API ({resp.status_code}).")
|
| 46 |
+
|
| 47 |
+
st.markdown("---")
|
| 48 |
+
|
| 49 |
+
# LeakCheck API Publique (sans clé minimum, peut aussi ajouter version clé ensuite)
|
| 50 |
+
if st.button("Vérifier sur LeakCheck API Publique", key="lc_public_btn"):
|
| 51 |
+
if not target:
|
| 52 |
+
st.warning("Veuillez entrer un email ou username à vérifier (LeakCheck).")
|
| 53 |
+
else:
|
| 54 |
+
api_url = f"https://leakcheck.io/api/public?check={target}"
|
| 55 |
+
resp = requests.get(api_url)
|
| 56 |
+
if resp.status_code == 200:
|
| 57 |
+
info = resp.json()
|
| 58 |
+
if info.get("success") and info.get("found", 0) > 0:
|
| 59 |
+
st.success(f"{target} trouvé dans {info['found']} leaks (LeakCheck) !")
|
| 60 |
+
sources = info.get("sources", [])
|
| 61 |
+
st.dataframe(pd.DataFrame(sources))
|
| 62 |
+
st.download_button(
|
| 63 |
+
label="Télécharger les sources en CSV (LeakCheck)",
|
| 64 |
+
data=pd.DataFrame(sources).to_csv(index=False).encode("utf-8"),
|
| 65 |
+
file_name=f"leakcheck_{target}_results.csv",
|
| 66 |
+
mime="text/csv"
|
| 67 |
+
)
|
| 68 |
+
st.markdown(
|
| 69 |
+
'<small>Powered by <a href="https://leakcheck.io/" target="_blank">LeakCheck</a></small>',
|
| 70 |
+
unsafe_allow_html=True
|
| 71 |
+
)
|
| 72 |
+
else:
|
| 73 |
+
st.info(f"Aucun leak trouvé pour {target} sur LeakCheck.")
|
| 74 |
+
else:
|
| 75 |
+
st.error(f"Erreur API LeakCheck ({resp.status_code}).")
|
| 76 |
+
|
| 77 |
+
st.markdown("---")
|
| 78 |
+
st.markdown("""
|
| 79 |
+
### Alternatives pro :
|
| 80 |
+
- **LeakCheck API avancée** (clé API requise pour recherches premium)
|
| 81 |
+
- **OSINTLeak** (Starter free plan, inscription API)
|
| 82 |
+
<br>
|
| 83 |
+
<small>Powered by LeakCheck.io</small>
|
| 84 |
+
""", unsafe_allow_html=True)
|
pages/4_YouTube.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
import pandas as pd
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
import folium
|
| 6 |
+
|
| 7 |
+
st.set_page_config(layout="wide")
|
| 8 |
+
st.header("YouTube OSINT : recherche avancée, affichage map & export")
|
| 9 |
+
|
| 10 |
+
import os
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
|
| 13 |
+
load_dotenv()
|
| 14 |
+
default_yt_key = os.getenv("YOUTUBE_API_KEY", "")
|
| 15 |
+
|
| 16 |
+
api_key = default_yt_key
|
| 17 |
+
query = st.text_input("Mot-clé / hashtag (ex: #osint) :", key="yt_query")
|
| 18 |
+
channel_id = st.text_input("ID de chaîne (optionnel) :", key="yt_channelid")
|
| 19 |
+
place = st.text_input("Lieu (ville, région, pays, optionnel) :", key="yt_place")
|
| 20 |
+
radius = st.text_input("Rayon (ex: 20km)", value="20km")
|
| 21 |
+
max_results = st.slider("Nombre max résultats", 5, 50, 15)
|
| 22 |
+
start_date = st.date_input("Date début", value=datetime(2023, 1, 1))
|
| 23 |
+
end_date = st.date_input("Date fin", value=datetime.now())
|
| 24 |
+
|
| 25 |
+
def geocode(place, limit=3):
|
| 26 |
+
url = f"https://nominatim.openstreetmap.org/search?format=json&q={place}"
|
| 27 |
+
headers = {"User-Agent": "Ba7ath OSINT Tool"}
|
| 28 |
+
resp = requests.get(url, headers=headers)
|
| 29 |
+
if resp.status_code == 200 and "application/json" in resp.headers.get("Content-Type", ""):
|
| 30 |
+
try:
|
| 31 |
+
data = resp.json()
|
| 32 |
+
if data:
|
| 33 |
+
# Propose choix si plusieurs résultats
|
| 34 |
+
options = [f"{d['display_name']} ({d['lat']}, {d['lon']})" for d in data[:limit]]
|
| 35 |
+
idx = st.selectbox("Sélectionner le lieu exact :", options, index=0)
|
| 36 |
+
dmatch = data[options.index(idx)]
|
| 37 |
+
lat, lon = dmatch['lat'], dmatch['lon']
|
| 38 |
+
return f"{lat},{lon}"
|
| 39 |
+
else:
|
| 40 |
+
return None
|
| 41 |
+
except Exception:
|
| 42 |
+
return None
|
| 43 |
+
else:
|
| 44 |
+
return None
|
| 45 |
+
|
| 46 |
+
if st.button("Rechercher sur YouTube"):
|
| 47 |
+
# Géocodage si lieu fourni
|
| 48 |
+
location = geocode(place) if place else None
|
| 49 |
+
published_after = start_date.strftime("%Y-%m-%dT00:00:00Z")
|
| 50 |
+
published_before = end_date.strftime("%Y-%m-%dT23:59:59Z")
|
| 51 |
+
|
| 52 |
+
url = (
|
| 53 |
+
f"https://www.googleapis.com/youtube/v3/search?"
|
| 54 |
+
f"part=snippet&type=video&q={query or ''}"
|
| 55 |
+
f"{'&channelId='+channel_id if channel_id else ''}"
|
| 56 |
+
f"{'&location='+location if location else ''}"
|
| 57 |
+
f"{'&locationRadius='+radius if location else ''}"
|
| 58 |
+
f"&maxResults={max_results}&key={api_key}"
|
| 59 |
+
f"&publishedAfter={published_after}&publishedBefore={published_before}"
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
resp = requests.get(url)
|
| 63 |
+
if resp.status_code == 200:
|
| 64 |
+
items = resp.json().get("items", [])
|
| 65 |
+
if items:
|
| 66 |
+
rows = []
|
| 67 |
+
points = []
|
| 68 |
+
for video in items:
|
| 69 |
+
snippet = video["snippet"]
|
| 70 |
+
video_id = video["id"]["videoId"]
|
| 71 |
+
title = snippet["title"]
|
| 72 |
+
channel = snippet["channelTitle"]
|
| 73 |
+
published = snippet["publishedAt"][:10]
|
| 74 |
+
url_vid = f"https://youtube.com/watch?v={video_id}"
|
| 75 |
+
thumb = snippet["thumbnails"]["default"]["url"]
|
| 76 |
+
geo = None
|
| 77 |
+
if location and "geo" in video:
|
| 78 |
+
geo = (video["geo"]["latitude"], video["geo"]["longitude"])
|
| 79 |
+
points.append({"lat": geo[0], "lon": geo[1], "popup": title})
|
| 80 |
+
rows.append({
|
| 81 |
+
"Miniature": f"",
|
| 82 |
+
"Titre": f"[{title}]({url_vid})",
|
| 83 |
+
"Chaîne": channel,
|
| 84 |
+
"Date": published,
|
| 85 |
+
"Lien brut": url_vid,
|
| 86 |
+
"Miniature URL": thumb
|
| 87 |
+
})
|
| 88 |
+
df = pd.DataFrame(rows)
|
| 89 |
+
|
| 90 |
+
st.markdown("### Résultats (liens cliquables & miniatures)")
|
| 91 |
+
st.write(df.to_markdown(index=False), unsafe_allow_html=True)
|
| 92 |
+
st.download_button(
|
| 93 |
+
"Télécharger résultats CSV",
|
| 94 |
+
df.to_csv(index=False).encode("utf-8"),
|
| 95 |
+
file_name="youtube_osint_total.csv",
|
| 96 |
+
mime="text/csv"
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
# Carte interactive si points GPS disponibles
|
| 100 |
+
if place and points:
|
| 101 |
+
st.markdown("### Carte interactive des vidéos géolocalisées")
|
| 102 |
+
map = folium.Map(location=[float(points[0]["lat"]), float(points[0]["lon"])], zoom_start=8)
|
| 103 |
+
for pt in points:
|
| 104 |
+
folium.Marker([float(pt["lat"]), float(pt["lon"])], popup=pt["popup"]).add_to(map)
|
| 105 |
+
st.components.v1.html(map._repr_html_(), height=500)
|
| 106 |
+
else:
|
| 107 |
+
st.info("Aucune vidéo trouvée pour les critères donnés.")
|
| 108 |
+
else:
|
| 109 |
+
st.error(f"Erreur API : {resp.status_code} - {resp.text}")
|
| 110 |
+
|
| 111 |
+
st.markdown("""
|
| 112 |
+
---
|
| 113 |
+
**Fonctions incluses** :
|
| 114 |
+
- Recherche par mot-clé, hashtag, chaîne, lieu (conversion automatique)
|
| 115 |
+
- Liens cliquables YouTube
|
| 116 |
+
- Miniatures vidéo
|
| 117 |
+
- Filtrage temporel
|
| 118 |
+
- Export CSV
|
| 119 |
+
- Suggestions de lieux si ambiguïté
|
| 120 |
+
- Carte interactive pour les vidéos géolocalisées
|
| 121 |
+
|
| 122 |
+
**Astuces** : Utilise l’ID de chaîne officiel pour cibler un créateur (dispo dans l’URL d’une chaîne Youtube).
|
| 123 |
+
""")
|
pages/5_GeoFinder.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import exifread
|
| 3 |
+
import folium
|
| 4 |
+
import requests
|
| 5 |
+
from io import BytesIO
|
| 6 |
+
|
| 7 |
+
st.header("GeoFinder | Analyse & géolocalisation d’images/vidéos en ligne ou locale")
|
| 8 |
+
import os
|
| 9 |
+
from dotenv import load_dotenv
|
| 10 |
+
|
| 11 |
+
load_dotenv()
|
| 12 |
+
|
| 13 |
+
YOUTUBE_API_KEY = os.getenv("YOUTUBE_API_KEY", "")
|
| 14 |
+
|
| 15 |
+
def extract_exif_data(tags):
|
| 16 |
+
exif_info = {}
|
| 17 |
+
exif_info["Date de prise de vue"] = str(tags.get("EXIF DateTimeOriginal", ""))
|
| 18 |
+
exif_info["Date de modification"] = str(tags.get("Image DateTime", ""))
|
| 19 |
+
exif_info["Appareil"] = f"{tags.get('Image Make','')} {tags.get('Image Model','')}"
|
| 20 |
+
exif_info["Focale"] = str(tags.get("EXIF FocalLength", ""))
|
| 21 |
+
exif_info["Ouverture"] = str(tags.get("EXIF FNumber", ""))
|
| 22 |
+
exif_info["ISO"] = str(tags.get("EXIF ISOSpeedRatings", ""))
|
| 23 |
+
exif_info["Flash"] = str(tags.get("EXIF Flash", ""))
|
| 24 |
+
exif_info["Dimensions"] = f"{tags.get('EXIF ExifImageWidth','')} x {tags.get('EXIF ExifImageLength','')}"
|
| 25 |
+
exif_info["Balance des blancs"] = str(tags.get("EXIF WhiteBalance", ""))
|
| 26 |
+
exif_info["Modèle"] = str(tags.get("Image Model", ""))
|
| 27 |
+
exif_info["Marque"] = str(tags.get("Image Make", ""))
|
| 28 |
+
return exif_info
|
| 29 |
+
|
| 30 |
+
tab1, tab2 = st.tabs(["Image locale", "Image en ligne/vidéo"])
|
| 31 |
+
|
| 32 |
+
with tab1:
|
| 33 |
+
img_file = st.file_uploader("Télécharge une image (JPEG)", type=["jpg", "jpeg"])
|
| 34 |
+
if img_file:
|
| 35 |
+
tags = exifread.process_file(img_file)
|
| 36 |
+
def get_float(tag):
|
| 37 |
+
if not tag: return None
|
| 38 |
+
parts = str(tag).replace('[','').replace(']','').split(',')
|
| 39 |
+
try: return float(parts[0])
|
| 40 |
+
except: return None
|
| 41 |
+
lat = get_float(tags.get('GPS GPSLatitude'))
|
| 42 |
+
lon = get_float(tags.get('GPS GPSLongitude'))
|
| 43 |
+
exif_info = extract_exif_data(tags)
|
| 44 |
+
st.write("Infos EXIF clés :", exif_info)
|
| 45 |
+
st.write("Toutes les métadonnées EXIF :", tags)
|
| 46 |
+
if lat and lon:
|
| 47 |
+
st.success(f"Coordonnées GPS: {lat}, {lon}")
|
| 48 |
+
map = folium.Map(location=[lat, lon], zoom_start=12)
|
| 49 |
+
folium.Marker([lat, lon], popup="Photo géolocalisée").add_to(map)
|
| 50 |
+
st.components.v1.html(map._repr_html_(), height=400)
|
| 51 |
+
else:
|
| 52 |
+
st.info("Pas de coordonnées GPS trouvées dans cette image.")
|
| 53 |
+
|
| 54 |
+
with tab2:
|
| 55 |
+
url = st.text_input("URL d’une image (jpg/jpeg) ou vidéo YouTube :", key="in_url")
|
| 56 |
+
if st.button("Analyser ce média en ligne"):
|
| 57 |
+
if url.lower().endswith((".jpg",".jpeg")):
|
| 58 |
+
try:
|
| 59 |
+
resp = requests.get(url)
|
| 60 |
+
if resp.ok:
|
| 61 |
+
tags = exifread.process_file(BytesIO(resp.content))
|
| 62 |
+
lat, lon = None, None
|
| 63 |
+
def get_float(tag):
|
| 64 |
+
if not tag: return None
|
| 65 |
+
parts = str(tag).replace('[','').replace(']','').split(',')
|
| 66 |
+
try: return float(parts[0])
|
| 67 |
+
except: return None
|
| 68 |
+
lat = get_float(tags.get('GPS GPSLatitude'))
|
| 69 |
+
lon = get_float(tags.get('GPS GPSLongitude'))
|
| 70 |
+
exif_info = extract_exif_data(tags)
|
| 71 |
+
st.write("Infos EXIF clés :", exif_info)
|
| 72 |
+
st.write("Métadonnées EXIF :", tags)
|
| 73 |
+
if lat and lon:
|
| 74 |
+
st.success(f"Coordonnées GPS: {lat}, {lon}")
|
| 75 |
+
map = folium.Map(location=[lat, lon], zoom_start=12)
|
| 76 |
+
folium.Marker([lat, lon], popup="Image géolocalisée").add_to(map)
|
| 77 |
+
st.components.v1.html(map._repr_html_(), height=400)
|
| 78 |
+
else:
|
| 79 |
+
st.info("Pas de coordonnées GPS dans cette image en ligne.")
|
| 80 |
+
else:
|
| 81 |
+
st.warning("Impossible de récupérer l'image depuis l’URL. Vérifie le lien.")
|
| 82 |
+
except Exception as e:
|
| 83 |
+
st.error(f"Erreur lors de l’analyse de l’image en ligne: {e}")
|
| 84 |
+
elif "youtube.com/watch" in url or "youtu.be/" in url:
|
| 85 |
+
import re
|
| 86 |
+
match = re.search(r"(?:v=|\/)([0-9A-Za-z_-]{11})", url)
|
| 87 |
+
video_id = match.group(1) if match else None
|
| 88 |
+
if video_id:
|
| 89 |
+
api_url = (
|
| 90 |
+
f"https://www.googleapis.com/youtube/v3/videos?part=recordingDetails,snippet,contentDetails"
|
| 91 |
+
f"&id={video_id}&key={YOUTUBE_API_KEY}"
|
| 92 |
+
)
|
| 93 |
+
resp = requests.get(api_url)
|
| 94 |
+
if resp.status_code == 200:
|
| 95 |
+
data = resp.json()
|
| 96 |
+
item = data.get("items", [{}])[0]
|
| 97 |
+
details = item.get("recordingDetails", {})
|
| 98 |
+
snippet = item.get("snippet", {})
|
| 99 |
+
content = item.get("contentDetails", {})
|
| 100 |
+
geo = details.get("location", {})
|
| 101 |
+
lat, lon = geo.get("latitude"), geo.get("longitude")
|
| 102 |
+
video_info = {
|
| 103 |
+
"Titre": snippet.get("title", ""),
|
| 104 |
+
"Auteur (Chaîne)": snippet.get("channelTitle",""),
|
| 105 |
+
"Date de publication": snippet.get("publishedAt",""),
|
| 106 |
+
"Durée": content.get("duration",""),
|
| 107 |
+
"Description": snippet.get("description",""),
|
| 108 |
+
"Lieu (YouTube Rec)": details.get("locationDescription","")
|
| 109 |
+
}
|
| 110 |
+
st.write("Infos vidéo YouTube :", video_info)
|
| 111 |
+
if lat and lon:
|
| 112 |
+
st.success(f"Géoloc trouvée: lat {lat}, lon {lon}")
|
| 113 |
+
map = folium.Map(location=[lat, lon], zoom_start=10)
|
| 114 |
+
folium.Marker([lat, lon], popup=video_info["Titre"]).add_to(map)
|
| 115 |
+
st.components.v1.html(map._repr_html_(), height=400)
|
| 116 |
+
else:
|
| 117 |
+
st.info("Pas de données GPS vidéo publiques associées à cette vidéo.")
|
| 118 |
+
else:
|
| 119 |
+
st.error("Impossible de consulter l’API YouTube pour cette vidéo.")
|
| 120 |
+
else:
|
| 121 |
+
st.warning("Impossible d’extraire l’ID de la vidéo depuis l’URL fournie.")
|
| 122 |
+
else:
|
| 123 |
+
st.warning("Format non reconnu. Utilise une image .jpg/.jpeg ou une vidéo YouTube.")
|
| 124 |
+
|
| 125 |
+
st.markdown("---")
|
| 126 |
+
st.markdown("""
|
| 127 |
+
*GeoFinder analyse et extrait maintenant les infos clés d’image ou vidéo : date de prise de vue, appareil, auteur, GPS, durée, description…*
|
| 128 |
+
""")
|
pages/6_Entity_extraction.py.disabled
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
pages/7_FaceFinderOSINT.py
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import face_recognition
|
| 3 |
+
from PIL import Image, ImageDraw
|
| 4 |
+
import io
|
| 5 |
+
import os
|
| 6 |
+
import requests
|
| 7 |
+
import json
|
| 8 |
+
from bs4 import BeautifulSoup
|
| 9 |
+
import time
|
| 10 |
+
import urllib.parse
|
| 11 |
+
|
| 12 |
+
import os
|
| 13 |
+
from dotenv import load_dotenv
|
| 14 |
+
|
| 15 |
+
load_dotenv()
|
| 16 |
+
|
| 17 |
+
IMGBB_API_KEY = os.getenv("IMGBB_API_KEY", "")
|
| 18 |
+
|
| 19 |
+
API_CONFIG = {
|
| 20 |
+
"SerpApi": {"quota": 250, "count": 0, "api_key": os.getenv("SERPAPI_KEY_FACEFINDER", "")},
|
| 21 |
+
"Zenserp": {"quota": 50, "count": 0, "api_key": os.getenv("ZENSERP_API_KEY", "")}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
COUNTER_FILE = "reverse_api_counts.json"
|
| 25 |
+
if os.path.exists(COUNTER_FILE):
|
| 26 |
+
with open(COUNTER_FILE, "r") as f:
|
| 27 |
+
counts = json.load(f)
|
| 28 |
+
for k in API_CONFIG:
|
| 29 |
+
API_CONFIG[k]["count"] = counts.get(k, 0)
|
| 30 |
+
else:
|
| 31 |
+
counts = {k: 0 for k in API_CONFIG}
|
| 32 |
+
|
| 33 |
+
def save_counts():
|
| 34 |
+
with open(COUNTER_FILE, "w") as f:
|
| 35 |
+
json.dump({k: API_CONFIG[k]["count"] for k in API_CONFIG}, f)
|
| 36 |
+
|
| 37 |
+
def upload_image_imgbb(image_path):
|
| 38 |
+
url = "https://api.imgbb.com/1/upload"
|
| 39 |
+
payload = {"key": IMGBB_API_KEY}
|
| 40 |
+
files = {"image": open(image_path, "rb")}
|
| 41 |
+
response = requests.post(url, data=payload, files=files)
|
| 42 |
+
result = response.json()
|
| 43 |
+
try:
|
| 44 |
+
return result['data']['display_url']
|
| 45 |
+
except Exception:
|
| 46 |
+
return None
|
| 47 |
+
|
| 48 |
+
def reverse_serpapi(image_url, api_key):
|
| 49 |
+
params = {"engine": "google_reverse_image", "image_url": image_url, "api_key": api_key}
|
| 50 |
+
r = requests.get("https://serpapi.com/search", params=params)
|
| 51 |
+
return r.json()
|
| 52 |
+
|
| 53 |
+
def reverse_zenserp(image_url, api_key, location=None, lang="fr"):
|
| 54 |
+
url = "https://app.zenserp.com/api/v2/search"
|
| 55 |
+
headers = {"apikey": api_key}
|
| 56 |
+
params = {"image_url": image_url, "hl": lang}
|
| 57 |
+
if location:
|
| 58 |
+
params["location"] = location
|
| 59 |
+
r = requests.get(url, params=params, headers=headers)
|
| 60 |
+
if r.status_code != 200:
|
| 61 |
+
return {"error": f"HTTP {r.status_code} : {r.text[:100]} ..."}
|
| 62 |
+
try:
|
| 63 |
+
return r.json()
|
| 64 |
+
except Exception:
|
| 65 |
+
return {"error": r.text[:300]}
|
| 66 |
+
|
| 67 |
+
def get_opengraph_thumbnail(url):
|
| 68 |
+
try:
|
| 69 |
+
headers = {"User-Agent": "Mozilla/5.0"}
|
| 70 |
+
resp = requests.get(url, timeout=3, headers=headers)
|
| 71 |
+
soup = BeautifulSoup(resp.text, "html.parser")
|
| 72 |
+
og_image = soup.find("meta", property="og:image")
|
| 73 |
+
if og_image and og_image.get("content"):
|
| 74 |
+
return og_image["content"]
|
| 75 |
+
twitter_img = soup.find("meta", property="twitter:image")
|
| 76 |
+
if twitter_img and twitter_img.get("content"):
|
| 77 |
+
return twitter_img["content"]
|
| 78 |
+
parsed = requests.utils.urlparse(url)
|
| 79 |
+
base_url = f"{parsed.scheme}://{parsed.netloc}"
|
| 80 |
+
favicon_url = f"{base_url}/favicon.ico"
|
| 81 |
+
return favicon_url
|
| 82 |
+
except Exception:
|
| 83 |
+
return None
|
| 84 |
+
|
| 85 |
+
def extract_direct_url(raw_url):
|
| 86 |
+
if raw_url and "google.com/url" in raw_url and "url=" in raw_url:
|
| 87 |
+
parsed = urllib.parse.urlparse(raw_url)
|
| 88 |
+
qs = urllib.parse.parse_qs(parsed.query)
|
| 89 |
+
actual_url = qs.get("url", [None])[0]
|
| 90 |
+
return actual_url if actual_url else raw_url
|
| 91 |
+
return raw_url
|
| 92 |
+
|
| 93 |
+
st.header("FaceFinder OSINT | Recherche inversée multi-API (liens directs + miniatures)")
|
| 94 |
+
|
| 95 |
+
img_file = st.file_uploader("Téléverse une image (jpg/png)", type=["jpg", "jpeg", "png"])
|
| 96 |
+
img_url = None
|
| 97 |
+
if img_file:
|
| 98 |
+
img = face_recognition.load_image_file(img_file)
|
| 99 |
+
faces = face_recognition.face_locations(img)
|
| 100 |
+
st.write(f"Nombre de visages détectés : {len(faces)}")
|
| 101 |
+
pil_img = Image.open(img_file)
|
| 102 |
+
draw = ImageDraw.Draw(pil_img)
|
| 103 |
+
for i, (top, right, bottom, left) in enumerate(faces):
|
| 104 |
+
draw.rectangle([left, top, right, bottom], outline="red", width=3)
|
| 105 |
+
draw.text((left, top-10), f"Visage {i+1}", fill="red")
|
| 106 |
+
st.image(pil_img, caption="Image annotée")
|
| 107 |
+
# Télécharger image annotée
|
| 108 |
+
output = io.BytesIO()
|
| 109 |
+
pil_img.save(output, format="PNG")
|
| 110 |
+
st.download_button("Télécharger l'image annotée", output.getvalue(), file_name="FaceFinderOSINT_annoted.png", mime="image/png")
|
| 111 |
+
|
| 112 |
+
# Sauvegarde temporaire et upload sur ImgBB
|
| 113 |
+
img_path = os.path.join(os.getcwd(), "face_to_search.jpg")
|
| 114 |
+
pil_img.save(img_path)
|
| 115 |
+
img_url = upload_image_imgbb(img_path)
|
| 116 |
+
if img_url:
|
| 117 |
+
st.success(f"Image hébergée : {img_url}")
|
| 118 |
+
st.image(img_url)
|
| 119 |
+
st.markdown(f"[Ouvrir l’image dans le navigateur]({img_url})")
|
| 120 |
+
else:
|
| 121 |
+
st.error("Échec de l’upload sur ImgBB.")
|
| 122 |
+
|
| 123 |
+
if img_url:
|
| 124 |
+
st.markdown("## Lancer la recherche inversée")
|
| 125 |
+
location = st.text_input("Localisation (optionnel, ex: France, Paris)", value="")
|
| 126 |
+
lang = st.selectbox("Langue", ["fr", "en", "ar", "es", "de"], index=0)
|
| 127 |
+
|
| 128 |
+
for api in API_CONFIG:
|
| 129 |
+
used = API_CONFIG[api]["count"]
|
| 130 |
+
quota = API_CONFIG[api]["quota"]
|
| 131 |
+
st.write(f"{api} : {used}/{quota} requêtes utilisées")
|
| 132 |
+
btn = st.button(f"Recherche via {api}", key=api)
|
| 133 |
+
if btn:
|
| 134 |
+
if used < quota:
|
| 135 |
+
if api == "SerpApi":
|
| 136 |
+
result = reverse_serpapi(img_url, API_CONFIG[api]["api_key"])
|
| 137 |
+
if "image_results" in result:
|
| 138 |
+
st.write("### Principaux résultats SerpApi")
|
| 139 |
+
for res in result["image_results"][:5]:
|
| 140 |
+
link = extract_direct_url(res.get('link', ''))
|
| 141 |
+
thumb = res.get('thumbnail') or res.get('original')
|
| 142 |
+
if not thumb and link:
|
| 143 |
+
thumb = get_opengraph_thumbnail(link)
|
| 144 |
+
time.sleep(0.4)
|
| 145 |
+
if thumb:
|
| 146 |
+
st.image(thumb, width=100)
|
| 147 |
+
st.markdown(f"**{res.get('title','(Sans titre)')}**")
|
| 148 |
+
st.markdown(f"[Lien direct]({link})\n({res.get('displayed_link','')})")
|
| 149 |
+
st.write(f"_Source_: {res.get('source','')}")
|
| 150 |
+
if res.get('snippet'):
|
| 151 |
+
st.write(res['snippet'])
|
| 152 |
+
st.markdown("---")
|
| 153 |
+
else:
|
| 154 |
+
st.write("Aucun résultat d'image reconnu ou parsing impossible.")
|
| 155 |
+
|
| 156 |
+
elif api == "Zenserp":
|
| 157 |
+
result = reverse_zenserp(img_url, API_CONFIG[api]["api_key"], location=location or None, lang=lang)
|
| 158 |
+
if "error" in result:
|
| 159 |
+
st.error(f"Zenserp Error: {result['error']}")
|
| 160 |
+
else:
|
| 161 |
+
if "reverse_image_results" in result and "organic" in result["reverse_image_results"]:
|
| 162 |
+
st.write("### Principaux résultats Zenserp")
|
| 163 |
+
for res in result["reverse_image_results"]["organic"][:10]:
|
| 164 |
+
link = extract_direct_url(res.get('url', ''))
|
| 165 |
+
thumb = res.get('thumbnail') or res.get('image_url')
|
| 166 |
+
if not thumb and link:
|
| 167 |
+
thumb = get_opengraph_thumbnail(link)
|
| 168 |
+
time.sleep(0.4)
|
| 169 |
+
if thumb:
|
| 170 |
+
st.image(thumb, width=100)
|
| 171 |
+
st.markdown(f"**{res.get('title', '(Sans titre)')}**")
|
| 172 |
+
st.markdown(f"[Lien direct]({link})")
|
| 173 |
+
st.markdown("---")
|
| 174 |
+
else:
|
| 175 |
+
st.write("Aucun résultat d'image reconnu ou parsing impossible.")
|
| 176 |
+
API_CONFIG[api]["count"] += 1
|
| 177 |
+
save_counts()
|
| 178 |
+
else:
|
| 179 |
+
st.warning("Quota gratuit atteint pour cette API !")
|
| 180 |
+
|
| 181 |
+
st.markdown("---")
|
| 182 |
+
st.markdown("*Détection, annotation, hébergement sur ImgBB et recherche inversée automatisable sur toutes les APIs gratuites disponibles, avec miniatures et liens directs résolus !*")
|
pages/8_Domain_Intel.py
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Page Streamlit : Reconnaissance de Domaine
|
| 3 |
+
Module OSINT pour Ba7ath Dashboard
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import streamlit as st
|
| 7 |
+
import sys
|
| 8 |
+
import os
|
| 9 |
+
import pandas as pd
|
| 10 |
+
import time
|
| 11 |
+
|
| 12 |
+
# Ajouter le chemin des modules
|
| 13 |
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'spectre_modules'))
|
| 14 |
+
|
| 15 |
+
try:
|
| 16 |
+
from domain_recon import run_recon
|
| 17 |
+
except ImportError as e:
|
| 18 |
+
st.error(f"❌ Erreur d'import du module domain_recon : {e}")
|
| 19 |
+
st.stop()
|
| 20 |
+
|
| 21 |
+
# Configuration de la page
|
| 22 |
+
st.set_page_config(page_title="Domain Intel", page_icon="🗺️", layout="wide")
|
| 23 |
+
|
| 24 |
+
# En-tête
|
| 25 |
+
st.title("🗺️ Reconnaissance de Domaine")
|
| 26 |
+
st.caption("WHOIS, DNS et sous-domaines - Sources publiques uniquement")
|
| 27 |
+
|
| 28 |
+
# Avertissement légal
|
| 29 |
+
with st.expander("⚖️ Mentions légales", expanded=False):
|
| 30 |
+
st.info("""
|
| 31 |
+
**Utilisation éthique uniquement**
|
| 32 |
+
|
| 33 |
+
Ce module collecte uniquement des informations publiques :
|
| 34 |
+
- Enregistrements WHOIS (base publique)
|
| 35 |
+
- Records DNS (résolution publique)
|
| 36 |
+
- Sous-domaines actifs (requêtes HTTP standard)
|
| 37 |
+
|
| 38 |
+
⚠️ N'utilisez cet outil que sur des domaines dont vous avez l'autorisation
|
| 39 |
+
ou dans le cadre d'une investigation OSINT légitime.
|
| 40 |
+
""")
|
| 41 |
+
|
| 42 |
+
# Formulaire de saisie
|
| 43 |
+
st.markdown("---")
|
| 44 |
+
|
| 45 |
+
col1, col2 = st.columns([3, 1])
|
| 46 |
+
|
| 47 |
+
with col1:
|
| 48 |
+
domain_input = st.text_input(
|
| 49 |
+
"🔍 Domaine à investiguer",
|
| 50 |
+
placeholder="exemple.com (sans http:// ni www)",
|
| 51 |
+
help="Entrez uniquement le nom de domaine, sans protocole"
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
with col2:
|
| 55 |
+
st.write("") # Espacement
|
| 56 |
+
st.write("") # Espacement
|
| 57 |
+
scan_subdomains = st.checkbox(
|
| 58 |
+
"Scanner les sous-domaines",
|
| 59 |
+
value=True,
|
| 60 |
+
help="⚠️ Peut prendre 1-3 minutes selon la taille de la wordlist"
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
# Nettoyage de l'input
|
| 64 |
+
if domain_input:
|
| 65 |
+
domain_input = domain_input.strip().lower()
|
| 66 |
+
domain_input = domain_input.replace('http://', '').replace('https://', '')
|
| 67 |
+
domain_input = domain_input.replace('www.', '')
|
| 68 |
+
domain_input = domain_input.split('/')[0] # Enlever les chemins
|
| 69 |
+
|
| 70 |
+
# Bouton d'analyse
|
| 71 |
+
analyze_btn = st.button("🚀 Lancer l'analyse", type="primary", use_container_width=True)
|
| 72 |
+
|
| 73 |
+
# Exécution de l'analyse
|
| 74 |
+
if analyze_btn:
|
| 75 |
+
if not domain_input:
|
| 76 |
+
st.error("⚠️ Veuillez entrer un nom de domaine")
|
| 77 |
+
else:
|
| 78 |
+
# Validation basique du format
|
| 79 |
+
if '.' not in domain_input or ' ' in domain_input:
|
| 80 |
+
st.error("⚠️ Format de domaine invalide")
|
| 81 |
+
else:
|
| 82 |
+
st.markdown("---")
|
| 83 |
+
|
| 84 |
+
# Barre de progression
|
| 85 |
+
progress_bar = st.progress(0, text="Initialisation...")
|
| 86 |
+
|
| 87 |
+
try:
|
| 88 |
+
# Lancement de la reconnaissance
|
| 89 |
+
progress_bar.progress(10, text="🔍 Récupération WHOIS...")
|
| 90 |
+
|
| 91 |
+
with st.spinner("Analyse en cours..."):
|
| 92 |
+
results = run_recon(domain_input, scan_subdomains=scan_subdomains)
|
| 93 |
+
|
| 94 |
+
progress_bar.progress(100, text="✅ Analyse terminée !")
|
| 95 |
+
progress_bar.empty()
|
| 96 |
+
|
| 97 |
+
# Affichage des résultats
|
| 98 |
+
st.success(f"✅ Analyse terminée pour **{domain_input}**")
|
| 99 |
+
|
| 100 |
+
# Organisation en onglets
|
| 101 |
+
tab1, tab2, tab3, tab4 = st.tabs([
|
| 102 |
+
"📋 WHOIS",
|
| 103 |
+
"🌐 DNS Records",
|
| 104 |
+
"🔗 Sous-domaines",
|
| 105 |
+
"📥 Export"
|
| 106 |
+
])
|
| 107 |
+
|
| 108 |
+
# --- ONGLET WHOIS ---
|
| 109 |
+
with tab1:
|
| 110 |
+
st.subheader("Informations d'enregistrement")
|
| 111 |
+
|
| 112 |
+
whois_data = results.get('whois', {})
|
| 113 |
+
|
| 114 |
+
if 'error' in whois_data:
|
| 115 |
+
st.warning(f"⚠️ {whois_data['error']}")
|
| 116 |
+
elif whois_data:
|
| 117 |
+
# Extraire les infos clés
|
| 118 |
+
key_info = {}
|
| 119 |
+
for key in ['registrar', 'creation_date', 'expiration_date',
|
| 120 |
+
'updated_date', 'status', 'name_servers']:
|
| 121 |
+
if key in whois_data:
|
| 122 |
+
key_info[key] = whois_data[key]
|
| 123 |
+
|
| 124 |
+
if key_info:
|
| 125 |
+
col_a, col_b = st.columns(2)
|
| 126 |
+
|
| 127 |
+
with col_a:
|
| 128 |
+
st.metric("📌 Registrar", key_info.get('registrar', 'N/A'))
|
| 129 |
+
st.metric("📅 Date de création", key_info.get('creation_date', 'N/A'))
|
| 130 |
+
|
| 131 |
+
with col_b:
|
| 132 |
+
st.metric("⏰ Expiration", key_info.get('expiration_date', 'N/A'))
|
| 133 |
+
st.metric("🔄 Dernière MAJ", key_info.get('updated_date', 'N/A'))
|
| 134 |
+
|
| 135 |
+
st.write("**Statut :**", key_info.get('status', 'N/A'))
|
| 136 |
+
|
| 137 |
+
if 'name_servers' in key_info:
|
| 138 |
+
st.write("**Serveurs de noms :**")
|
| 139 |
+
st.code(key_info['name_servers'])
|
| 140 |
+
|
| 141 |
+
# Affichage complet en expander
|
| 142 |
+
with st.expander("📄 Voir toutes les données WHOIS"):
|
| 143 |
+
st.json(whois_data)
|
| 144 |
+
else:
|
| 145 |
+
st.info("Aucune donnée WHOIS disponible")
|
| 146 |
+
|
| 147 |
+
# --- ONGLET DNS ---
|
| 148 |
+
with tab2:
|
| 149 |
+
st.subheader("Enregistrements DNS")
|
| 150 |
+
|
| 151 |
+
dns_data = results.get('dns', {})
|
| 152 |
+
|
| 153 |
+
if dns_data:
|
| 154 |
+
# Créer un DataFrame pour affichage
|
| 155 |
+
dns_rows = []
|
| 156 |
+
for record_type, records in dns_data.items():
|
| 157 |
+
if records:
|
| 158 |
+
for record in records:
|
| 159 |
+
dns_rows.append({
|
| 160 |
+
'Type': record_type,
|
| 161 |
+
'Valeur': record
|
| 162 |
+
})
|
| 163 |
+
|
| 164 |
+
if dns_rows:
|
| 165 |
+
dns_df = pd.DataFrame(dns_rows)
|
| 166 |
+
|
| 167 |
+
# Affichage avec style (CORRIGÉ)
|
| 168 |
+
st.dataframe(
|
| 169 |
+
dns_df,
|
| 170 |
+
width='stretch', # ← Correction ici
|
| 171 |
+
hide_index=True
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
# Statistiques
|
| 175 |
+
st.caption(f"📊 **{len(dns_rows)} enregistrements** trouvés sur **{len([t for t in dns_data if dns_data[t]])} types** différents")
|
| 176 |
+
else:
|
| 177 |
+
st.info("Aucun enregistrement DNS trouvé")
|
| 178 |
+
else:
|
| 179 |
+
st.warning("Impossible de récupérer les enregistrements DNS")
|
| 180 |
+
|
| 181 |
+
# --- ONGLET SOUS-DOMAINES ---
|
| 182 |
+
with tab3:
|
| 183 |
+
st.subheader("Sous-domaines actifs")
|
| 184 |
+
|
| 185 |
+
subdomains = results.get('subdomains', [])
|
| 186 |
+
|
| 187 |
+
if subdomains:
|
| 188 |
+
st.success(f"✅ **{len(subdomains)} sous-domaines** découverts")
|
| 189 |
+
|
| 190 |
+
# Affichage en colonnes
|
| 191 |
+
cols = st.columns(3)
|
| 192 |
+
for idx, subdomain in enumerate(subdomains):
|
| 193 |
+
with cols[idx % 3]:
|
| 194 |
+
st.text(f"🔗 {subdomain}")
|
| 195 |
+
|
| 196 |
+
# Liste complète en expander
|
| 197 |
+
with st.expander("📋 Liste complète (copiable)"):
|
| 198 |
+
st.code('\n'.join(subdomains))
|
| 199 |
+
|
| 200 |
+
elif scan_subdomains:
|
| 201 |
+
st.info("Aucun sous-domaine trouvé dans la wordlist")
|
| 202 |
+
else:
|
| 203 |
+
st.info("Scan de sous-domaines désactivé")
|
| 204 |
+
|
| 205 |
+
# --- ONGLET EXPORT (CORRIGÉ) ---
|
| 206 |
+
with tab4:
|
| 207 |
+
st.subheader("Exportation des données")
|
| 208 |
+
|
| 209 |
+
# Export CSV avec timestamp
|
| 210 |
+
export_data = []
|
| 211 |
+
|
| 212 |
+
# Métadonnées
|
| 213 |
+
export_data.append({
|
| 214 |
+
'Catégorie': 'Métadonnées',
|
| 215 |
+
'Type': 'Domaine',
|
| 216 |
+
'Clé': 'domaine_cible',
|
| 217 |
+
'Valeur': domain_input,
|
| 218 |
+
'Timestamp': time.strftime('%Y-%m-%d %H:%M:%S')
|
| 219 |
+
})
|
| 220 |
+
|
| 221 |
+
# WHOIS
|
| 222 |
+
for key, value in results.get('whois', {}).items():
|
| 223 |
+
export_data.append({
|
| 224 |
+
'Catégorie': 'WHOIS',
|
| 225 |
+
'Type': key,
|
| 226 |
+
'Clé': key,
|
| 227 |
+
'Valeur': value,
|
| 228 |
+
'Timestamp': time.strftime('%Y-%m-%d %H:%M:%S')
|
| 229 |
+
})
|
| 230 |
+
|
| 231 |
+
# DNS
|
| 232 |
+
for record_type, records in results.get('dns', {}).items():
|
| 233 |
+
for record in records:
|
| 234 |
+
export_data.append({
|
| 235 |
+
'Catégorie': 'DNS',
|
| 236 |
+
'Type': record_type,
|
| 237 |
+
'Clé': record_type,
|
| 238 |
+
'Valeur': record,
|
| 239 |
+
'Timestamp': time.strftime('%Y-%m-%d %H:%M:%S')
|
| 240 |
+
})
|
| 241 |
+
|
| 242 |
+
# Sous-domaines
|
| 243 |
+
for subdomain in results.get('subdomains', []):
|
| 244 |
+
export_data.append({
|
| 245 |
+
'Catégorie': 'Sous-domaine',
|
| 246 |
+
'Type': 'Actif',
|
| 247 |
+
'Clé': 'subdomain',
|
| 248 |
+
'Valeur': subdomain,
|
| 249 |
+
'Timestamp': time.strftime('%Y-%m-%d %H:%M:%S')
|
| 250 |
+
})
|
| 251 |
+
|
| 252 |
+
export_df = pd.DataFrame(export_data)
|
| 253 |
+
|
| 254 |
+
col_exp1, col_exp2 = st.columns(2)
|
| 255 |
+
|
| 256 |
+
with col_exp1:
|
| 257 |
+
st.download_button(
|
| 258 |
+
label="📥 Télécharger le rapport CSV",
|
| 259 |
+
data=export_df.to_csv(index=False, encoding='utf-8-sig').encode('utf-8-sig'),
|
| 260 |
+
file_name=f"domain_intel_{domain_input.replace('.', '_')}.csv",
|
| 261 |
+
mime="text/csv",
|
| 262 |
+
use_container_width=True
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
with col_exp2:
|
| 266 |
+
# Bouton pour le rapport CSV automatique (si généré)
|
| 267 |
+
if results.get('report_filename'):
|
| 268 |
+
report_path = os.path.join('reports', results['report_filename'])
|
| 269 |
+
if os.path.exists(report_path):
|
| 270 |
+
with open(report_path, 'rb') as f: # ← Mode binaire pour CSV
|
| 271 |
+
report_content = f.read()
|
| 272 |
+
|
| 273 |
+
st.download_button(
|
| 274 |
+
label="📄 Télécharger le rapport complet",
|
| 275 |
+
data=report_content,
|
| 276 |
+
file_name=results['report_filename'],
|
| 277 |
+
mime="text/csv", # ← CSV au lieu de text/plain
|
| 278 |
+
use_container_width=True
|
| 279 |
+
)
|
| 280 |
+
|
| 281 |
+
# Aperçu des données (CORRIGÉ)
|
| 282 |
+
with st.expander("👁️ Aperçu des données CSV"):
|
| 283 |
+
st.dataframe(export_df, width='stretch') # ← Correction ici
|
| 284 |
+
|
| 285 |
+
# Statistiques
|
| 286 |
+
st.caption(f"""
|
| 287 |
+
📊 **Statistiques du rapport**
|
| 288 |
+
- Total d'entrées : {len(export_df)}
|
| 289 |
+
- WHOIS : {len(export_df[export_df['Catégorie'] == 'WHOIS'])} entrées
|
| 290 |
+
- DNS : {len(export_df[export_df['Catégorie'] == 'DNS'])} enregistrements
|
| 291 |
+
- Sous-domaines : {len(export_df[export_df['Catégorie'] == 'Sous-domaine'])} trouvés
|
| 292 |
+
""")
|
| 293 |
+
|
| 294 |
+
except Exception as e:
|
| 295 |
+
progress_bar.empty()
|
| 296 |
+
st.error(f"❌ Erreur lors de l'analyse : {str(e)}")
|
| 297 |
+
|
| 298 |
+
with st.expander("🐛 Détails de l'erreur (pour debug)"):
|
| 299 |
+
st.exception(e)
|
| 300 |
+
|
| 301 |
+
# Pied de page
|
| 302 |
+
st.markdown("---")
|
| 303 |
+
st.caption("🕵️ Ba7ath OSINT Suite | Module de reconnaissance passive")
|
pages/9_SubdomainFinder.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.set_page_config(page_title="Accès Restreint", page_icon="🔒", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.locked-container {
|
| 8 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
border-radius: 16px;
|
| 11 |
+
text-align: center;
|
| 12 |
+
color: white;
|
| 13 |
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
| 14 |
+
margin-top: 2rem;
|
| 15 |
+
border: 1px solid #334155;
|
| 16 |
+
}
|
| 17 |
+
.locked-icon {
|
| 18 |
+
font-size: 4rem;
|
| 19 |
+
margin-bottom: 1.5rem;
|
| 20 |
+
animation: pulse 2s infinite;
|
| 21 |
+
}
|
| 22 |
+
.locked-title {
|
| 23 |
+
font-size: 2.2rem;
|
| 24 |
+
font-weight: 800;
|
| 25 |
+
margin-bottom: 1rem;
|
| 26 |
+
background: linear-gradient(to right, #60a5fa, #3b82f6);
|
| 27 |
+
-webkit-background-clip: text;
|
| 28 |
+
-webkit-text-fill-color: transparent;
|
| 29 |
+
}
|
| 30 |
+
.locked-text {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
color: #94a3b8;
|
| 33 |
+
line-height: 1.6;
|
| 34 |
+
margin-bottom: 2rem;
|
| 35 |
+
max-width: 600px;
|
| 36 |
+
margin-left: auto;
|
| 37 |
+
margin-right: auto;
|
| 38 |
+
}
|
| 39 |
+
.badge-team {
|
| 40 |
+
display: inline-block;
|
| 41 |
+
background: rgba(59, 130, 246, 0.1);
|
| 42 |
+
color: #60a5fa;
|
| 43 |
+
padding: 0.75rem 1.5rem;
|
| 44 |
+
border-radius: 9999px;
|
| 45 |
+
font-weight: 600;
|
| 46 |
+
font-size: 0.95rem;
|
| 47 |
+
border: 1px solid rgba(59, 130, 246, 0.2);
|
| 48 |
+
letter-spacing: 0.5px;
|
| 49 |
+
}
|
| 50 |
+
@keyframes pulse {
|
| 51 |
+
0% { transform: scale(1); }
|
| 52 |
+
50% { transform: scale(1.05); }
|
| 53 |
+
100% { transform: scale(1); }
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
|
| 57 |
+
<div class="locked-container">
|
| 58 |
+
<div class="locked-icon">🛡️</div>
|
| 59 |
+
<div class="locked-title">Accès Restreint</div>
|
| 60 |
+
<div class="locked-text">
|
| 61 |
+
Ce module avancé a été désactivé dans cette version afin d'optimiser les performances et d'alléger l'application finale.<br><br>
|
| 62 |
+
Il requiert des ressources matérielles spécifiques ou des configurations environnementales complexes.
|
| 63 |
+
</div>
|
| 64 |
+
<div class="badge-team">
|
| 65 |
+
🔒 Applications Réservées à Ba7ath Project Team
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
""", unsafe_allow_html=True)
|
| 69 |
+
|
| 70 |
+
st.stop()
|
reports/.gitkeep
ADDED
|
File without changes
|
requirements.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
python-dotenv
|
| 3 |
+
requests
|
| 4 |
+
pandas
|
| 5 |
+
beautifulsoup4
|
| 6 |
+
selenium
|
| 7 |
+
folium
|
| 8 |
+
streamlit-folium
|
| 9 |
+
maigret
|
| 10 |
+
TikTokApi
|
| 11 |
+
python-whois
|
| 12 |
+
plotly
|
| 13 |
+
exifread
|
| 14 |
+
face_recognition
|
| 15 |
+
duckduckgo_search
|
| 16 |
+
google-api-python-client
|
run_app.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import webbrowser
|
| 4 |
+
import threading
|
| 5 |
+
import time
|
| 6 |
+
import multiprocessing
|
| 7 |
+
import config
|
| 8 |
+
|
| 9 |
+
# Charger les clés API dans l'environnement virtuel en toute sécurité
|
| 10 |
+
config.load_keys()
|
| 11 |
+
|
| 12 |
+
def start_streamlit():
|
| 13 |
+
# Import streamlit inside the function to ensure freeze_support is called first
|
| 14 |
+
import streamlit.web.cli as stcli
|
| 15 |
+
|
| 16 |
+
os.environ["STREAMLIT_SERVER_HEADLESS"] = "true"
|
| 17 |
+
os.environ["STREAMLIT_SERVER_PORT"] = "8501"
|
| 18 |
+
os.environ["STREAMLIT_SERVER_FILE_WATCHER_TYPE"] = "none"
|
| 19 |
+
os.environ["STREAMLIT_GLOBAL_DISABLE_WATCHDOG"] = "true"
|
| 20 |
+
os.environ["STREAMLIT_BROWSER_GATHER_USAGE_STATS"] = "false"
|
| 21 |
+
|
| 22 |
+
if getattr(sys, 'frozen', False):
|
| 23 |
+
base_dir = sys._MEIPASS
|
| 24 |
+
else:
|
| 25 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 26 |
+
|
| 27 |
+
dashboard_path = os.path.join(base_dir, 'dashboard.py')
|
| 28 |
+
sys.argv = ["streamlit", "run", dashboard_path, "--global.developmentMode=false"]
|
| 29 |
+
|
| 30 |
+
# Exécuter streamlit
|
| 31 |
+
sys.exit(stcli.main())
|
| 32 |
+
|
| 33 |
+
def open_browser():
|
| 34 |
+
time.sleep(3) # Attendre 3 secondes que le serveur Streamlit démarre
|
| 35 |
+
webbrowser.open("http://localhost:8501")
|
| 36 |
+
|
| 37 |
+
if __name__ == "__main__":
|
| 38 |
+
# Indispensable pour PyInstaller sur Windows avec certains packages (ex: playwright)
|
| 39 |
+
multiprocessing.freeze_support()
|
| 40 |
+
|
| 41 |
+
# Ouvrir le navigateur dans un thread séparé
|
| 42 |
+
threading.Thread(target=open_browser, daemon=True).start()
|
| 43 |
+
|
| 44 |
+
# Démarrer le serveur Streamlit
|
| 45 |
+
start_streamlit()
|
sherlock/.actor/Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM sherlock/sherlock as sherlock
|
| 2 |
+
|
| 3 |
+
# Install Node.js
|
| 4 |
+
RUN apt-get update; apt-get install curl gpg -y
|
| 5 |
+
RUN mkdir -p /etc/apt/keyrings
|
| 6 |
+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
| 7 |
+
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
| 8 |
+
RUN apt-get update && apt-get install -y curl bash git jq jo xz-utils nodejs
|
| 9 |
+
|
| 10 |
+
# Install Apify CLI (node.js) for the Actor Runtime
|
| 11 |
+
RUN npm -g install apify-cli
|
| 12 |
+
|
| 13 |
+
# Install Dependencies for the Actor Shell Script
|
| 14 |
+
RUN apt-get update && apt-get install -y bash jq jo xz-utils nodejs
|
| 15 |
+
|
| 16 |
+
# Copy Actor dir with the actorization shell script
|
| 17 |
+
COPY .actor/ .actor
|
| 18 |
+
|
| 19 |
+
ENTRYPOINT [".actor/actor.sh"]
|
sherlock/.actor/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sherlock Actor on Apify
|
| 2 |
+
|
| 3 |
+
[](https://apify.com/netmilk/sherlock?fpr=sherlock)
|
| 4 |
+
|
| 5 |
+
This Actor wraps the [Sherlock Project](https://sherlockproject.xyz/) to provide serverless username reconnaissance across social networks in the cloud. It helps you find usernames across multiple social media platforms without installing and running the tool locally.
|
| 6 |
+
|
| 7 |
+
## What are Actors?
|
| 8 |
+
[Actors](https://docs.apify.com/platform/actors?fpr=sherlock) are serverless microservices running on the [Apify Platform](https://apify.com/?fpr=sherlock). They are based on the [Actor SDK](https://docs.apify.com/sdk/js?fpr=sherlock) and can be found in the [Apify Store](https://apify.com/store?fpr=sherlock). Learn more about Actors in the [Apify Whitepaper](https://whitepaper.actor?fpr=sherlock).
|
| 9 |
+
|
| 10 |
+
## Usage
|
| 11 |
+
|
| 12 |
+
### Apify Console
|
| 13 |
+
|
| 14 |
+
1. Go to the Apify Actor page
|
| 15 |
+
2. Click "Run"
|
| 16 |
+
3. In the input form, fill in **Username(s)** to search for
|
| 17 |
+
4. The Actor will run and produce its outputs in the default datastore
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
### Apify CLI
|
| 21 |
+
|
| 22 |
+
```bash
|
| 23 |
+
apify call YOUR_USERNAME/sherlock --input='{
|
| 24 |
+
"usernames": ["johndoe", "janedoe"]
|
| 25 |
+
}'
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
### Using Apify API
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
curl --request POST \
|
| 32 |
+
--url "https://api.apify.com/v2/acts/YOUR_USERNAME~sherlock/run" \
|
| 33 |
+
--header 'Content-Type: application/json' \
|
| 34 |
+
--header 'Authorization: Bearer YOUR_API_TOKEN' \
|
| 35 |
+
--data '{
|
| 36 |
+
"usernames": ["johndoe", "janedoe"],
|
| 37 |
+
}
|
| 38 |
+
}'
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Input Parameters
|
| 42 |
+
|
| 43 |
+
The Actor accepts a JSON schema with the following structure:
|
| 44 |
+
|
| 45 |
+
| Field | Type | Required | Default | Description |
|
| 46 |
+
|-------|------|----------|---------|-------------|
|
| 47 |
+
| `usernames` | array | Yes | - | List of usernames to search for |
|
| 48 |
+
| `usernames[]` | string | Yes | "json" | Username to search for |
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
### Example Input
|
| 52 |
+
|
| 53 |
+
```json
|
| 54 |
+
{
|
| 55 |
+
"usernames": ["techuser", "designuser"],
|
| 56 |
+
}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Output
|
| 60 |
+
|
| 61 |
+
The Actor provides three types of outputs:
|
| 62 |
+
|
| 63 |
+
### Dataset Record*
|
| 64 |
+
|
| 65 |
+
| Field | Type | Required | Description |
|
| 66 |
+
|-------|------|----------|-------------|
|
| 67 |
+
| `username` | string | Yes | Username the search was conducted for |
|
| 68 |
+
| `links` | array | Yes | Array with found links to the social media |
|
| 69 |
+
| `links[]`| string | No | URL to the account
|
| 70 |
+
|
| 71 |
+
### Example Dataset Item (JSON)
|
| 72 |
+
|
| 73 |
+
```json
|
| 74 |
+
{
|
| 75 |
+
"username": "johndoe",
|
| 76 |
+
"links": [
|
| 77 |
+
"https://github.com/johndoe"
|
| 78 |
+
]
|
| 79 |
+
}
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Performance & Resources
|
| 83 |
+
|
| 84 |
+
- **Memory Requirements**:
|
| 85 |
+
- Minimum: 512 MB RAM
|
| 86 |
+
- Recommended: 1 GB RAM for multiple usernames
|
| 87 |
+
- **Processing Time**:
|
| 88 |
+
- Single username: ~1-2 minutes
|
| 89 |
+
- Multiple usernames: 2-5 minutes
|
| 90 |
+
- Varies based on number of sites checked and response times
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
For more help, check the [Sherlock Project documentation](https://github.com/sherlock-project/sherlock) or raise an issue in the Actor's repository.
|
sherlock/.actor/actor.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
INPUT=`apify actor:get-input | jq -r .usernames[] | xargs echo`
|
| 3 |
+
echo "INPUT: $INPUT"
|
| 4 |
+
|
| 5 |
+
sherlock $INPUT
|
| 6 |
+
|
| 7 |
+
for username in $INPUT; do
|
| 8 |
+
# escape the special meaning leading characters
|
| 9 |
+
# https://github.com/jpmens/jo/blob/master/jo.md#description
|
| 10 |
+
safe_username=$(echo $username | sed 's/^@/\\@/' | sed 's/^:/\\:/' | sed 's/%/\\%/')
|
| 11 |
+
echo "pushing results for username: $username, content:"
|
| 12 |
+
cat $username.txt
|
| 13 |
+
sed '$d' $username.txt | jo -a | jo username=$safe_username links:=- | apify actor:push-data
|
| 14 |
+
done
|
sherlock/.dockerignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git/
|
| 2 |
+
.vscode/
|
| 3 |
+
screenshot/
|
| 4 |
+
tests/
|
| 5 |
+
*.txt
|
| 6 |
+
!/requirements.txt
|
| 7 |
+
venv/
|
| 8 |
+
devel/
|
sherlock/.editorconfig
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
root = true
|
| 2 |
+
|
| 3 |
+
[*]
|
| 4 |
+
indent_style = space
|
| 5 |
+
indent_size = 2
|
| 6 |
+
end_of_line = lf
|
| 7 |
+
charset = utf-8
|
| 8 |
+
trim_trailing_whitespace = true
|
| 9 |
+
insert_final_newline = true
|
| 10 |
+
curly_bracket_next_line = false
|
| 11 |
+
spaces_around_operators = true
|
| 12 |
+
|
| 13 |
+
[*.{markdown,md}]
|
| 14 |
+
trim_trailing_whitespace = false
|
| 15 |
+
|
| 16 |
+
[*.py]
|
| 17 |
+
indent_size = 4
|
| 18 |
+
quote_type = double
|
sherlock/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### REPOSITORY
|
| 2 |
+
/.github/CODEOWNERS @sdushantha @ppfeister
|
| 3 |
+
/.github/FUNDING.yml @sdushantha
|
| 4 |
+
/LICENSE @sdushantha
|
| 5 |
+
|
| 6 |
+
### PACKAGING
|
| 7 |
+
# Changes made to these items without code owner approval may negatively
|
| 8 |
+
# impact packaging pipelines.
|
| 9 |
+
/pyproject.toml @ppfeister @sdushantha
|
| 10 |
+
|
| 11 |
+
### REGRESSION
|
| 12 |
+
/.github/workflows/regression.yml @ppfeister
|
| 13 |
+
/tox.ini @ppfeister
|
| 14 |
+
/pytest.ini @ppfeister
|
| 15 |
+
/tests/ @ppfeister
|
sherlock/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
github: [ sdushantha, ppfeister, matheusfelipeog ]
|
sherlock/.github/ISSUE_TEMPLATE/bug-report.yml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Bug report
|
| 2 |
+
description: File a bug report
|
| 3 |
+
labels: ["bug"]
|
| 4 |
+
body:
|
| 5 |
+
- type: dropdown
|
| 6 |
+
id: package
|
| 7 |
+
attributes:
|
| 8 |
+
label: Installation method
|
| 9 |
+
description: |
|
| 10 |
+
Some packages are maintained by the community, rather than by the Sherlock Project.
|
| 11 |
+
Knowing which packages are affected helps us diagnose package-specific bugs.
|
| 12 |
+
options:
|
| 13 |
+
- Select one
|
| 14 |
+
- PyPI (via pip)
|
| 15 |
+
- Homebrew
|
| 16 |
+
- Docker
|
| 17 |
+
- Kali repository (via apt)
|
| 18 |
+
- Built from source
|
| 19 |
+
- Other (indicate below)
|
| 20 |
+
validations:
|
| 21 |
+
required: true
|
| 22 |
+
- type: input
|
| 23 |
+
id: package-version
|
| 24 |
+
attributes:
|
| 25 |
+
label: Package version
|
| 26 |
+
description: |
|
| 27 |
+
Knowing the version of the package you are using can help us diagnose your issue more quickly.
|
| 28 |
+
You can find the version by running `sherlock --version`.
|
| 29 |
+
validations:
|
| 30 |
+
required: true
|
| 31 |
+
- type: textarea
|
| 32 |
+
id: description
|
| 33 |
+
attributes:
|
| 34 |
+
label: Description
|
| 35 |
+
description: |
|
| 36 |
+
Detailed descriptions that help contributors understand and reproduce your bug are much more likely to lead to a fix.
|
| 37 |
+
Please include the following information:
|
| 38 |
+
- What you were trying to do
|
| 39 |
+
- What you expected to happen
|
| 40 |
+
- What actually happened
|
| 41 |
+
placeholder: |
|
| 42 |
+
When doing {action}, the expected result should be {expected result}.
|
| 43 |
+
When doing {action}, however, the actual result was {actual result}.
|
| 44 |
+
This is undesirable because {reason}.
|
| 45 |
+
validations:
|
| 46 |
+
required: true
|
| 47 |
+
- type: textarea
|
| 48 |
+
id: steps-to-reproduce
|
| 49 |
+
attributes:
|
| 50 |
+
label: Steps to reproduce
|
| 51 |
+
description: Write a step by step list that will allow us to reproduce this bug.
|
| 52 |
+
placeholder: |
|
| 53 |
+
1. Do something
|
| 54 |
+
2. Then do something else
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
- type: textarea
|
| 58 |
+
id: additional-info
|
| 59 |
+
attributes:
|
| 60 |
+
label: Additional information
|
| 61 |
+
description: If you have some additional information, please write it here.
|
| 62 |
+
validations:
|
| 63 |
+
required: false
|
| 64 |
+
- type: checkboxes
|
| 65 |
+
id: terms
|
| 66 |
+
attributes:
|
| 67 |
+
label: Code of Conduct
|
| 68 |
+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/sherlock-project/sherlock/blob/master/docs/CODE_OF_CONDUCT.md).
|
| 69 |
+
options:
|
| 70 |
+
- label: I agree to follow this project's Code of Conduct
|
| 71 |
+
required: true
|