selenium tor

#!/usr/bin/env python
# coding: utf-8

# In[6]:



from selenium import webdriver

import pandas as pd

import time

import subprocess


# In[15]:




chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument( "--proxy-server=socks5://127.0.0.1:9050" )

driver = webdriver.Chrome('/home/dslinux/code-tools/chromedriver', chrome_options=chrome_options )

driver.get("https://check.torproject.org/")
driver.page_source

p = subprocess.Popen(['sudo','service','tor','reload'], stdin=subprocess.PIPE)
p.stdin.write( ('dslinux'+'\n').encode() )
p.stdin.flush()


# In[ ]:





# In[ ]:





留言

此網誌的熱門文章

Making a Windows 11 hotspot without an internet connection