Untitled

Anonymous
Plain Text
11/29/2026 1:50 AM
3.1 KB
7
Indexable
Never

#include <windows.h>
#include <stdio.h>
#include <time.h>

#define LOG_FILE "C:\\AtomLab\\logs\\telemetry.jsonl"

void write_event(
    FILE *log,
    const char *event,
    const char *status,
    DWORD pid
) {
    SYSTEMTIME t;
    GetLocalTime(&t);

    fprintf(log,
        "{\"timestamp\":\"%04d-%02d-%02dT%02d:%02d:%02d\","
        "\"event\":\"%s\","
        "\"status\":\"%s\","
        "\"pid\":%lu}\n",
        t.wYear, t.wMonth, t.wDay,
        t.wHour, t.wMinute, t.wSecond,
        event, status, pid
    );

    fflush(log);
}

int main(void)
{
    char hostname[MAX_COMPUTERNAME_LENGTH + 1];
    DWORD size = sizeof(hostname);
    DWORD pid = GetCurrentProcessId();

    SYSTEMTIME t;
    GetLocalTime(&t);

    GetComputerNameA(hostname, &size);

    FILE *log = fopen(LOG_FILE, "a");

    if (log == NULL) {
        MessageBoxA(
            NULL,
            "Impossible de creer le fichier telemetry.jsonl",
            "ATOM LAB - ERROR",
            MB_OK | MB_ICONERROR
        );
        return 1;
    }

    /* Evenement reel : execution de ce programme */
    write_event(log, "payload_started", "OBSERVED", pid);

    /* Phases pedagogiques : aucune injection executee */
    write_event(log, "atom_transfer_phase",
                "SIMULATED", pid);

    write_event(log, "apc_execution_phase",
                "SIMULATED", pid);

    write_event(log, "rop_protection_phase",
                "THEORETICAL", pid);

    write_event(log, "demonstration_completed",
                "OBSERVED", pid);

    fclose(log);

    char message[1024];

    snprintf(message, sizeof(message),
        "ATOM INJECTION - SOC LAB\n\n"
        "STATUS: DEMONSTRATION COMPLETED\n\n"
        "Computer: %s\n"
        "Process ID: %lu\n"
        "Date: %02d/%02d/%04d\n"
        "Time: %02d:%02d:%02d\n\n"
        "Telemetry: SAVED\n"
        "Destructive actions: NONE\n\n"
        "This is a safe educational simulation.",
        hostname,
        pid,
        t.wDay, t.wMonth, t.wYear,
        t.wHour, t.wMinute, t.wSecond
    );

    MessageBoxA(
        NULL,
        message,
        "ATOM INJECTION - SECURITY MONITOR",
        MB_OK | MB_ICONWARNING
    );

    return 0;
}




#include <windows.h>
#include <stdio.h>

int main(void)
{
    const char *message = "ATOMLAB - Demonstration de la table globale";

    // 1. Ajouter une chaine dans la table globale
    ATOM atom = GlobalAddAtomA(message);

    if (atom == 0) {
        printf("[ERREUR] GlobalAddAtomA a echoue.\n");
        return 1;
    }

    printf("[OK] Chaine enregistree dans la table globale.\n");
    printf("[INFO] Identifiant ATOM : %u\n", atom);

    // 2. Recuperer la chaine a partir de son identifiant
    char buffer[256] = {0};

    UINT length = GlobalGetAtomNameA(
        atom,
        buffer,
        sizeof(buffer)
    );

    if (length == 0) {
        printf("[ERREUR] Impossible de recuperer la chaine.\n");
        GlobalDeleteAtom(atom);
        return 1;
    }

    printf("[OK] Chaine recuperee : %s\n", buffer);
    printf("[INFO] Taille recuperee : %u caracteres\n", length);

    // 3. Nettoyer la table
    GlobalDeleteAtom(atom);

    printf("[OK] ATOM supprime de la table.\n");

    return 0;
}
Editor is loading...
Leave a Comment