11# Credit to https://airbus-cyber-security.com/fr/the-oxid-resolver-part-1-remote-enumeration-of-network-interfaces-without-any-authentication/
22# Airbus CERT
33# module by @mpgn_x64
4+ # updated by @NeffIsBack
45
56from ipaddress import ip_address
67from impacket .dcerpc .v5 import transport
7- from impacket .dcerpc .v5 .rpcrt import RPC_C_AUTHN_LEVEL_NONE
8+ from impacket .dcerpc .v5 .rpcrt import RPC_C_AUTHN_LEVEL_NONE , DCERPCException
89from impacket .dcerpc .v5 .dcomrt import IObjectExporter
910
1011
@@ -13,31 +14,31 @@ class NXCModule:
1314 description = "This module helps you to identify hosts that have additional active interfaces"
1415 supported_protocols = ["smb" , "wmi" ]
1516 opsec_safe = True
16- multiple_hosts = False
17+ multiple_hosts = True
1718
1819 def options (self , context , module_options ):
19- """ """
20+ """No module options """
2021
2122 def on_login (self , context , connection ):
22- authLevel = RPC_C_AUTHN_LEVEL_NONE
23-
24- stringBinding = r"ncacn_ip_tcp:%s" % connection .host
25- rpctransport = transport . DCERPCTransportFactory ( stringBinding )
26- rpctransport .setRemoteHost ( connection . host )
27-
28- portmap = rpctransport . get_dce_rpc ()
29- portmap . set_auth_level ( authLevel )
30- portmap . connect ( )
31-
32- objExporter = IObjectExporter ( portmap )
33- bindings = objExporter . ServerAlive2 ( )
34-
35- context . log . debug ( "[*] Retrieving network interface of " + connection . host )
36-
37- for binding in bindings :
38- NetworkAddr = binding [ "aNetworkAddr" ]
39- try :
40- ip_address ( NetworkAddr [: - 1 ])
41- context .log .highlight ( "Address: " + NetworkAddr )
42- except Exception as e :
43- context .log .debug ( e )
23+ try :
24+ rpctransport = transport . DCERPCTransportFactory ( f"ncacn_ip_tcp: { connection . host } " )
25+ rpctransport . setRemoteHost ( connection .host )
26+
27+ portmap = rpctransport .get_dce_rpc ( )
28+ portmap . set_auth_level ( RPC_C_AUTHN_LEVEL_NONE )
29+ portmap . connect ()
30+
31+ objExporter = IObjectExporter ( portmap )
32+ bindings = objExporter . ServerAlive2 ()
33+
34+ context . log . debug ( f"Retrieving network interface of { connection . host } " )
35+
36+ for binding in bindings :
37+ NetworkAddr = binding [ "aNetworkAddr" ]
38+ try :
39+ ip_address ( NetworkAddr [: - 1 ])
40+ context . log . highlight ( f"Address: { NetworkAddr } " )
41+ except Exception as e :
42+ context .log .debug ( e )
43+ except DCERPCException as e :
44+ context .log .error ( f"DCERPCException error: { e } " )
0 commit comments