Skip to content
KitploitKITPLOIT
OutilsBlog
Soumettre
OutilsBlog
Soumettre

Outils de Hacking, PenTest et Cybersécurité pour votre Arsenal de Sécurité !

Kitploit est un répertoire d'outils de hacking, de cybersécurité et de pentesting. Découvrez les dernières mises à jour des projets pour trouver des vulnérabilités, analyser des systèmes, automatiser les tests et renforcer votre sécurité.

··Flux·Contact·Confidentialité·© 2026 Kitploit

Répertoire d'outils

Catégories

Voir toutes les catégories
Loading categories
xtor | Kitploit
Outils/GitHubGitHub/khalidelborai/xtor
Scripting et AutomatisationSécurité RéseauProtection de la Vie PrivéeUtilitaires et FrameworksCrawler
GitHubkhalidelborai/xtor

xtor

Voir le dépôt
11il y a 6 moisPas encore vérifié

Populaires

Voir tout →

Découvrez les outils les plus utilisés par notre communauté.

Explorer tous les outils

Parcourez notre collection d'outils

Voir tous les outils →
Partager
Site web

xtor

Bibliothèque Python pour gérer des instances Tor par programmation.

PyPI version Python 3.10+ License: GPL-3.0-or-later CI

Fonctionnalités

  • Lancer de nouveaux processus Tor ou se connecter à des instances existantes
  • Clients httpx préconfigurés (synchrone + asynchrone) avec proxy SOCKS5
  • Rotation d'identité avec attente facultative d'une nouvelle IP
  • Isolation des flux pour la séparation du trafic
  • Gestion des circuits et des flux
  • Informations sur le nœud de sortie (pays, bande passante, flags)
  • Services cachés éphémères (.onion)
  • Écouteurs d'événements (événements de circuit, de flux, de bande passante)
  • TorPool pour gérer plusieurs instances avec sélection round-robin et aléatoire
  • Instances nommées avec gestion en ligne de commande (CLI)
  • Hiérarchie d'exceptions personnalisée pour une gestion précise des erreurs

Installation

Prérequis

Linux (Debian/Ubuntu) :

root@kitploit:~
sudo apt-get install tor obfs4proxy

Windows :

Téléchargez le Tor Expert Bundle depuis torproject.org.

Paquet Python

root@kitploit:~
pip install xtor
# or
uv add xtor

Démarrage rapide

root@kitploit:~
from xtor import Tor

with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    print(f"Connected through IP: {tor.ip}")
    resp = tor.client.get("https://api.ipify.org")
    print(resp.text)

Utilisation

Démarrer un nouveau processus Tor

root@kitploit:~
from xtor import Tor
from xtor.exceptions import TorNotFoundError, PortInUseError

try:
    with Tor.start(port=9052, control_port=9053, host="127.0.0.1", password="mypass") as tor:
        print(tor.ip)
        resp = tor.client.get("https://api.ipify.org")
        print(resp.text)
except TorNotFoundError:
    print("Tor not found on PATH")
except PortInUseError as e:
    print(f"Port in use: {e}")

Remarque : Tor.startTor() est disponible comme alias de Tor.start() pour la rétrocompatibilité.

Se connecter à une instance existante

root@kitploit:~
with Tor(password="mypass", port=9050, control_port=9051) as tor:
    print(tor.ip)

Nouvelle identité

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    print(tor.ip)
    tor.new_identity(wait=True, timeout=30)
    print(tor.ip)  # New IP

Client asynchrone

root@kitploit:~
import asyncio
from xtor import Tor

async def main():
    with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
        async with tor.async_client as client:
            resp = await client.get("https://api.ipify.org")
            print(resp.text)

asyncio.run(main())

Isolation des flux

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    # Each key gets its own circuit
    client_a = tor.isolated_client("session-a")
    client_b = tor.isolated_client("session-b")
    # Requests through client_a and client_b use different circuits

Gestion des circuits

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    circuits = tor.get_circuits()
    for c in circuits:
        print(f"Circuit {c.id}: {c.status}, path: {c.path}")

    # Close a specific circuit
    tor.close_circuit(circuits[0].id)

Informations sur le nœud de sortie

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    info = tor.exit_node
    if info:
        print(f"Exit: {info.nickname} ({info.country})")
        print(f"Flags: {info.flags}")

Services cachés

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    service = tor.create_hidden_service({80: 8080})
    print(f"Service: {service.onion_address}")

    # Remove when done
    tor.remove_hidden_service(service)

Écouteurs d'événements

root@kitploit:~
with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
    def on_bandwidth(event):
        print(f"Read: {event.read}, Written: {event.written}")

    tor.add_event_listener("BW", on_bandwidth)
    # ... do work ...
    tor.remove_event_listener(on_bandwidth)

TorPool

root@kitploit:~
from xtor import TorPool

with TorPool(size=3, base_port=9100, password="secret") as pool:
    # Round-robin
    tor = pool.next()
    print(tor.client.get("https://api.ipify.org").text)

    # Rotate all identities
    pool.rotate_all()

    # Random selection
    tor = pool.random()

Instances nommées (Python)

root@kitploit:~
from xtor import Tor

# Start named instance
tor = Tor.start(port=9052, control_port=9053, host="127.0.0.1", name="my-tor")

# Later, reconnect by name
tor = Tor.from_name("my-tor")
with tor:
    print(tor.ip)

Référence CLI

La CLI xtor gère les instances Tor nommées en tant que processus d'arrière-plan.

root@kitploit:~
# Start a named instance
xtor start my-tor --port 9052 --control-port 9053

# List instances
xtor list

# Connection details
xtor connect my-tor

# Stop instance
xtor stop my-tor

# Remove instance and data
xtor remove my-tor

Exceptions personnalisées

root@kitploit:~
XtorError (base)
├── TorNotFoundError
├── PortInUseError
├── IdentityChangeTimeout
├── ConnectionError
└── AuthenticationError

Modèle de capture globale :

root@kitploit:~
from xtor.exceptions import XtorError

try:
    with Tor.start(port=9052, control_port=9053, host="127.0.0.1") as tor:
        ...
except XtorError as e:
    print(f"xtor error: {e}")

Licence

GPL-3.0-or-later

Télécharger l’outil