python - Tor 活动链接状态检查器
问题描述
下面是它给出错误的代码,我不知道为什么,我们还需要将此代码转换为 vb.net
#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 rerun the program!!!")
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
解决方案
推荐阅读
- javascript - Sanity CMS,在文档中引用数组
- git - 如何跨功能分支保持正确的合并顺序?
- java - Java代码只输出main方法,跳过静态方法
- javascript - 如何下载 url 中没有扩展名的文件?或绕过下载提示?
- perl - 我应该如何处理 Activestate 从他们的 Perl 中删除 PPM?
- python - 为什么 sorted 不能正确排序数组?
- node.js - 如何使用 Express 在 NodeJS 的 errorHandler 中间件中返回 JSON 响应?
- html - 在响应式网站的最底部创建粘性导航栏时遇到问题
- c# - 使用 .Net 将 Pascal Case 字符串转换为 Dash Case
- polymorphism - 在 sml 中获取 ''a 类型而不是 'a