Skip to content

Commit 6a735c1

Browse files
committed
add an option to ioxidresolver to get only interfaces IP for IP different than targets
1 parent 398716d commit 6a735c1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

nxc/modules/ioxidresolver.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class NXCModule:
1717
multiple_hosts = True
1818

1919
def options(self, context, module_options):
20-
"""No module options"""
21-
20+
"""DIFFERENT show only ip address if different from target ip (Default: False)"""
21+
if module_options and "DIFFERENT" in module_options:
22+
self.pivot = module_options.get("DIFFERENT", "false").lower() in ("true", "1")
2223
def on_login(self, context, connection):
2324
try:
2425
rpctransport = transport.DCERPCTransportFactory(f"ncacn_ip_tcp:{connection.host}")
@@ -37,7 +38,11 @@ def on_login(self, context, connection):
3738
NetworkAddr = binding["aNetworkAddr"]
3839
try:
3940
ip_address(NetworkAddr[:-1])
40-
context.log.highlight(f"Address: {NetworkAddr}")
41+
if self.pivot:
42+
if NetworkAddr.rtrip() != connection.host.rtrip():
43+
context.log.highlight(f"Address: {NetworkAddr}")
44+
else:
45+
context.log.highlight(f"Address: {NetworkAddr}")
4146
except Exception as e:
4247
context.log.debug(e)
4348
except DCERPCException as e:

0 commit comments

Comments
 (0)