Skip to content

Commit 43da818

Browse files
authored
Merge branch 'Pennyw0rth:main' into main
2 parents 8a6fb7c + 398716d commit 43da818

2 files changed

Lines changed: 28 additions & 27 deletions

File tree

nxc/modules/ioxidresolver.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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

56
from ipaddress import ip_address
67
from 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
89
from 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}")

nxc/protocols/rdp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def write(self, msg):
109109
def print_host_info(self):
110110
nla = colored(f"nla:{self.nla}", host_info_colors[3], attrs=["bold"]) if self.nla else colored(f"nla:{self.nla}", host_info_colors[2], attrs=["bold"])
111111
if self.domain is None:
112-
self.logger.display("Probably old, doesn't not support HYBRID or HYBRID_EX ({nla})")
112+
self.logger.display(f"Probably old, doesn't not support HYBRID or HYBRID_EX ({nla})")
113113
else:
114114
self.logger.display(f"{self.server_os} (name:{self.hostname}) (domain:{self.domain}) ({nla})")
115115
return True
@@ -181,7 +181,7 @@ def check_nla(self):
181181
credentials=self.auth,
182182
)
183183
asyncio.run(self.connect_rdp())
184-
if str(proto) == "SUPP_PROTOCOLS.RDP" or str(proto) == "SUPP_PROTOCOLS.SSL" or str(proto) == "SUPP_PROTOCOLS.SSL|SUPP_PROTOCOLS.RDP":
184+
if proto.value == SUPP_PROTOCOLS.RDP or proto.value == SUPP_PROTOCOLS.SSL or proto.value == SUPP_PROTOCOLS.SSL | SUPP_PROTOCOLS.RDP:
185185
self.nla = False
186186
return
187187
except Exception:

0 commit comments

Comments
 (0)