2121
2222
2323def is_target_a_windows_machine (target ) -> bool :
24+ """
25+ Check if the target is a Windows machine.
26+
27+ Args:
28+ target: The target to check.
29+
30+ Returns:
31+ True if the target is a Windows machine, False otherwise.
32+ """
2433 # if port 135 and 445 open
2534 if is_port_open (target , 135 ) and is_port_open (target , 445 ):
2635 return True
@@ -29,6 +38,15 @@ def is_target_a_windows_machine(target) -> bool:
2938
3039
3140def is_target_a_windows_domain_controller (target ) -> bool :
41+ """
42+ Check if the target is a Windows domain controller.
43+
44+ Args:
45+ target: The target to check.
46+
47+ Returns:
48+ True if the target is a Windows domain controller, False otherwise.
49+ """
3250 # if port 135 and 445 and 88 open
3351 if is_target_a_windows_machine (target ) and is_port_open (target , 88 ):
3452 return True
@@ -37,6 +55,19 @@ def is_target_a_windows_domain_controller(target) -> bool:
3755
3856
3957def is_port_open (target , port ) -> bool :
58+ """
59+ Check if the port is open on the target.
60+
61+ Args:
62+ target: The target to check.
63+ port: The port to check.
64+
65+ Returns:
66+ True if the port is open on the target, False otherwise.
67+
68+ Raises:
69+ Exception: If an error occurs while checking if the port is open on the target.
70+ """
4071 with socket .socket (socket .AF_INET , socket .SOCK_STREAM ) as s :
4172 s .settimeout (0.1 )
4273 # Non-existant domains cause a lot of errors, added error handling
@@ -47,6 +78,21 @@ def is_port_open(target, port) -> bool:
4778
4879
4980def is_http_accessible (target , port , config , scheme = "http" ):
81+ """
82+ Check if the target is accessible via HTTP.
83+
84+ Args:
85+ target: The target to check.
86+ port: The port to check.
87+ config: The config object.
88+ scheme: The scheme to use.
89+
90+ Returns:
91+ True if the target is accessible via HTTP, False otherwise.
92+
93+ Raises:
94+ Exception: If an error occurs while checking if the target is accessible via HTTP.
95+ """
5096 url = "%s://%s:%d/" % (scheme , target , port )
5197 try :
5298 r = requests .get (
@@ -56,7 +102,7 @@ def is_http_accessible(target, port, config, scheme="http"):
56102 headers = config .request_http_headers ,
57103 verify = (not (config .request_no_check_certificate )),
58104 )
59- return r . status_code == 200
105+ return True
60106 except Exception as e :
61107 config .debug (
62108 "Error in is_http_accessible('%s', %d, '%s'): %s "
0 commit comments