> For the complete documentation index, see [llms.txt](https://easyauth.papelship.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://easyauth.papelship.com/documentation/plugins/qpanalyzer.md).

# qPAnalyzer&#x20;

{% hint style="info" %}
**qPAnalyzer AI** is an advanced AI-powered anti-cheat plugin for EasyAuth that employs two-stage forensic intelligence: Stage 1 processes running processes, modules, directory files, and hosts entries; Stage 2 leverages multimodal vision models (**Google Gemini 2.5 Flash Lite**) to visually inspect suspicious windows and identify reverse engineering GUIs.
{% endhint %}

## Required Files

To use qPAnalyzer AI in your project:

* **Header**: `include/qPapelEasyAuthqPAnalyzer.h`
* **Static Lib**: `lib/x64/Release/qPapelEasyAuthqPAnalyzer.lib`

## Quick Setup & Usage

{% stepper %}
{% step %}

## Configure logging verbosity

```cpp
easyauth::plugins::set_qpanalyzer_log_level(easyauth::plugins::qpanalyzer_log_level::verbose);
```

{% endstep %}

{% step %}

## Load the AI plugin

```cpp
if (!easyauth::plugins::load_qpanalyzer_plugin()) {
    std::cerr << "[-] Failed to register qPAnalyzer AI plugin.\n";
    return 1;
}
```

{% endstep %}

{% step %}

## Initialize EasyAuth Core

```cpp
easyauth::initialize();
```

{% endstep %}

{% step %}

## Connect and authenticate

```cpp
easyauth::network_connect();
easyauth::init_session("pk_your_api_key");
easyauth::authenticate("YOUR-KEY", "pk_your_api_key");
```

{% endstep %}

{% step %}

## Trigger an immediate background scan

Optional — runs automatically.

```cpp
easyauth::plugins::trigger_qpanalyzer_scan();
```

{% endstep %}
{% endstepper %}

```cpp
#include "qPapelEasyAuth.h"
#include "qPapelEasyAuthqPAnalyzer.h"
#include <iostream>

int main() {
    // 1. Configure logging verbosity
    easyauth::plugins::set_qpanalyzer_log_level(easyauth::plugins::qpanalyzer_log_level::verbose);

    // 2. Load the AI plugin
    if (!easyauth::plugins::load_qpanalyzer_plugin()) {
        std::cerr << "[-] Failed to register qPAnalyzer AI plugin.\n";
        return 1;
    }

    // 3. Initialize EasyAuth Core
    easyauth::initialize();

    // 4. Connect & Authenticate
    easyauth::network_connect();
    easyauth::init_session("pk_your_api_key");
    easyauth::authenticate("YOUR-KEY", "pk_your_api_key");

    // 5. Trigger an immediate background scan (Optional - Runs automatically)
    easyauth::plugins::trigger_qpanalyzer_scan();

    return 0;
}
```

## Result Structure (`qpanalyzer_result`)

Query the latest scan results at any time using `get_qpanalyzer_result()`:

```cpp
struct qpanalyzer_result {
    bool scanned = false;                                // true if at least one scan has completed
    int threat_score = 0;                                // AI Risk Score (0 = Clean, 100 = Severe Attack)
    bool is_reversing = false;                           // Flagged if reverse engineering tool confirmed
    std::vector<std::string> detected_tools;             // Names of detected tools (e.g. "x64dbg", "Cheat Engine")
    std::vector<uint32_t> flagged_pids;                  // PIDs of malicious processes
    std::vector<std::string> target_files_to_wipe;       // Full paths of dump/cheat files to sanitize
    std::string action_taken;                            // "allow" | "close_app" | "ban_and_close"
    std::string reasoning;                               // Single-line verdict summary
    std::string detailed_reasoning;                      // Step-by-step forensic explanation
};
```

#### Example Result Query

```cpp
auto res = easyauth::plugins::get_qpanalyzer_result();
if (res.is_reversing) {
    std::cout << "[!] Threat Score: %" << res.threat_score << "\n";
    std::cout << "[!] AI Reasoning: " << res.reasoning << "\n";
}
```

## Log Level Configuration

```cpp
enum class qpanalyzer_log_level {
    silent = 0,      // No console logs
    errors_only = 1,  // Only log detections and errors
    verbose = 2      // Full debug and AI thought logs
};

void set_qpanalyzer_log_level(qpanalyzer_log_level level);
```

## Key Features

* **Sub-Second AI Latency**: Powered by `PapelAI` with \~0.15s time-to-first-token.
* **Smart False-Positive Immunity**: Accurately differentiates between benign terminals (e.g. `cmd.exe` titled `x64dbg`) and real interactive debugger widgets.
* **Adaptive Delta Triggering**: Monitors newly spawned PIDs and windows with smart cooldowns to minimize bandwidth and token consumption.
* **Automatic File Sanitization**: Automatically quarantines or wipes dump artifacts specified in `target_files_to_wipe`.
