void cl_list_working_directory_files()

in client.c [504:537]


void cl_list_working_directory_files(HANDLE pipe, const char* target,
    uint32_t pid)
{
    assert(INVALID_HANDLE_VALUE != pipe);

    HANDLE secondary_pipe = INVALID_HANDLE_VALUE;
    packet_t* packet = NULL;
    packet_t* result = NULL;
    wchar_t* file_list = NULL;

    comm_send_command(pipe, LIST_WORKING_DIRECTORY_FILES, NULL, 0, RC4_KEY,
        RC4_KEY_LENGTH);

    secondary_pipe = cl_open_malware_pipe_0(target, pid);

    packet = comm_receive_packet(secondary_pipe);

    file_list = (wchar_t*)comm_receive_decrypt_data(
        secondary_pipe, packet->_1.buffer_size, RC4_KEY, RC4_KEY_LENGTH);

    wprintf(L"%s\n", file_list);

    result = comm_receive_packet(pipe);
    cl_print_packet(result);

    if (packet)
        free(packet);
    if (result)
        free(result);
    if (file_list)
        free(file_list);
    if (INVALID_HANDLE_VALUE != secondary_pipe)
        CloseHandle(secondary_pipe);
}