NetExec/nxc/modules/IOXIDResolver.py

45 lines
1.5 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2021-12-18 20:28:34 +00:00
# Credit to https://airbus-cyber-security.com/fr/the-oxid-resolver-part-1-remote-enumeration-of-network-interfaces-without-any-authentication/
2023-05-02 15:17:59 +00:00
# Airbus CERT
2021-12-18 20:28:34 +00:00
# module by @mpgn_x64
from ipaddress import ip_address
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.rpcrt import RPC_C_AUTHN_LEVEL_NONE
from impacket.dcerpc.v5.dcomrt import IObjectExporter
class NXCModule:
2023-05-02 15:17:59 +00:00
name = "ioxidresolver"
description = "This module helps you to identify hosts that have additional active interfaces"
supported_protocols = ["smb", "wmi"]
2021-12-18 20:28:34 +00:00
opsec_safe = True
multiple_hosts = False
def options(self, context, module_options):
2023-05-02 15:17:59 +00:00
""" """
2021-12-18 20:28:34 +00:00
def on_login(self, context, connection):
authLevel = RPC_C_AUTHN_LEVEL_NONE
2023-05-02 15:17:59 +00:00
stringBinding = r"ncacn_ip_tcp:%s" % connection.host
2021-12-18 20:28:34 +00:00
rpctransport = transport.DCERPCTransportFactory(stringBinding)
portmap = rpctransport.get_dce_rpc()
portmap.set_auth_level(authLevel)
portmap.connect()
objExporter = IObjectExporter(portmap)
bindings = objExporter.ServerAlive2()
context.log.debug("[*] Retrieving network interface of " + connection.host)
for binding in bindings:
2023-05-02 15:17:59 +00:00
NetworkAddr = binding["aNetworkAddr"]
2021-12-18 20:28:34 +00:00
try:
ip_address(NetworkAddr[:-1])
context.log.highlight("Address: " + NetworkAddr)
except Exception as e:
context.log.debug(e)