Files
dmcxblue-ANIMO/shared/PowerShellManager.h
David GarciaandClaude Opus 4.6 ca4bacda13 Initial commit: ANIMO client-server Azure/M365 session management platform
Full implementation of client (Qt6 GUI) and server (TCP JSON protocol) with:
- Azure session management with PowerShell backend
- M365 modules: Outlook Email, Calendar, Teams Chat, SharePoint/OneDrive
- Azure enumeration: VMs, Storage, Key Vault, Functions, Logic Apps, SQL, Runbooks
- Attack modules: MSOLSpray, SPN Spray, WHfB, Illicit Consent, Post-Exploit
- Token management: store, exchange, analyze, PRT/SSO cookie conversion
- Session persistence with AES-256-GCM encrypted tokens
- Network robustness: timeouts, rate limiting, cancel buttons, API error parsing
- Report generation and session timeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:18:38 -08:00

64 lines
2.1 KiB
C++

#ifndef POWERSHELL_MANAGER_H
#define POWERSHELL_MANAGER_H
#include <QString>
/**
* @brief Utility class for PowerShell-related operations
*
* Provides cross-platform PowerShell path resolution and
* session script management.
*/
class PowerShellManager {
public:
/**
* @brief Find the PowerShell executable path
*
* Searches for PowerShell in the following order:
* - Windows: pwsh.exe, powershell.exe, common install paths
* - WSL: Windows PowerShell under /mnt/c, then native pwsh
* - Linux/macOS: pwsh, /usr/bin/pwsh, /snap/bin/pwsh
*
* @return Full path to PowerShell executable, or fallback name
*/
static QString getPwshPath();
/**
* @brief Get or create the scripts directory for a session
*
* Creates data/sessions/<sessionId> if it doesn't exist.
*
* @param sessionId The session UUID
* @return Path to the session's scripts directory
*/
static QString sessionScriptsDir(const QString &sessionId);
/**
* @brief Write a PowerShell script file for a session
*
* Writes UTF-8 encoded content to a .ps1 file in the session's
* scripts directory.
*
* @param sessionId The session UUID
* @param content The PowerShell script content
* @param name The script filename (default: "login.ps1")
* @return Native full path to the created file, or empty on error
*/
static QString writePs1ForSession(const QString &sessionId,
const QString &content,
const QString &name = QStringLiteral("login.ps1"));
/**
* @brief Get common PowerShell startup arguments
*
* Returns arguments for non-interactive, clean PowerShell sessions:
* -NoLogo -NoProfile -NonInteractive
*
* @param includeExecutionPolicy Whether to add -ExecutionPolicy Bypass (Windows only)
* @return List of command-line arguments
*/
static QStringList getStartupArgs(bool includeExecutionPolicy = false);
};
#endif // POWERSHELL_MANAGER_H