2022-07-18 23:59:14 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-09-17 20:20:40 +00:00
|
|
|
class NXCModule:
|
2023-05-02 15:17:59 +00:00
|
|
|
name = "ioxidresolver"
|
2023-07-14 08:03:37 +00:00
|
|
|
description = "This module helps you to identify hosts that have additional active interfaces"
|
2023-08-30 04:20:21 +00:00
|
|
|
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)
|
|
|
|
|
2023-05-02 15:17:59 +00:00
|
|
|
# NetworkAddr = bindings[0]['aNetworkAddr']
|
2021-12-18 20:28:34 +00:00
|
|
|
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)
|