Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Are there any good VB.net applications to check if a URL is active using TOR?

If there is none, I have the following code using python - can it be translated into vb.net?

What I have tried:

Python
#Tor Onion links Active Status checking
import os
import requests
import json
import time
import subprocess

class TorActivation:
    def __ini__(self):
        pass

    def StartTor(self):
        subprocess.Popen([f"{os.getcwd()}\\Tor\\tor.exe"])
        time.sleep(10)
        print("Tor Proxy has been started!!")
        print("Starting Process of Checking")

    def proxy_build(self):
        try:
            self.proxies = {
            'http': 'socks5h://127.0.0.1:9050',
            'https': 'socks5h://127.0.0.1:9050'
            }
            print("proxy setup is succefully done")
    
        except:
            print("Tor is not activated please run the program again!!!")
    

    def check(self,onion,save):
        print()
        try:
            data = requests.get(f"http://{onion}",proxies=self.proxies)
            status=data.status_code
        except:
            status=404
        if status==200:
            print(f"{onion} : Active")
            print(f"Status Code : {status}")
        else:
            print(f"{onion} : nonActive")
            print(f"Status Code : {status}")

        if save==True:
            w=open("Status.txt","a")
            if status==200:
                w.write(f"http://{onion} : Active")
            else:
                w.write(f"http://{onion} : nonActive")
            w.close()
        print()
        return 
if __name__ == "__main__":
    
    run=TorActivation()
    run.StartTor()
    run.proxy_build()
    while True:
        print("1. Single Url Checking")
        print("2. Multiplt Url Checking")
        print("3. Quit")
        option=input("Enter your option: ")
        if str(option)=='1':
            onion=input("Enter the url: ")
            run.check(onion,False)
        elif str(option)=='2':
            filename=input("Enter the txt filename: ")
            f=open(filename, "a")
            f.readlines()
            for x in f:
                x=x.rstrip("\n")
                run.check(x,True)
            f.close()
        elif option=='3':
            break
Posted
Updated 26-Jan-21 8:12am

1 solution

It is possible that it can be translated. But you need a good understanding of both languages in order to do it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900