コード例 #1
0
ファイル: TorCrawler.py プロジェクト: willdoliver/TCC
 def _newCircuit(self):
     """
     Attempt to rotate the IP by sending tor client signal NEWNYM.
     Note: this does NOT automatically change the ip. It simply
     draws a new circuit (i.e. a routing table for your requests/responses).
     If the number of relays is small, this may indeed return the same IP.
     That does not mean it is broken!
     Also note that the default control port is 9051, which is different
     from the SOCKS5 port. This port is used to receive signals.
     """
     if self.ctrl_pass:
         authenticate_password(self.tor_controller, self.ctrl_pass)
     else:
         authenticate_none(self.tor_controller)
     self.tor_controller.signal(Signal.NEWNYM)
コード例 #2
0
    def _newCircuit(self):
        """
        Attempt to rotate the IP by sending tor client signal NEWNYM.

        Note: this does NOT automatically change the ip. It simply
        draws a new circuit (i.e. a routing table for your requests/responses).
        If the number of relays is small, this may indeed return the same IP.
        That does not mean it is broken!

        Also note that the default control port is 9051, which is different
        from the SOCKS5 port. This port is used to receive signals.
        """
        if self.ctrl_pass:
            authenticate_password(self.tor_controller, self.ctrl_pass)
        else:
            authenticate_none(self.tor_controller)
        self.tor_controller.signal(Signal.NEWNYM)