stratosphereips / whois-similarity-distance

This python scripts can calculate the WHOIS Similarity Distance between two given domains.
MIT License
30 stars 7 forks source link

Python 3.7 Compitability #13

Open MAkcanca opened 6 years ago

MAkcanca commented 6 years ago

Whenever I try using it on Python 3.7, it gives me an error such as:

PW rejects example.com, ERROR TRACE No root WHOIS server found for domain.

This looks like it's related to PythonWhois library but when I fire up the console and use get_whois function by hand, it works flawlessly on the same environment.

As a sidenote, I use the latest versions of the required libraries. Is this a hole we should dig?

What could be the problem in here?

sebix commented 5 years ago

I am not totally sure if it is the same bug, but I observe this error on Python 3.7

[  181s] ======================================================================
[  181s] ERROR: whois_similarity_distance (unittest.loader._FailedTest)
[  181s] ----------------------------------------------------------------------
[  181s] ImportError: Failed to import test module: whois_similarity_distance
[  181s] Traceback (most recent call last):
[  181s]   File "/usr/lib64/python3.7/sre_parse.py", line 1021, in parse_template
[  181s]     this = chr(ESCAPES[this][1])
[  181s] KeyError: '\\s'
[  181s] 
[  181s] During handling of the above exception, another exception occurred:
[  181s] 
[  181s] Traceback (most recent call last):
[  181s]   File "/usr/lib64/python3.7/unittest/loader.py", line 468, in _find_test_path
[  181s]     package = self._get_module_from_name(name)
[  181s]   File "/usr/lib64/python3.7/unittest/loader.py", line 375, in _get_module_from_name
[  181s]     __import__(name)
[  181s]   File "/home/abuild/rpmbuild/BUILD/whois_similarity_distance-1.0.2/whois_similarity_distance/__init__.py", line 1, in <module>
[  181s]     from .wsd_domains import *
[  181s]   File "/home/abuild/rpmbuild/BUILD/whois_similarity_distance-1.0.2/whois_similarity_distance/wsd_domains.py", line 10, in <module>
[  181s]     from whois_similarity_distance.util.whois_obj import WhoisObj
[  181s]   File "/home/abuild/rpmbuild/BUILD/whois_similarity_distance-1.0.2/whois_similarity_distance/util/whois_obj.py", line 9, in <module>
[  181s]     import pythonwhois
[  181s]   File "/usr/lib/python3.7/site-packages/pythonwhois/__init__.py", line 1, in <module>
[  181s]     from . import net, parse
[  181s]   File "/usr/lib/python3.7/site-packages/pythonwhois/parse.py", line 363, in <module>
[  181s]     registrant_regexes = [preprocess_regex(regex) for regex in registrant_regexes]
[  181s]   File "/usr/lib/python3.7/site-packages/pythonwhois/parse.py", line 363, in <listcomp>
[  181s]     registrant_regexes = [preprocess_regex(regex) for regex in registrant_regexes]
[  181s]   File "/usr/lib/python3.7/site-packages/pythonwhois/parse.py", line 205, in preprocess_regex
[  181s]     regex = re.sub(r"\\s\*\(\?P<([^>]+)>\.\+\)", r"\s*(?P<\1>\S.*)", regex)
[  181s]   File "/usr/lib64/python3.7/re.py", line 192, in sub
[  181s]     return _compile(pattern, flags).sub(repl, string, count)
[  181s]   File "/usr/lib64/python3.7/re.py", line 309, in _subx
[  181s]     template = _compile_repl(template, pattern)
[  181s]   File "/usr/lib64/python3.7/re.py", line 300, in _compile_repl
[  181s]     return sre_parse.parse_template(repl, pattern)
[  181s]   File "/usr/lib64/python3.7/sre_parse.py", line 1024, in parse_template
[  181s]     raise s.error('bad escape %s' % this, len(this))
[  181s] re.error: bad escape \s at position 0

It is an incompatibility of pythonwhois with 3.7. However this project seems to be dead unfortunately. Upstream issue: https://github.com/joepie91/python-whois/issues/142