void cl_list_running_processes()

in client.c [180:211]


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

    HANDLE secondary_pipe = NULL;
    packet_t* packet = NULL;
    packet_t* result = NULL;
    wchar_t* running_processes = NULL;

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

    secondary_pipe = cl_open_malware_pipe_0(target, pid);

    packet = comm_receive_packet(secondary_pipe);

    running_processes = (wchar_t*)comm_receive_decrypt_data(
        secondary_pipe, packet->_1.buffer_size, RC4_KEY, RC4_KEY_LENGTH);
    wprintf(L"%s\n", running_processes);

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

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