Skip to content

Commit

Permalink
Merge pull request #48 from CyberAuth/main
Browse files Browse the repository at this point in the history
  • Loading branch information
ShutdownRepo authored May 31, 2024
2 parents 15eff88 + 28a71d7 commit 1097707
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions examples/ntlmrelayx.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,42 @@ def do_socks(self, line):
else:
logging.info('No Relays Available!')

def do_admsocks(self, line):
headers = ["Protocol", "Target", "Username", "AdminStatus", "Port"]
url = "http://localhost:9090/ntlmrelayx/api/v1.0/relays"
try:
proxy_handler = ProxyHandler({})
opener = build_opener(proxy_handler)
response = Request(url)
r = opener.open(response)
result = r.read()
items = json.loads(result)

except Exception as e:
logging.error("ERROR: %s" % str(e))
else:
try:
if len(items) > 0:
new_list = [] # New dict to store the "items" JSON array
idx = 0
admonly = 'TRUE' # Search string for Admin
for line in items:
if admonly in line:
new_list.insert(idx, line)
idx += 1
if len(new_list) == 0:
print("\nNo Admin Sessions Available") # Do I really need to explain this?
else:
lineLen = len(new_list)
for i in range(lineLen):
break
self.printTable(new_list, header=headers)
# Exception added to handle max() ValueError on the rowMaxLen in printTable function
except ValueError as e:
print()
else:
logging.info('No Relays Available!')

def do_startservers(self, line):
if not self.serversRunning:
start_servers(options, self.relayThreads)
Expand Down

0 comments on commit 1097707

Please sign in to comment.