
Automatisez l'exécution d'exploits/PoC sur les résultats de recherche Shodan - répartition concurrente, filtrage, sortie structurée et exportation.
Automatisez l'exécution d'exploits et de PoC à partir des résultats de recherche Shodan. Interrogez Shodan, filtrez les cibles et exécutez vos scripts sur chaque correspondance - en concurrence, avec une sortie structurée et une exportation.
Vous avez un script PoC qui prend une IP et un port. Vous souhaitez l'exécuter sur chaque hôte correspondant à une requête Shodan. ShodScript comble le fossé : rechercher, filtrer, distribuer, collecter les résultats.
pip install git+https://github.com/momenbasel/shodscript.git
Ou clonez et installez localement :
git clone https://github.com/momenbasel/shodscript.git
cd shodscript
pip install -e .
Définissez votre clé API Shodan :
export SHODAN_API_KEY="votre-clé-api-ici"
Ou passez-la avec --api-key / -k à chaque commande.
# Table output
shodscript search "apache 2.4.49"
# Filter by port and country
shodscript search "nginx" --port 443 --country US --limit 50
# JSON output
shodscript search "apache" --json
# Run check_http.py against each host matching "apache 2.4.49"
shodscript run "apache 2.4.49" ./exploit.py
# 20 concurrent workers, 60s timeout per target
shodscript run "apache 2.4.49" ./exploit.py -w 20 -t 60
# Filter to port 80 in Germany, save results
shodscript run "apache" ./exploit.py --port 80 --country DE -o results.json
# CSV export
shodscript run "nginx" ./check.py -o results.csv --format csv
# Only show successful hits
shodscript run "apache" ./exploit.py --quiet
Trois modes via --pass-via :
# Pass via environment variables
shodscript run "nginx" ./script.py --pass-via env
# Pass via stdin
shodscript run "nginx" ./script.py --pass-via stdin
# Forward extra arguments to the script
shodscript run "nginx" ./script.py -e "--verbose" -e "--ssl"
# One IP per line - pipe to other tools
shodscript ips "apache 2.4.49" | xargs -I{} curl -s http://{}
# Include port
shodscript ips "apache 2.4.49" --with-port
# Pipe to nuclei, httpx, etc.
shodscript ips "apache 2.4.49" -n 500 | httpx -silent
shodscript host 1.2.3.4
shodscript host 1.2.3.4 --json
shodscript info
Votre script doit simplement accepter une IP et un port. Exemple minimal :
#!/usr/bin/env python3
import sys
ip = sys.argv[1]
port = int(sys.argv[2])
# Your exploit/check logic here
print(f"[+] {ip}:{port} - vulnerable")
# Exit 0 = success (marked green), non-zero = failure (marked red)
Consultez le répertoire examples/ pour d'autres modèles, y compris ceux basés sur les variables d'environnement et les scripts de capture de bannière.
Les résultats peuvent être sauvegardés en JSON, JSONL ou CSV :
shodscript run "query" ./script.py -o results.json # JSON (par défaut)
shodscript run "query" ./script.py -o results.jsonl --format jsonl # Un objet JSON par ligne
shodscript run "query" ./script.py -o results.csv --format csv # CSV
Chaque enregistrement contient : ip, port, host, org, country, returncode, success, stdout, stderr, elapsed, error.
MIT
Pour les tests de sécurité autorisés et la recherche uniquement.
| Mode | Comment votre script reçoit la cible |
|---|
arg (par défaut) | python3 script.py <ip> <port> |
env | Variables d'environnement TARGET_IP, TARGET_PORT, TARGET_HOST |
stdin | ip:port\n écrit sur l'entrée standard |