Skip to content

Commit

Permalink
sflib: remove refreshTorIdent function (smicallef#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoles authored Jul 5, 2021
1 parent 32fc92f commit 174d746
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 34 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ipaddr>=2.2.0
phonenumbers>=8.12.9
pygexf>=0.2.2
PyPDF2>=1.26.0
stem>=1.7.1
python-whois>=0.7.1
secure>=0.2.1,<0.3.0
pyOpenSSL>=17.5.0
Expand Down
2 changes: 0 additions & 2 deletions sf.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def main():
'_socks3port': '',
'_socks4user': '',
'_socks5pwd': '',
'_torctlport': 9051
}

sfOptdescs = {
Expand All @@ -110,7 +109,6 @@ def main():
'_socks3port': 'SOCKS Server TCP Port. Usually 1080 for 4/5, 8080 for HTTP and 9050 for TOR.',
'_socks4user': 'SOCKS Username. Valid only for SOCKS4 and SOCKS5 servers.',
'_socks5pwd': "SOCKS Password. Valid only for SOCKS5 servers.",
'_torctlport': "The port TOR is taking control commands on. This is necessary for SpiderFoot to tell TOR to re-circuit when it suspects anonymity is compromised.",
'_modulesenabled': "Modules enabled for the scan." # This is a hack to get a description for an option not actually available.
}

Expand Down
20 changes: 0 additions & 20 deletions sflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import urllib3
from bs4 import BeautifulSoup, SoupStrainer
from publicsuffixlist import PublicSuffixList
from stem import Signal
from stem.control import Controller

# For hiding the SSL warnings coming from the requests lib
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # noqa: DUO131
Expand Down Expand Up @@ -146,24 +144,6 @@ def socksProxy(self, socksProxy):
"""
self._socksProxy = socksProxy

def refreshTorIdent(self):
"""Tell TOR to re-circuit."""

if self.opts['_socks1type'] != "TOR":
return

try:
self.info("Re-circuiting TOR...")
with Controller.from_port(address=self.opts['_socks2addr'],
port=self.opts['_torctlport']) as controller:
controller.authenticate()
controller.signal(Signal.NEWNYM)
time.sleep(10)
except BaseException as e:
self.fatal(f"Unable to re-circuit TOR: {e}")

return

def optValueToData(self, val):
"""Supplied an option value, return the data based on what the
value is. If val is a URL, you'll get back the fetched content,
Expand Down
1 change: 0 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def default_options(request):
'_socks3port': '',
'_socks4user': '',
'_socks5pwd': '',
'_torctlport': 9051,
'__logstdout': False
}

Expand Down
1 change: 0 additions & 1 deletion test/integration/test_sfwebui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def setup_server():
'_socks3port': '',
'_socks4user': '',
'_socks5pwd': '',
'_torctlport': 9051,
'__logstdout': False
}

Expand Down
9 changes: 0 additions & 9 deletions test/unit/test_spiderfoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ def test_attribute_socksProxy(self):
sf.socksProxy = 'new socket'
self.assertEqual('new socket', sf.socksProxy)

def test_refresh_tor_ident_should_return_none(self):
"""
Test refreshTorIdent(self)
"""
sf = SpiderFoot(self.default_options)

res = sf.refreshTorIdent()
self.assertEqual(None, res)

def test_optValueToData_should_return_data_as_string(self):
"""
Test optValueToData(self, val)
Expand Down

0 comments on commit 174d746

Please sign in to comment.