cd.cpp
Source: src/modules/cd.cpp
The cd module changes the context of the implant's execution environment. This is a persistent change; once this module executes successfully, all subsequent relative paths used in other commands (like ls or file upload) will be relative to this new location.
Function Signature
ModuleResult cd(std::string path_name);
Parameters
path_name: The target directory path to switch to.
Logic & Behavior
This module is a thin wrapper around the Windows API:
- Calls
SetCurrentDirectorywith the provided path. - Checks the boolean result.
Return Values (ModuleResult)
data: Always empty ("").windows_error_code:ERROR_SUCCESS(0): The directory was changed successfully.- WinAPI Error: If failed (e.g.,
ERROR_FILE_NOT_FOUND,ERROR_ACCESS_DENIED), the specific code fromGetLastError()is returned.