in client.c [145:178]
void cl_get_working_directory(HANDLE pipe, const char* target, uint32_t pid)
{
assert(INVALID_HANDLE_VALUE != pipe);
packet_t* packet = NULL;
packet_t* result = NULL;
wchar_t* current_directory = NULL;
comm_send_command(pipe, GET_WORKING_DIRECTORY, NULL, 0, RC4_KEY,
RC4_KEY_LENGTH);
packet = comm_receive_packet(pipe);
if (!packet->_0.result)
{
printf("Get current directory command failed\n");
cl_print_packet(packet);
goto end;
}
current_directory = (wchar_t*)comm_receive_decrypt_data(
pipe, packet->_1.buffer_size, RC4_KEY, RC4_KEY_LENGTH);
wprintf(L"Current directory: %.*ls\n", packet->_1.buffer_size / 2, current_directory);
result = comm_receive_packet(pipe);
cl_print_packet(result);
end:
if (packet)
free(packet);
if (current_directory)
free(current_directory);
if (result)
free(result);
}