Delete client private key from memory after key exchange.

This commit is contained in:
Jakob Friedl
2025-10-14 09:58:45 +02:00
parent d9372dc880
commit 21137f6db5
3 changed files with 6 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ proc main(ip: string = "localhost", port: int = 37573) =
let io = igGetIO()
# Create key pair
let clientKeyPair = generateKeyPair()
var clientKeyPair = generateKeyPair()
# Initiate WebSocket connection
var connection = WsConnection(
@@ -79,6 +79,7 @@ proc main(ip: string = "localhost", port: int = 37573) =
of CLIENT_KEY_EXCHANGE:
connection.sessionKey = deriveSessionKey(clientKeyPair, decode(event.data["publicKey"].getStr()).toKey())
connection.sendPublicKey(clientKeyPair.publicKey)
wipeKey(clientKeyPair.privateKey)
of CLIENT_PROFILE:
profile = parsetoml.parseString(event.data["profile"].getStr())
@@ -168,8 +169,6 @@ proc main(ip: string = "localhost", port: int = 37573) =
writeFile(path & "_download", file)
except IOError:
discard
discard
else: discard

View File

@@ -4,6 +4,6 @@ const CONQUEST_ROOT* {.strdefine.} = ""
const WIDGET_SESSIONS* = " " & ICON_FA_LIST & " " & "Sessions [Table View]"
const WIDGET_LISTENERS* = " " & ICON_FA_SATELLITE_DISH & " " & "Listeners"
const WIDGET_EVENTLOG* = "Eventlog"
const WIDGET_EVENTLOG* = " " & ICON_FA_CLIPBOARD_LIST & " " & "Eventlog"
const WIDGET_DOWNLOADS* = " " & ICON_FA_DOWNLOAD & " " & "Downloads"
const WIDGET_SCREENSHOTS* = " " & ICON_FA_IMAGE & " " & "Screenshots"

View File

@@ -13,12 +13,10 @@ type
# Text highlighting
proc getText(item: ConsoleItem): cstring =
if item.itemType != LOG_OUTPUT:
# let timestamp = item.timestamp.fromUnix().format("dd-MM-yyyy HH:mm:ss")
return "[" & item.timestamp & "]" & $item.itemType & item.text
else:
return $item.itemType & item.text
proc getNumLines(data: pointer): csize_t {.cdecl.} =
if data.isNil:
return 0
@@ -92,10 +90,10 @@ proc draw*(component: TextareaWidget, size: ImVec2, filter: ptr ImGuiTextFilter
let childWindowFlags = ImGuiChildFlags_NavFlattened.int32 or ImGui_ChildFlags_Borders.int32 or ImGui_ChildFlags_AlwaysUseWindowPadding.int32 or ImGuiChildFlags_FrameStyle.int32
if igBeginChild_Str("##TextArea", size, childWindowFlags, ImGuiWindowFlags_HorizontalScrollbar.int32):
component.contentDisplayed.items.setLen(0)
# Display items
component.contentDisplayed.items.setLen(0)
for item in component.content.items:
# Handle search/filter
if not filter.isNil():
if filter.ImGuiTextFilter_IsActive():
@@ -111,7 +109,7 @@ proc draw*(component: TextareaWidget, size: ImVec2, filter: ptr ImGuiTextFilter
component.textSelect.textselect_update()
except IndexDefect:
# CTRL+A crashes when no items are in the eventlog
# CTRL+A crashes when no items are in the text area
discard
finally: