Skip to content

Commit

Permalink
Merge branch 'repo1-changes'
Browse files Browse the repository at this point in the history
Merging PR from @Z3rO-C00L:
Filter Socks Connection via AdminStatus
Quality of Life improvement for when you have a ton of socks connections. Filtering by "AdminStatus is True" shows the most immediately useful socks connections - especially if you have a ton of connections already with only one of them having admin to a host.
  • Loading branch information
CyberAuth committed May 31, 2024
2 parents 15eff88 + 37e38d6 commit 28a71d7
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 28a71d7

Please sign in to comment.