77import contextlib
88
99
10- def get_dynamic_endpoint (interface : bytes , target : str , timeout : int = 5 ) -> str :
11- string_binding = rf"ncacn_ip_tcp:{ target } [135]"
12- rpctransport = transport .DCERPCTransportFactory (string_binding )
13- rpctransport .set_connect_timeout (timeout )
14- dce = rpctransport .get_dce_rpc ()
15- dce .connect ()
16- return epm .hept_map (target , interface , protocol = "ncacn_ip_tcp" , dce = dce )
17-
18-
1910class NXCModule :
2011 name = "coerce_plus"
2112 description = "Module to check if the Target is vulnerable to any coerce vulns. Set LISTENER IP for coercion."
@@ -28,6 +19,15 @@ def __init__(self, context=None, module_options=None):
2819 self .always_continue = None
2920 self .method = "all"
3021
22+ @staticmethod
23+ def get_dynamic_endpoint (interface : bytes , target : str , timeout : int = 5 ) -> str :
24+ string_binding = rf"ncacn_ip_tcp:{ target } [135]"
25+ rpctransport = transport .DCERPCTransportFactory (string_binding )
26+ rpctransport .set_connect_timeout (timeout )
27+ dce = rpctransport .get_dce_rpc ()
28+ dce .connect ()
29+ return epm .hept_map (target , interface , protocol = "ncacn_ip_tcp" , dce = dce )
30+
3131 def options (self , context , module_options ):
3232 """
3333 LISTENER LISTENER for exploitation (default: 127.0.0.1)
@@ -540,7 +540,7 @@ def connect(self, username, password, domain, lmhash, nthash, aesKey, target, do
540540 # activates EFS
541541 # https://specterops.io/blog/2025/08/19/will-webclient-start/
542542 with contextlib .suppress (Exception ):
543- get_dynamic_endpoint (uuidtup_to_bin (("df1941c5-fe89-4e79-bf10-463657acf44d" , "0.0" )), target , timeout = 1 )
543+ NXCModule . get_dynamic_endpoint (uuidtup_to_bin (("df1941c5-fe89-4e79-bf10-463657acf44d" , "0.0" )), target , timeout = 1 )
544544
545545 rpctransport = transport .DCERPCTransportFactory (binding_params [pipe ]["stringBinding" ])
546546 rpctransport .set_dport (445 )
@@ -777,7 +777,7 @@ def connect(self, username, password, domain, lmhash, nthash, aesKey, target, do
777777 "port" : 445
778778 },
779779 "[dcerpc]" : {
780- "stringBinding" : get_dynamic_endpoint (uuidtup_to_bin (("12345678-1234-abcd-ef00-0123456789ab" , "1.0" )), target ),
780+ "stringBinding" : NXCModule . get_dynamic_endpoint (uuidtup_to_bin (("12345678-1234-abcd-ef00-0123456789ab" , "1.0" )), target ),
781781 "MSRPC_UUID_RPRN" : ("12345678-1234-abcd-ef00-0123456789ab" , "1.0" ),
782782 "port" : None
783783 }
0 commit comments