Skip to content

torspy is a Python package for scraping .onion sites via the Tor network. It retrieves HTML content, searches for text, and saves results. It also detects hidden directories, subdomains, analyzes content, extracts links, retrieves service info, and downloads site content. It's a valuable tool for navigating and extracting information from the dark.

License

Notifications You must be signed in to change notification settings

mr-fidal/torspy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

torspy

torspy is a robust Python package fortified with powerful algorithms, designed for seamless exploration of websites, including both normal and .onion sites via the Tor network. Its arsenal includes adept scraping of HTML from URLs, precise text localization within the acquired content, and proficient storage of findings. Moreover, torspy boasts formidable subdomain scanning capabilities, enabling thorough reconnaissance across diverse subdomains. Additionally, it excels at detecting hidden directories, further enhancing its efficacy in navigating and extracting valuable information from the web. torspy also features advanced content analysis, comprehensive link extraction, detailed service information retrieval, and efficient content downloading, making it an indispensable tool for web exploration and analysis.

Index

Advantages

  • torspy is easy to use

  • Many hidden directories can be found using torspy

  • Each request torspy makes for your purpose will be anonymous

  • torspy can be used to extract required text or content from the website

  • HTML files can be downloaded using torspy

  • With torspy you can search for the files you need

  • torspy is the leading package for dark web scraping.

  • Finding links from onion sites

  • Finding services from onion sites

  • Download files from onion sites

  • Analyzing onion sites

- torspy is the leading package for dark web scraping.

Disadvantages

  • Since requests are made using the Tor network, this tool will run slowly

  • The probability of finding hidden directories, subdomains and files is less than 20%

  • Sometimes you have to wait some time for this tool to work

  • Some processes may take time to complete

When using torspy tool you must use Tor otherwise it won't work : $ tor

Coding

Installation

You can install torspy via pip:

pip install torspy

Usage

Command-Line Interface

torspy allows you to interact with .onion sites from the command line:

Command 01

  • To display the content of a .onion site:
torspy http://example.onion
  • When the above command is run, a request goes through the Tor network to that onion site, and then the HTML page of the onion site is displayed on your terminal.

command 02

  • To save the displayed content to a file:
torspy http://example.onion -s file.html
  • The -s flag indicates saving, and you can specify any file name.

  • The above command transfers the entire HTML code that were printed on your terminal to another file

  • Also you can change the name of file.html to any name of your choice

command 03

  • How to move this file to a directory of your choice
torspy http://example.onion -s file.html -d /path/home/
  • -d stands for directory

  • Given after -d is your path and if you run the above command your file will move to the given path

command 04

  • Search only the content you need from Onion sites
torspy http://example.onion --find “search query”
  • If you enter the above command it will search only the content you need from the given onion site and print it.

  • The command --find means to search

command 05

    • To search for specific text within the content and save the results to a file
torspy http://example.onion --find “search query” -s search_results.html
  • If you enter the above command it will search for the content you need from the site you provided and then transfer all that content to another file.

command 06

  • How to search for content and move it to another directory
torspy http://example.onion --find “important information” -s results.html -d /path/to/directory
  • If you run the above command it will search for the content you need from the given onion site and then move it to a file and then move it to the directory you specified.

Message

  • important Remember that when trying to find subdomains, as well as trying to find directories, the success rate is only 20%.
  • Finding directories and subdomains for onion sites is more challenging than for regular websites because onion sites are part of the dark web, which is intentionally designed to be less accessible and more private.

command 07

  • Command that finds the directories on the onion site
torspy http://example.onion --dir directories-list.txt
  • This process may take some time

  • If you run the command above it will search for directories from the onion sites you provided

  • The command --dir stands for directories

  • This command performs directories scanning on the .onion site using the list of directories provided in the directories-list.txt file.

command 08

  • How to move all the lists of directories you got into another file
torspy http://example.onion --dir directories-list.txt -s output.txt
  • If you run the above command all the directory lists you get will be moved to another file

  • Also you can move this file to other directory or other path using -d command

command 09

  • Command that finds subdomains in onion site
torspy http://example.onion --sub subdomain-list.txt
  • This process may take some time

  • If you run the command above it will search for subdomains from the onion sites you provided

  • The command --sub stands for subdomains

  • This command performs subdomains scanning on the .onion site using the list of subdomains provided in the subdomains-list.txt file.

command 10

  • How to move all the lists of subdomains you got into another file
torspy http://example.onion --sub subdomain-list.txt -s output.txt
  • If you run the above command all the subdomains lists you get will be moved to

  • another file

  • Also you can move this file to other directory or other path using -d command

command 11

  • Command that analyzes content of an onion site
torspy http://example.onion --analyze
  • If you run the command above it will analyze the content of the onion site you provided.
  • The command –-analyze performs content analysis on the .onion site.

command 12

  • How to transfer the analyzed data to a file
torspy http://example.onion --analyze -s file-name.html
  • You can name the file whatever you want { chnage file-name.html }

command 13

  • Command that downloads content from an onion site
torspy http://example.onion --download -s filename
  • If you run the command above it will download the content of the onion site you provided and save it to the specified file.
  • The command –-download performs content downloading.
  • example : torspy http://example.onion –-download -s index.html , torspy http://example.onion –-download -s data.jpg
  • The command -s specifies the file name to save the downloaded content.

command 14

  • Command that finds links on an onion site
torspy http://example.onion --links
  • If you run the command above it will find all links on the onion site you provided.
  • The command –-links performs link extraction.

command 15

  • Command to convert all links into one file
torspy http://example.onion --links -s file-link.txt
  • After running the above command all the links will be changed to the file you have given

command 16

  • Command that gets service info of an onion site
torspy http://example.onion --service
  • If you run the command above it will retrieve service info of the onion site you provided.
  • The command –-service performs service information retrieval.
  • You can use -s to save

command 17

  • For more information on available options, you can use the --help flag:
torspy --help

Using torspy in a Bash Script

  • You can incorporate torspy into your Bash scripts for automated tasks. Here's an example script that fetches content from a list of .onion URLs and saves it to individual files:
#!/bin/bash

# List of .onion URLs
urls=("http://example1.onion" "http://example2.onion" "http://example3.onion")

# Loop through each URL
for url in "${urls[@]}"; do
    # Fetch content and save to a file
    torspy "$url" -s "${url##*/}.html"
done

Integrating torspy with Other Languages

Ruby

  • You can call the torspy command-line tool from Ruby using the system method:
system("torspy http://example.onion -s output.html")

Python

  • You can use the subprocess module to call torspy from a Python script:
import subprocess

subprocess.run(["torspy", "http://example.onion", "-s", "output.html"])

PHP

  • You can use the shell_exec function to call torspy from PHP:
<?php
shell_exec("torspy http://example.onion -s output.html");
?>

Node.js

  • You can use the child_process module to call torspy from Node.js:
const { exec } = require('child_process');

exec('torspy http://example.onion -s output.html', (error, stdout, stderr) => {
    if (error) {
        console.error(`Error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.error(`Stderr: ${stderr}`);
        return;
    }
    console.log(`Output: ${stdout}`);
});

How torspy Works

torspy utilizes the following process to interact with .onion sites:

  • Checking Site Existence: It verifies if the .onion site exists and is reachable through the Tor network.
  • Fetching HTML Content: It retrieves the HTML content of the .onion site using Tor for anonymity.
  • Scraping and Searching: If specified, torspy searches for specific text within the content and extracts matching results.
  • Saving Results: Optionally, torspy allows you to save the retrieved content, either the entire HTML or the search results, to a file.
  • Contributing to torspy

    If you're interested in contributing to torspy, you can:

    • Report issues encountered while using torspy.
    • Suggest new features or enhancements.
    • Submit pull requests with improvements or fixes.

    Thank You, TorSpy Users!

    We at TorSpy are incredibly grateful for your support and trust in our cybersecurity tool. Your feedback and engagement drive us to continually improve and enhance our service. Together, we're making the digital world a safer place. Thank you for being a part of the TorSpy community!

    Disclaimer

    This tool is intended for ethical use only. The author is not responsible for any misuse or damage caused by this tool. Users are responsible for ensuring their activities comply with all relevant laws and regulations.
    

    About

    torspy is a Python package for scraping .onion sites via the Tor network. It retrieves HTML content, searches for text, and saves results. It also detects hidden directories, subdomains, analyzes content, extracts links, retrieves service info, and downloads site content. It's a valuable tool for navigating and extracting information from the dark.

    Topics

    Resources

    License

    Code of conduct

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages