Open RiyanPiro opened 4 months ago
Yeah, i'll try to. You mentioned that you had tried to do this yourself so could you please send me the code? So I have some base to work with. In discord or telegram.
So this is an example code on how to send requests through tor and also renew the connection so that you get a different ip everytime, it calls the main() function which sends requests to the url and fetches the ip: My discord - @ttgboi
import requests, time
from stem import Signal
from stem.control import Controller
TOR_CONTROL_PORT = 9051
TOR_SOCKS_PORT = 9050
url = "https://api64.ipify.org?format=json"
def renew_tor_ip():
with Controller.from_port(address="127.0.0.1", port=TOR_CONTROL_PORT) as controller:
controller.authenticate(password="torpassword")
controller.signal(Signal.NEWNYM)
def send_tor_request(url):
session = requests.Session()
session.proxies = {
"http": f"socks5h://127.0.0.1:{TOR_SOCKS_PORT}",
"https": f"socks5h://127.0.0.1:{TOR_SOCKS_PORT}",
}
try:
response = session.get(url)
return response
except requests.exceptions.RequestException as e:
print("Error: ", e)
return None
def main():
renew_tor_ip()
response = send_tor_request(url)
if response:
print("Response status code:", response.status_code)
print("Response content:")
print(response.text)
else:
print("Request failed.")
if __name__ == "__main__":
while True:
main()
Okay, thank you!
Could you implement an option so that it sends requests through tor and renews the connection after a few login attempts so that it doesn't require proxies and not run on our ip address? (I tried to but couldn't get it to work) I suppose it wouldn't work on higher threads but could you still look into it though.