Fixed bug caused by '\0' in username that broke formatting.
This commit is contained in:
@@ -36,7 +36,7 @@ proc getUsername(): string =
|
||||
# If not domain-joined, only return USERNAME
|
||||
discard GetUsernameW(&buffer, &dwSize)
|
||||
|
||||
return $buffer[0 ..< int(dwSize)]
|
||||
return $buffer[0 ..< int(dwSize) - 1]
|
||||
|
||||
# Current process name
|
||||
proc getProcessExe(): string =
|
||||
|
||||
@@ -150,7 +150,7 @@ proc print(item: ConsoleItem) =
|
||||
igTextUnformatted(item.text.cstring, nil)
|
||||
|
||||
proc draw*(component: ConsoleComponent, ws: WebSocket) =
|
||||
igBegin(fmt"[{component.agent.agentId}] {component.agent.username}@{component.agent.hostname}", addr component.showConsole, 0)
|
||||
igBegin(fmt"[{component.agent.agentId}] {component.agent.username}@{component.agent.hostname}".cstring, addr component.showConsole, 0)
|
||||
defer: igEnd()
|
||||
|
||||
let io = igGetIO()
|
||||
@@ -182,7 +182,7 @@ proc draw*(component: ConsoleComponent, ws: WebSocket) =
|
||||
Session information
|
||||
]#
|
||||
let domain = if component.agent.domain.isEmptyOrWhitespace(): "" else: fmt".{component.agent.domain}"
|
||||
let sessionInfo = fmt"{component.agent.username}@{component.agent.hostname}{domain} | {component.agent.ip} | {$component.agent.pid}/{component.agent.process}"
|
||||
let sessionInfo = fmt"{component.agent.username}@{component.agent.hostname}{domain} | {component.agent.ip} | {$component.agent.pid}/{component.agent.process}".cstring
|
||||
igTextColored(GRAY, sessionInfo)
|
||||
igSameLine(0.0f, 0.0f)
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ proc interact(component: SessionsTableComponent) =
|
||||
while ImGuiSelectionBasicStorage_GetNextSelectedItem(component.selection, addr it, addr row):
|
||||
let agent = component.agents[cast[int](row)]
|
||||
|
||||
|
||||
# Create a new console window
|
||||
if not component.consoles[].hasKey(agent.agentId):
|
||||
component.consoles[][agent.agentId] = Console(agent)
|
||||
@@ -35,9 +34,6 @@ proc interact(component: SessionsTableComponent) =
|
||||
else:
|
||||
igSetWindowFocus_Str(fmt"[{agent.agentId}] {agent.username}@{agent.hostname}")
|
||||
|
||||
# TODO: Clear selection properly
|
||||
ImGuiSelectionBasicStorage_Clear(component.selection)
|
||||
|
||||
proc draw*(component: SessionsTableComponent, showComponent: ptr bool) =
|
||||
igBegin(component.title, showComponent, 0)
|
||||
defer: igEnd()
|
||||
|
||||
Reference in New Issue
Block a user