Improved comment clarity on DNS features
This commit is contained in:
parent
882f374937
commit
cc61784502
1 changed files with 29 additions and 11 deletions
|
|
@ -40,8 +40,21 @@ def is_dns_problem(url: str) -> bool:
|
||||||
|
|
||||||
def dns_works_via_tor(domain, connection_observer, client_observer=None):
|
def dns_works_via_tor(domain, connection_observer, client_observer=None):
|
||||||
"""
|
"""
|
||||||
Check if domain's resolver is blocking Tor by querying via proxychains.
|
Purpose:
|
||||||
Dynamically configures proxychains with the given port.
|
Check if domain's resolver is blocking Tor by querying via proxychains.
|
||||||
|
|
||||||
|
Method:
|
||||||
|
Dynamically configures proxychains with the given port.
|
||||||
|
Uses this to query the DNS via dig.
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
Proxychains being installed.
|
||||||
|
|
||||||
|
Called by:
|
||||||
|
step4_error_classifier's classify_request_error
|
||||||
|
|
||||||
|
Raises Errors?
|
||||||
|
False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
port_number = ConnectionService.get_random_available_port_number()
|
port_number = ConnectionService.get_random_available_port_number()
|
||||||
|
|
@ -87,15 +100,20 @@ socks5 127.0.0.1 {port_number}
|
||||||
|
|
||||||
print("running command...")
|
print("running command...")
|
||||||
# Run dig through proxychains with the dynamic config
|
# Run dig through proxychains with the dynamic config
|
||||||
result = subprocess.run(
|
try:
|
||||||
['proxychains4', '-f', config_path, 'dig', domain, '+short'],
|
result = subprocess.run(
|
||||||
capture_output=True,
|
['proxychains4', '-f', config_path, 'dig', domain, '+short'],
|
||||||
text=True,
|
capture_output=True,
|
||||||
timeout=10
|
text=True,
|
||||||
)
|
timeout=10
|
||||||
print(f"result: {result}")
|
)
|
||||||
|
logger.debug(f"result: {result}")
|
||||||
|
except:
|
||||||
|
logger.error(f"[DNS PROBLEM] Proxychains not installed on this computer")
|
||||||
|
return False
|
||||||
|
|
||||||
output = result.stdout.strip()
|
output = result.stdout.strip()
|
||||||
print(f"output: {output}")
|
logger.debug(f"output of stripping the IP out of the result: {output}")
|
||||||
|
|
||||||
if not output or result.returncode != 0:
|
if not output or result.returncode != 0:
|
||||||
logger.debug(f"[DNS PROBLEM] {domain}: No response")
|
logger.debug(f"[DNS PROBLEM] {domain}: No response")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue