Skip to main content

Package for making tor requests

Project description

Tor Requests

pip install torrequests-Matikjacc

Installation

1. Firstly find your torrc file. You can find torrc in

Tor Browser\Browser\TorBrowser\Data\Tor

2. Torrc configuration

You need to hash your password using

tor --hash-password "Your_password"

If it says you don't have tor on Windows download using chocolatey

choco install tor 

Then add this to

ControlPort 9051
HashedControlPassword 16:yourpassword
CookieAuthentication 1

3. Then go to Powershell and execute this command

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

4. Go to Powershell and execute this command:

PS C:\Windows\System32\WindowsPowerShell\v1.0> $profile.AllUsersAllHosts
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1

5. If the file profile.ps1 was not created previously create it and add following code in it:

Create a directory MyPowershellScripts or something like that

. C:\MyPowershellScripts\Start-Tor.ps1

6. In directory that you created for shell scripts create file Start-Tor.ps1 and give it a content like this

function Start-Tor {

    # Configuration
    $torBrowser     = "D:\Tor Browser"       # Put address of root folder of Tor Browser here
    $TOR_Password   = ";Zq!v6oK[?03K!-Gp>4t"     # Input Tor network password here
    $TOR_HOST       = "127.0.0.1"            # Host of local Tor network
    $TOR_PORT       = 9150                   # The port number where Tor runs
    $CTRL_PORT      = 9151                   # The controller port number of Tor

    # Do not modify these
    $tor_location   = "$torBrowser\Browser\TorBrowser\Tor"
    $torrc_defaults = "$torBrowser\Browser\TorBrowser\Data\Tor\torrc-defaults"
    $torrc          = "$torBrowser\Browser\TorBrowser\Data\Tor\torrc"
    $tordata        = "$torBrowser\Browser\TorBrowser\Data\Tor"
    $geoIP          = "$torBrowser\Browser\TorBrowser\Data\Tor\geoip"
    $geoIPv6        = "$torBrowser\Browser\TorBrowser\Data\Tor\geoip6"
    $torExe         = "$tor_location\tor.exe"
    $controllerProcess = $PID
    function Get-OneToLastItem { param ($arr) return $arr[$arr.Length - 2]}

    Write-Host "Generating hash for your Tor password..."
    $TOR_HashPass_RAW  = & "$torExe" --hash-password $TOR_Password | more
    $Tor_HashPass      = Get-OneToLastItem($TOR_HashPass_RAW)

    $TOR_VERSION_RAW   = & "$torExe" --version | more
    $Tor_Version       = Get-OneToLastItem($TOR_VERSION_RAW)

    Write-Host "Running $Tor_Version" -ForegroundColor DarkGray
    Write-Host "Press [Ctrl+C] to stop Tor service."
    & "$torExe" --defaults-torrc $torrc_defaults -f $torrc DataDirectory $tordata GeoIPFile $geoIP GeoIPv6File $geoIPv6 HashedControlPassword $Tor_HashPass +__ControlPort $CTRL_PORT +__SocksPort "${TOR_HOST}:$TOR_PORT IPv6Traffic PreferIPv6 KeepAliveIsolateSOCKSAuth" __OwningControllerProcess $controllerProcess | more
    
}

7. To verify open new powershell and type

Start-Tor

You should see the following:

Generating hash for your Tor password...
Running Tor compiled with clang version 16.0.4
Press [Ctrl+C] to stop Tor service.

Example usage

First Start the tor in powershell

from torrequests_Matikjacc import TorManager
tor_manager = TorManager(tor_password='your_password')
tor_manager.make_tor_request(url='https://api.ipify.org?format=json')
tor_manager.renew_tor_ip()
tor_manager.make_tor_request(url='https://api.ipify.org?format=json')
Tor request successful: 200 - {"ip":"1.1.1.1"}
New Tor IP requested
Tor request successful: 200 - {"ip":"1.1.1.2"}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torrequests_matikjacc-0.0.3.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

torrequests_Matikjacc-0.0.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file torrequests_matikjacc-0.0.3.tar.gz.

File metadata

  • Download URL: torrequests_matikjacc-0.0.3.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for torrequests_matikjacc-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b03752d1959331861360eebe0687cd93b216457d898be321f75908637348a9e3
MD5 20c347e1245bcf13a0ec7651bcf574cd
BLAKE2b-256 5e6666493568ce8f609ec7ae3de6169fb8f72b3486fdaa2cf3764e64c40cb69d

See more details on using hashes here.

File details

Details for the file torrequests_Matikjacc-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for torrequests_Matikjacc-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5c2538a8850109db5104d6a6fa2db9c5898bc0150af1ca4c9b47bd3070bde9f5
MD5 9862d760945e7962784a1d7c0b49a3d3
BLAKE2b-256 ce3c16e7e4bfd2c1aebf40bd8b1a14ec32990d6435c285db5d312c77c1263b36

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page