Small refactors
This commit is contained in:
@@ -1,188 +0,0 @@
|
||||
[Window][Sessions [Table View]]
|
||||
Pos=10,43
|
||||
Size=1188,394
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Listeners]
|
||||
Pos=10,439
|
||||
Size=1888,550
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][Eventlog]
|
||||
Pos=1200,43
|
||||
Size=698,394
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Collapsed=0
|
||||
DockId=0x00000004
|
||||
|
||||
[Window][Dockspace]
|
||||
Pos=0,0
|
||||
Size=1908,999
|
||||
Collapsed=0
|
||||
|
||||
[Window][[7E248CBA] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][[7BE69219] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,2
|
||||
|
||||
[Window][[CD44669B] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[F300DB27] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,3
|
||||
|
||||
[Window][[AB3464CE] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002
|
||||
|
||||
[Window][[3FC9903D] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,3
|
||||
|
||||
[Window][[6CD04F2C] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[4E93619C] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,8
|
||||
|
||||
[Window][[0C56BE7D] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,7
|
||||
|
||||
[Window][[37C08F6C] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,4
|
||||
|
||||
[Window][[BCC8B616] jakob@AURA]
|
||||
Pos=10,315
|
||||
Size=1004,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][[9592878D] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[8F8DC95F] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][[E05185F6] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,2
|
||||
|
||||
[Window][[022E62E0] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002
|
||||
|
||||
[Window][[F5CE46E3] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,6
|
||||
|
||||
[Window][[37DAA990] jakob@AURA]
|
||||
Pos=10,439
|
||||
Size=1888,550
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[824B6EC7] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002
|
||||
|
||||
[Window][[386BFA92] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,5
|
||||
|
||||
[Window][[209155FC] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,1
|
||||
|
||||
[Window][[2498CB04] jakob@AURA]
|
||||
Pos=10,514
|
||||
Size=1888,475
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Window][[0EBC9C82] jakob@AURA]
|
||||
Pos=10,439
|
||||
Size=1888,550
|
||||
Collapsed=0
|
||||
DockId=0x00000002,2
|
||||
|
||||
[Table][0x32886A44,9]
|
||||
Column 0 Weight=0.9882 Visible=1
|
||||
Column 1 Weight=1.1970 Visible=1
|
||||
Column 2 Weight=0.7725 Visible=1
|
||||
Column 3 Weight=0.6681 Visible=1
|
||||
Column 4 Weight=1.3658 Visible=0
|
||||
Column 5 Weight=0.9604 Visible=1
|
||||
Column 6 Weight=1.2944 Visible=1
|
||||
Column 7 Weight=0.4175 Visible=1
|
||||
Column 8 Weight=1.3361 Visible=1
|
||||
|
||||
[Table][0x064A67CC,4]
|
||||
Column 0 Weight=1.0000
|
||||
Column 1 Weight=1.0000
|
||||
Column 2 Weight=1.0000
|
||||
Column 3 Weight=1.0000
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x85940918 Window=0x260A4489 Pos=10,43 Size=1888,946 Split=Y
|
||||
DockNode ID=0x00000001 Parent=0x85940918 SizeRef=1024,394 Split=X
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=1188,159 CentralNode=1 Selected=0x61E02D75
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=698,159 Selected=0x0FA43D88
|
||||
DockNode ID=0x00000002 Parent=0x85940918 SizeRef=1024,550 Selected=0xE5DB7127
|
||||
|
||||
@@ -64,8 +64,8 @@ proc main() =
|
||||
# Receive and parse websocket response message
|
||||
let event = recvEvent(ws.receiveMessage().get())
|
||||
case event.eventType:
|
||||
# of CLIENT_PROFILE:
|
||||
# profile = parsetoml.parseString(event.data["profile"].getStr())
|
||||
of CLIENT_PROFILE:
|
||||
profile = parsetoml.parseString(event.data["profile"].getStr())
|
||||
|
||||
of CLIENT_LISTENER_ADD:
|
||||
let listener = event.data.to(UIListener)
|
||||
@@ -100,10 +100,19 @@ proc main() =
|
||||
discard
|
||||
|
||||
of CLIENT_CONSOLE_ITEM:
|
||||
consoles[event.data["agentId"].getStr()].addItem(cast[LogType](event.data["logType"].getInt()), event.data["message"].getStr(), event.timestamp)
|
||||
let agentId = event.data["agentId"].getStr()
|
||||
consoles[agentId].addItem(
|
||||
cast[LogType](event.data["logType"].getInt()),
|
||||
event.data["message"].getStr(),
|
||||
event.timestamp
|
||||
)
|
||||
|
||||
of CLIENT_EVENTLOG_ITEM:
|
||||
eventlog.addItem(cast[LogType](event.data["logType"].getInt()), event.data["message"].getStr(), event.timestamp)
|
||||
eventlog.addItem(
|
||||
cast[LogType](event.data["logType"].getInt()),
|
||||
event.data["message"].getStr(),
|
||||
event.timestamp
|
||||
)
|
||||
|
||||
else: discard
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ type
|
||||
listeners*: seq[UIListener]
|
||||
selection: ptr ImGuiSelectionBasicStorage
|
||||
startListenerModal: ListenerModalComponent
|
||||
generatePayloadModal: AgentModalComponent
|
||||
generatePayloadModal*: AgentModalComponent
|
||||
|
||||
proc ListenersTable*(title: string): ListenersTableComponent =
|
||||
result = new ListenersTableComponent
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import strutils, sequtils
|
||||
import imguin/[cimgui, glfw_opengl, simple]
|
||||
import ../../utils/[appImGui, colors]
|
||||
import ../../../common/[types, utils]
|
||||
import ../../../common/[types, profile, utils]
|
||||
import ../widgets/dualListSelection
|
||||
|
||||
type
|
||||
|
||||
@@ -2,7 +2,7 @@ import times, tables, strformat, strutils
|
||||
import imguin/[cimgui, glfw_opengl, simple]
|
||||
|
||||
import ./console
|
||||
import ../utils/appImGui
|
||||
import ../utils/[appImGui, colors]
|
||||
import ../../common/[types, utils]
|
||||
|
||||
type
|
||||
@@ -25,6 +25,7 @@ proc interact(component: SessionsTableComponent) =
|
||||
# Open a new console for each selected agent session
|
||||
var it: pointer = nil
|
||||
var row: ImGuiID
|
||||
|
||||
while ImGuiSelectionBasicStorage_GetNextSelectedItem(component.selection, addr it, addr row):
|
||||
let agent = component.agents[cast[int](row)]
|
||||
|
||||
@@ -36,6 +37,8 @@ proc interact(component: SessionsTableComponent) =
|
||||
else:
|
||||
igSetWindowFocus_Str(fmt"[{agent.agentId}] {agent.username}@{agent.hostname}")
|
||||
|
||||
component.selection.ImGuiSelectionBasicStorage_Clear()
|
||||
|
||||
proc draw*(component: SessionsTableComponent, showComponent: ptr bool) =
|
||||
igBegin(component.title, showComponent, 0)
|
||||
defer: igEnd()
|
||||
@@ -110,7 +113,11 @@ proc draw*(component: SessionsTableComponent, showComponent: ptr bool) =
|
||||
let seconds = totalSeconds mod 60
|
||||
|
||||
let timeText = dateTime(2000, mJan, 1, hours.int, minutes.int, seconds.int).format("HH:mm:ss")
|
||||
igText(fmt"{timeText} ago")
|
||||
|
||||
if totalSeconds > agent.sleep:
|
||||
igTextColored(GRAY, fmt"{timeText} ago")
|
||||
else:
|
||||
igText(fmt"{timeText} ago")
|
||||
|
||||
# Handle right-click context menu
|
||||
# Right-clicking the table header to hide/show columns or reset the layout is only possible when no sessions are selected
|
||||
@@ -136,4 +143,8 @@ proc draw*(component: SessionsTableComponent, showComponent: ptr bool) =
|
||||
multiSelectIO = igEndMultiSelect()
|
||||
ImGuiSelectionBasicStorage_ApplyRequests(component.selection, multiSelectIO)
|
||||
|
||||
# Auto-scroll to bottom
|
||||
if igGetScrollY() >= igGetScrollMaxY():
|
||||
igSetScrollHereY(1.0f)
|
||||
|
||||
igEndTable()
|
||||
|
||||
Reference in New Issue
Block a user