PythonがTorを使っているかどうかを確認
Torを使っているか否かをブラウザで確認することができるサイトを利用し、PythonでTorを使っているかどうかを確認するスクリプトを作成。
import urllib.request, urllib.error
from bs4 import BeautifulSoup
url = "https://check.torproject.org/"
res = urllib.request.urlopen(url)
html = BeautifulSoup(res, 'html.parser')
is_tor = html.find('h1')['class'][0] != 'off'
print('You are using tor.' if is_tor else 'You are not using tor.')






ディスカッション
コメント一覧
まだ、コメントがありません