Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:29:50+00:00 2026-06-01T00:29:50+00:00

I have the following script: import socks import socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, 127.0.0.1, 9050) socket.socket =

  • 0

I have the following script:

import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
import urllib2

print(urllib2.urlopen("http://www.ifconfig.me/ip").read())

which uses tor and SocksiPy

Now I want to change tor identity with each request, for example:

for i in range(0, 10):
   #somehow change tor identity
   print(urllib2.urlopen("http://www.ifconfig.me/ip").read())

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:29:52+00:00Added an answer on June 1, 2026 at 12:29 am

    Today, I have searched a lot about this question, and finally managed to answer myself. But before I need to say that pirvoxy and tor should be configured correctly. First script, then a little bit about configuration:

    import urllib2
    from TorCtl import TorCtl
    
    proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"})
    opener = urllib2.build_opener(proxy_support) 
    
    def newId():
        conn = TorCtl.connect(controlAddr="127.0.0.1", controlPort=9051, passphrase="your_password")
        conn.send_signal("NEWNYM")
    
    for i in range(0, 10):
        print "case "+str(i+1)
        newId()
        proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"})
        urllib2.install_opener(opener)
        print(urllib2.urlopen("http://www.ifconfig.me/ip").read())
    

    Above script gets new IP and checks it from ifconfig.me web site. About configuration:
    We need Privoxy. to use TOR with HTTP connections, privoxy should work with tor. We can do it by adding thi to /etc/privoxy/config file:

    forward-socks5 / localhost:9050 . #dot is important at the end
    

    then we configure ControlPort in /etc/tor/torrc file. We need just uncomment this line:

    ControlPort 9051
    ## If you enable the controlport, be sure to enable one of these
    ## authentication methods, to prevent attackers from accessing it.
    HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C
    

    then we just restart tor:

    /etc/init.d/tor restart
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited the following Python script: import urllib2 a = urllib2.urlopen('http://mysite/mypage.aspx?action=dosomething') a.read() a.close()
I have the following simple Python script: import socket import ssl if __name__ ==
I have the following python script and it works beautifully. import urllib2 url =
i have the following script import getopt, sys opts, args = getopt.getopt(sys.argv[1:], h:s) for
I have made the following script to upload a csv and import it into
I have following script: #!/usr/bin/python while True: x = raw_input() print x[::-1] I am
I have the following PyObjC script: from Foundation import NSObject import QTKit error =
I have the following simple page; <%@ Import namespace=System.IO %> <script runat=server> int pageSize
I have written following script in python which works fine: from sys import argv
I have the following script defining a tzinfo object: import time from datetime import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.