Proto commits in spellshift/realm

These 87 commits are when the Protocol Buffers files have changed:

Commit:c8ff867
Author:Nicholas O'Brien
Committer:GitHub

feat: implement UDP-based QUIC network transport protocol (#2360) * feat: implement UDP-based QUIC network transport protocol * fix: correctly parse and pass transport type override from YAML IMIX_CONFIG * fix: set ALPN protocols to realm-quic in client tls config * Align QUIC transport display name and priority in Tavern UI * Build frontend bundle with QUIC transport changes * enable quic

Commit:804bb9f
Author:Copilot
Committer:GitHub

Remove legacy reverse_shell eldritch methods and gRPC service (#2353) * Remove legacy reverse_shell and reverse_shell_pty eldritch + gRPC methods Agent-Logs-Url: https://github.com/spellshift/realm/sessions/e45ea604-1fb3-4004-97bb-33361ba11f32 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Remove reverse shell architecture section from tavern docs Agent-Logs-Url: https://github.com/spellshift/realm/sessions/e45ea604-1fb3-4004-97bb-33361ba11f32 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com>

Commit:d216606
Author:copilot-swe-agent[bot]
Committer:GitHub

Changes before error encountered Agent-Logs-Url: https://github.com/spellshift/realm/sessions/6b945008-1e47-49c2-bb5a-afda38f6fc3a Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:d58c99f
Author:workspaces

Add SMB bind transport to imix Adds a new TRANSPORT_SMB_BIND transport type (id=7) following the same pattern as the TCP bind transport. On Windows the transport binds a named pipe (\\.\pipe\<name>); on Linux/macOS it binds a Unix domain socket (/tmp/.<name>.sock). Both platforms expose the connection as a plain gRPC channel (ChaCha encryption is applied upstream by Agent A). URI format: smb://<pipe-name> Changes span the full stack: - c2.proto: add TRANSPORT_SMB_BIND = 7 - Go pb / ent / GraphQL generated files updated to include the new value; Value() and MarshalGQL() now use the name map directly so DB/GraphQL serialisation works without a protoc regeneration of the raw descriptor - build_config.go: TransportTypeToString handles tcp_bind and smb_bind - Rust pb: TransportSmbBind = 7 in c2.rs, "smb" scheme in config.rs, smb_bind added to valid YAML transport types in build.rs - New implants/lib/transport/src/smb_bind.rs - transport/lib.rs, Cargo.toml, imix/Cargo.toml wired up with smb-bind feature Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Commit:e89ebf3
Author:Copilot
Committer:GitHub

Add PTY portal support: `pty()` meta-command, websocket handler, and imix PTY manager (#2252) * Add BYTES_PAYLOAD_KIND_PTY to portal proto and pty kind to ShellPivot schema Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a83547a0-c485-4bc5-966d-232354f90277 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Add PTY websocket handler and register /portals/pty/ws route Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a83547a0-c485-4bc5-966d-232354f90277 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Add pty() meta-command, PtyTerminal component, and frontend tab handling Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a83547a0-c485-4bc5-966d-232354f90277 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Add PTY portal handler in imix for handling PTY motes via stream_id Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a83547a0-c485-4bc5-966d-232354f90277 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix code review feedback: remove dead code, unused import, and unsafe unwrap Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a83547a0-c485-4bc5-966d-232354f90277 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix PTY not accepting input: keep master PTY handle alive, use spawn_blocking for reader, add term.focus() Agent-Logs-Url: https://github.com/spellshift/realm/sessions/a2213bd5-7560-4932-a7eb-f54ffc372fb4 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Double default PTY size from 24x80 to 48x160 Agent-Logs-Url: https://github.com/spellshift/realm/sessions/5f7ad2f9-93d3-45d4-8dec-0ead29b56da5 Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * rebuilt --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com>

Commit:52330ab
Author:KaliPatriot
Committer:GitHub

ICMP Redirector (#2068) * Claude my goat. moderately tested, needs more testing and code review * cargo fmt * Fix mutex locking * fix mac? * updates * Update useOnlineBeaconIds.ts * npm run build * docs updates * npm run build * hypothetical PR fixes from claude * Jarvis, fix this doc * Claude Opus 4.6 Max Thinking task * npm run build

Commit:ebf145c
Author:Hulto
Committer:GitHub

Add tcp bind transport (#2140) * Add chain tcp eldritch function * Add bind tcp transport

Commit:2a4669f
Author:google-labs-jules[bot]

Fix undefined 'status' variable in process_list_impl.rs - In `implants/lib/eldritch/stdlib/eldritch-libreport/src/std/process_list_impl.rs`, replaced the undefined `status` variable reference with a hardcoded `0` since status parsing was deliberately disabled due to missing string-to-enum mapping logic. - Cleaned up an unused `alloc::format` import in `implants/lib/eldritch/stdlib/eldritch-libfile/src/std/list_impl.rs`. Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>

Commit:3278e45
Author:Hulto
Committer:GitHub

Build profiles (#2074) * transports moved to build profile * And pre and post build scripts. * Add pre and post build to protos and ents * build profile mostly done update * copy tomes to builder * Cleaning up defaults * tests pass * Update readme * More readable artifact names * Update read me * Updates * Add host_uniqueness to build * Solved * generate

Commit:a6685a3
Author:Hulto
Committer:GitHub

Add process creation time to process list (#2077) * feat: add process creation time to process list info This commit updates the eldritch agent and the C2 server to report the process creation/start time. - Updated `eldritch.proto` to include `start_time` in `Process`. - Updated `schema/host_process.go` to include `start_time` field. - Generated new Protobuf and Ent code based on these schema changes. - Updated Go C2 handler to map the new field to the database entry. - Updated Rust agent's `eldritch-libprocess` to retrieve `start_time`. - Updated Rust agent's `eldritch-libreport` to parse and send `start_time`. - Tested the changes to ensure successful integration. Co-authored-by: hulto <7121375+hulto@users.noreply.github.com> * generate --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

Commit:ac51f67
Author:google-labs-jules[bot]

feat: Add BuilderProfile and BuildTask tomes injection This commit introduces the `BuilderProfile` ent, allowing admins to define pre- and post-build bash scripts. It also updates the `BuildTask` ent to support dynamically injected `Tomes`. The builder gRPC server and Docker executor were modified to pull, decode, and execute these scripts and tomes securely during the build phase. - Add `BuilderProfile` schema with admin-only privacy policy. - Add `tomes` JSON field and `builder_profile` edge to `BuildTask`. - Update Protobuf definitions to support streaming tomes and their assets to the builder client. - Update `CreateBuildTask` GraphQL mutation to accept tomes and profiles. - Inject pre/post scripts and tomes into the `DockerExecutor` runner via `base64` decoding during container initialization. Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>

Commit:f859e7f
Author:google-labs-jules[bot]

feat: Capture and report process start time Updated the eldritch.Process protobuf to include a `start_time` field. The Rust agent gathers this timestamp cross-platform using the `sysinfo` crate. The Go backend and Ent schema have been updated to persist the `start_time`. Auto-generated protobuf and GraphQL bindings have also been updated to reflect the new field. Co-authored-by: hulto <7121375+hulto@users.noreply.github.com>

Commit:a519a3a
Author:KCarretto
Committer:GitHub

Fix shell portal upgrade logic and add ShellPayload output separation… (#2029) * Fix shell portal upgrade logic and add ShellPayload output separation (#2024) * fix: upgrade shell portal handling to use ShellPayload with output and error fields This commit resolves issues with portal upgrades in shellv2. It updates the polling logic in the websocket handler to use the shell's beacon edge to identify active portals. It extends the `ShellPayload` to include distinct `output` and `error` fields, migrating away from using `BytesPayload` for portal output to provide better standard stream separation. The rust implant has been updated to use these new fields. Finally, it adds a descriptive hover tooltip to the frontend to communicate portal state. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fix: upgrade shell portal handling and UI indicators This commit improves the active portal handling and UI feedback in shellv2. It updates the polling logic to find the active portal via the shell's beacon edge instead of the shell edge. It introduces `output` and `error` fields to the `ShellPayload` for correct standard stream routing, mitigating the need to parse payload bytes manually. Finally, it adds a connection-aware, color-coded tooltip to the frontend shell status bar to inform the user about the active low-latency portal state. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * cargo fmt --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:d4e100d
Author:KCarretto
Committer:GitHub

Fix shell portal upgrade logic and add ShellPayload output separation (#2024) * fix: upgrade shell portal handling to use ShellPayload with output and error fields This commit resolves issues with portal upgrades in shellv2. It updates the polling logic in the websocket handler to use the shell's beacon edge to identify active portals. It extends the `ShellPayload` to include distinct `output` and `error` fields, migrating away from using `BytesPayload` for portal output to provide better standard stream separation. The rust implant has been updated to use these new fields. Finally, it adds a descriptive hover tooltip to the frontend to communicate portal state. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fix: upgrade shell portal handling and UI indicators This commit improves the active portal handling and UI feedback in shellv2. It updates the polling logic to find the active portal via the shell's beacon edge instead of the shell edge. It introduces `output` and `error` fields to the `ShellPayload` for correct standard stream routing, mitigating the need to parse payload bytes manually. Finally, it adds a connection-aware, color-coded tooltip to the frontend shell status bar to inform the user about the active low-latency portal state. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:e1bdbab
Author:KCarretto
Committer:GitHub

Fix portal shell output payload (#2022) * Fix shell output payload type in portal execution context When executing a shell task via a portal, the `imix` agent was incorrectly packaging the shell output in a `ShellPayload` message. The backend expects output to be received as a `BytesPayload` (which is correctly utilized for db-polled output). Updated the `imix` shell manager's `dispatch_output` method for `ExecutionContext::Portal` to serialize the output into a `BytesPayload` with `BytesPayloadKind::Data`, ensuring the output is successfully routed to the browser. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Add output and error fields to ShellPayload for portal execution Previously, when executing a shell task over a portal, the `imix` agent incorrectly sent output over the `input` field of `ShellPayload` (which the backend ignored) while the backend expected standard shell output to arrive as a `BytesPayload`. This commit adds the missing `output` and `error` string fields to `ShellPayload` in the protobuf definitions. The agent now properly serializes output/errors into these new fields instead of repurposing the input field, and the backend WebSocket handler now correctly parses `ShellPayload` fields and dispatches messages to the user. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:3d6beb1
Author:google-labs-jules[bot]

Fix typo in eldritch.proto and regenerate code Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:5621344
Author:google-labs-jules[bot]

feat: add pid and process name reporting to imix and c2 - Update `c2.proto` to include `pid` and `process_name` in `Beacon` message. - Update `imix` config to populate `pid` and `process_name`. - Update `Beacon` and `HostProcess` Ent schema to add a 1:1 relationship. - Update `ClaimTasks` in C2 to create `HostProcess` and link it to the `Beacon`. - Regenerate protobuf and ent code. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:817d617
Author:google-labs-jules[bot]

feat(imix): report PID and process name in beacon - Updated `c2.proto` to include `pid` and `process_name` in `Beacon` message. - Updated `imix` agent to report its PID and process name. - Updated `ent` schema to add `process_id` field to `Beacon` and link it to `HostProcess` via a 1:1 edge. - Updated `ClaimTasks` handler to create or link `HostProcess` based on reported PID and process name. - Regenerated Protobuf and Ent code. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:e778e06
Author:google-labs-jules[bot]

feat: add pid and process_name to imix beacon Updated the imix agent to report its PID and process name in the beacon. Updated the C2 server to store this information by creating and linking a HostProcess entity to the Beacon. Updated protobuf definitions and generated code. Updated Ent schema for Beacon and HostProcess. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:3bba32a
Author:google-labs-jules[bot]

Fix CI: Build frontend, fix rust toolchain, and resolve lint errors This change addresses multiple CI failures: 1. **Frontend Build**: Added `npm ci` and `npm run build` steps to `.github/workflows/*.yml` (e2e tests and unit tests). This is required because `tavern/internal/www/build` (assets) is no longer checked into the repo, but `go build` depends on it via `//go:embed`. 2. **Lint Errors**: Fixed ESLint errors in `tavern/internal/www/src` that were causing the frontend build to fail in CI (where warnings are treated as errors). - Fixed redundant `role="list"` on `ol` in `FormSteps.tsx`. - Fixed missing dependency `toast` in `useEffect` in `Shell.tsx`. - Fixed unexpected comma operator usage in `utils.ts`. - Fixed unused `Button` import in `ShellStatusBar.tsx`. 3. **Rust Toolchain**: Removed invalid `default` and `profile` inputs from `dtolnay/rust-toolchain` configuration in workflows to silence warnings and prevent potential future errors. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:c04ff00
Author:KCarretto
Committer:GitHub

gRPC Refactor for ShellContext (#1864) * proto changes * Update C2 and Agent to support ShellTaskContext (#1863) - Updated `c2.proto` logic in Go backend to support `oneof` context field (TaskContext or ShellTaskContext). - Renamed `ReportTaskOutput` to `ReportOutput` in Go backend and Rust agent to reflect generic reporting. - Updated `ImixAgent` and `Eldritch` interpreter in Rust to use `Context` enum for handling task vs shell task execution. - Refactored `api_reverse_shell.go` to use line-of-sight coding for context resolution. - Updated Go tests, including fixing `TestReverseShell_E2E` by adding JWT generation. - Added `ReportFileKind` support to file reporting. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * cargo fmt * fix tests * fix most go tests * feat: Support creating portals from ShellTask context (#1866) - Modifies `Portal` ent schema to add optional `shell_task` edge and make `task` edge optional. - Updates `CreatePortal` in `mux` to accept `taskID` and `shellTaskID`, allowing creation from either context. - Updates C2 `CreatePortal` handler to pass `shellTaskID` directly instead of resolving `Task` from `ShellTask`. - Updates tests to verify new functionality. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * small test fixes * Fix portal tests by adding JWT to TaskContext (#1867) The `CreatePortal` API now requires a valid JWT in the `TaskContext` or `ShellTaskContext`. This commit updates the integration and benchmark tests in `tavern/internal/portals` to: 1. Store the generated `ed25519` private key in `TestEnv`. 2. Use a helper `generateJWT` to sign a valid JWT. 3. Include the JWT in `CreatePortalRequest` calls in `TestPortalIntegration`, `TestPortalClose`, and `BenchmarkPortalThroughput`. This resolves the test failures where the server was rejecting the requests due to missing or invalid JWTs. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix e2e test failure by updating REPL prompt to match expectation (#1870) The end-to-end test `tests/repl.spec.ts` expects the reverse shell REPL prompt to be `>>> `. However, the `imix` agent was outputting `> `. This change updates `implants/imix/src/shell/repl.rs` to use `>>> ` as the prompt, aligning the agent behavior with the test expectation and standard Python/Eldritch REPL prompts. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:cd8ac02
Author:KCarretto

proto changes

Commit:36622b3
Author:KCarretto
Committer:GitHub

Add Jitter to Imix Callback (#1853) * feat(imix): add jitter to callback interval Added support for configuring jitter in the imix agent callback. The jitter value represents the maximum percentage of the callback interval to subtract from the sleep duration, effectively randomizing the callback timing. Changes: - Updated `tavern/internal/c2/proto/c2.proto` to include `jitter` field in `Transport`. - Manually updated `implants/lib/pb/src/generated/c2.rs` to include `jitter` in `Transport` struct. - Updated `implants/lib/pb/src/config.rs` to parse `jitter` from DSN. - Updated `implants/lib/pb/build.rs` to support `jitter` in YAML config. - Updated `implants/imix/src/agent.rs` to expose `get_callback_jitter`. - Updated `implants/imix/src/run.rs` to use jitter when calculating sleep duration. - Added `rand` dependency to `implants/imix/Cargo.toml`. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fix(imix): resolve compilation errors in transport library Fixed `error[E0063]: missing field jitter in initializer of pb::c2::Transport` which occurred in `implants/lib/transport` due to the recent addition of the `jitter` field to the `Transport` protobuf message. Changes: - Updated `implants/lib/transport/src/dns.rs` to initialize `jitter: 0.0` in `Transport` struct. - Updated `implants/lib/transport/src/lib.rs` to initialize `jitter: 0.0` in `Transport` struct. - Verified compilation with `cargo check -p transport` and tests with `cargo test -p transport`. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fix(imix): resolve remaining compilation error in agent_trait_tests Fixed `error[E0063]: missing field jitter in initializer of pb::c2::Transport` in `imix/src/tests/agent_trait_tests.rs`. This was a lingering issue similar to the previous fix in the `transport` library. Changes: - Updated `implants/imix/src/tests/agent_trait_tests.rs` to initialize `jitter: 0.0` in `pb::c2::Transport` struct initializations. - Verified compilation and tests with `cargo check -p imix --tests` and `cargo test -p imix`. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:eecb4ab
Author:KCarretto
Committer:GitHub

Feat/noninteractive shell e2e (#1845) * Implement Agent Shell Logic and Synchronization (#1832) * Implement agent-side shell features and synchronization - Update `ShellTask` schema with execution timestamps. - Update `c2` and `portal` protocol buffers to support `ShellTask` and `ShellTaskOutput`. - Implement `ClaimTasks` and `ReportTaskOutput` logic for shell tasks in Go backend. - Implement `ShellManager` in Rust agent (`imix`) to manage `Eldritch` interpreters per shell. - Integrate `ShellManager` with `ImixAgent` and `portal` streams for input/output routing. - Ensure shell tasks are claimed and output is buffered/reported correctly. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Implement agent-side shell features and synchronization - Update `ShellTask` schema with execution timestamps. - Update `c2` and `portal` protocol buffers to support `ShellTask` and `ShellTaskOutput`. - Implement `ClaimTasks` and `ReportTaskOutput` logic for shell tasks in Go backend. - Implement `ShellManager` in Rust agent (`imix`) to manage `Eldritch` interpreters per shell. - Integrate `ShellManager` with `ImixAgent` and `portal` streams for input/output routing. - Ensure shell tasks are claimed and output is buffered/reported correctly. - Fixed `tavern/internal/http/shell/handler.go` by removing invalid `StreamId` initialization. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix ShellPayload compilation error in tavern - Removed invalid `StreamId` field initialization from `portalpb.ShellPayload` struct literal in `tavern/internal/http/shell/handler.go`. - This field was removed from the protobuf definition in a previous commit. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix Rust compilation errors in implants/imix and stdlib - Added missing `shell_task_output: None` to `ReportTaskOutputRequest` struct literals in `implants/imix/src/tests/agent_trait_tests.rs` and `implants/lib/eldritch/stdlib/eldritch-libagent/src/std/report_task_output_impl.rs` to match the updated protobuf definition. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Run cargo fmt to ensure consistent code style Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix ShellPrinter output sequence ID handling - Updated `c2.proto` to include `sequence_id` and `stream_id` in `ShellTask`. - Updated `tavern` to populate these fields when claiming tasks. - Updated `imix` `ShellManager` to propagate `sequence_id` and `stream_id` from input tasks/motes to output motes. - Fixed an issue where output was being dropped in interactive sessions due to mismatched sequence IDs (output motes were using `seq_id: 0`). Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * delete weird stuff * Separate aggregation of task and shell task outputs in imix agent (#1835) Updated `implants/imix/src/agent.rs` to aggregate `ReportTaskOutputRequest` messages based on their content type: - Standard task outputs (`output` field) are aggregated by `task_id`. - Shell task outputs (`shell_task_output` field) are aggregated by `shell_task_id`. This ensures that shell task outputs are correctly reported and not merged with standard task outputs (or dropped/overwritten if they share the default task context). Also added a new test `test_agent_output_aggregation` in `implants/imix/src/tests/agent_output_aggregation.rs` to verify this behavior. Fixed a missing field `shell_tasks` in `ClaimTasksResponse` construction in `implants/imix/src/tests/task_tests.rs`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fix newline prints * Update shell manager to send shell task output with the result of interpret() (#1843) Refactored `implants/imix/src/shell/manager.rs` to: - Capture the result of `state.interpreter.interpret(&task.input)`. - Use helper functions `send_shell_output` and `send_shell_error` to send `ReportTaskOutputRequest` and `Mote` messages. - Send the `Debug` representation of the result (if not `Value::None`) as task output, consistent with REPL behavior. - Ensure correct `Arc` cloning to avoid borrow checker errors. - Handle interpretation errors by reporting them as task errors. This ensures that return values of shell commands (e.g. `process.list()`) are displayed to the user even if they are not explicitly printed. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Refactor imix/shell to reuse StreamPrinter implementation (#1837) Moved `StreamPrinter` from `imix/src/task.rs` to `imix/src/printer.rs` and updated it to distinguish between `Stdout` and `Stderr` using an `OutputKind` enum. Updated `imix/src/shell/repl.rs` to reuse `StreamPrinter` instead of the custom `ShellPrinter`. Refactored `imix/src/task.rs` to use the shared `StreamPrinter` and properly report stderr to `TaskError` field. Updated `imix/src/lib.rs` and `imix/src/main.rs` to include the new `printer` module. This change unifies output handling across the agent and improves maintainability. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix imix agent stream printing output separation (#1848) - Modified `StreamPrinter` in `implants/imix/src/printer.rs` to use separate channels for stdout and stderr. - Updated `implants/imix/src/task.rs` to instantiate `StreamPrinter` with two channels and consume them concurrently using `tokio::select!`. - Updated `implants/imix/src/shell/repl.rs` to consume both stdout and stderr streams in the REPL loop. - Verified that `eprint` output is correctly routed to the `TaskError` field via existing tests. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * fixed a panic in eldritch * feat(imix): Implement panic resilience in ShellManager (#1850) * Fix imix shell manager async runtime panic (#1851) * Refactor imix shell manager to run interpreter in blocking task Fixes a panic "Cannot start a runtime from within a runtime" when the eldritch interpreter calls async agent functions (which use `block_on`) from within the imix shell manager's async runtime context. Refactored `ShellManager::handle_task` and `handle_portal_payload` to offload the synchronous `interpreter.interpret` call to `tokio::task::spawn_blocking`. Introduced `run_interpreter_task` helper to manage state transfer between async and blocking contexts. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Refactor imix shell manager to run interpreter in dedicated blocking thread Refactored `ShellManager` to execute the `eldritch` interpreter in a dedicated, long-running blocking thread (`tokio::task::spawn_blocking`) for each shell session. This solves a panic ("Cannot start a runtime from within a runtime") caused by the interpreter calling `block_on` from within an async runtime context. Introduced `InterpreterCommand` enum and `InterpreterHandle` to manage communication between the async manager and the blocking interpreter thread via `tokio::sync::mpsc` channels. This ensures tasks are processed sequentially and prevents state race conditions. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * some small fixes * small cleanup * Refactor shell_manager_tx in portals (#1854) * Refactor shell_manager_tx in portals to use mpsc::Sender directly This change simplifies the passing of `shell_manager_tx` to portal functions by removing the `Arc<Mutex<Option<...>>>` wrapper. The sender is now passed directly as `mpsc::Sender<ShellManagerMessage>`. - Updated `run_create_portal` in `implants/imix/src/portal/mod.rs` to accept `mpsc::Sender`. - Updated `run` and `handle_incoming_mote` in `implants/imix/src/portal/run.rs` to accept `mpsc::Sender` and remove unnecessary locking. - Updated `create_portal` in `implants/imix/src/agent.rs` to extract and clone the sender before spawning the portal task. - `handle_incoming_mote` now uses `try_send` to avoid blocking the portal loop on shell manager backpressure. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Refactor shell_manager_tx in ImixAgent to be a direct mpsc::Sender - Updated `ImixAgent` struct: `shell_manager_tx` is now `tokio::sync::mpsc::Sender<ShellManagerMessage>`. - Introduced `shell_manager_rx: Arc<Mutex<Option<...>>>` to handle the receiver side in `ImixAgent::new`. - Updated `start_shell_manager` to claim the receiver from `shell_manager_rx`. - Simplified usages of `shell_manager_tx` in `process_job_request` and `create_portal` (removed unnecessary locking/cloning). - This aligns with the requirement that `shell_manager_tx` should not be an Option and should be readily available. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Refactor shell_manager_tx in ImixAgent to be a direct mpsc::Sender - Updated `ImixAgent` struct: `shell_manager_tx` is now `tokio::sync::mpsc::Sender<ShellManagerMessage>`. - Updated `ImixAgent::new` to accept `shell_manager_tx` as an argument, implementing dependency injection. - Updated `start_shell_manager` to accept a `ShellManager` instance instead of creating the channel internally. - Refactored `run_agent` in `run.rs` to create the channel and `ShellManager` explicitly. - Updated all relevant tests to match the new API. - Simplified usages of `shell_manager_tx` in `process_job_request` and `create_portal` (removed unnecessary locking/cloning/unwrapping). Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * minor cleanup * remove useless comments --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:5664470
Author:KCarretto

rebuild grpc

Commit:a98e539
Author:KCarretto

updated pb, big refactor incoming

Commit:55fdd5b
Author:KCarretto

delete weird stuff

Commit:343ae83
Author:KCarretto
Committer:GitHub

Implement Agent Shell Logic and Synchronization (#1832) * Implement agent-side shell features and synchronization - Update `ShellTask` schema with execution timestamps. - Update `c2` and `portal` protocol buffers to support `ShellTask` and `ShellTaskOutput`. - Implement `ClaimTasks` and `ReportTaskOutput` logic for shell tasks in Go backend. - Implement `ShellManager` in Rust agent (`imix`) to manage `Eldritch` interpreters per shell. - Integrate `ShellManager` with `ImixAgent` and `portal` streams for input/output routing. - Ensure shell tasks are claimed and output is buffered/reported correctly. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Implement agent-side shell features and synchronization - Update `ShellTask` schema with execution timestamps. - Update `c2` and `portal` protocol buffers to support `ShellTask` and `ShellTaskOutput`. - Implement `ClaimTasks` and `ReportTaskOutput` logic for shell tasks in Go backend. - Implement `ShellManager` in Rust agent (`imix`) to manage `Eldritch` interpreters per shell. - Integrate `ShellManager` with `ImixAgent` and `portal` streams for input/output routing. - Ensure shell tasks are claimed and output is buffered/reported correctly. - Fixed `tavern/internal/http/shell/handler.go` by removing invalid `StreamId` initialization. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix ShellPayload compilation error in tavern - Removed invalid `StreamId` field initialization from `portalpb.ShellPayload` struct literal in `tavern/internal/http/shell/handler.go`. - This field was removed from the protobuf definition in a previous commit. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix Rust compilation errors in implants/imix and stdlib - Added missing `shell_task_output: None` to `ReportTaskOutputRequest` struct literals in `implants/imix/src/tests/agent_trait_tests.rs` and `implants/lib/eldritch/stdlib/eldritch-libagent/src/std/report_task_output_impl.rs` to match the updated protobuf definition. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Run cargo fmt to ensure consistent code style Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix ShellPrinter output sequence ID handling - Updated `c2.proto` to include `sequence_id` and `stream_id` in `ShellTask`. - Updated `tavern` to populate these fields when claiming tasks. - Updated `imix` `ShellManager` to propagate `sequence_id` and `stream_id` from input tasks/motes to output motes. - Fixed an issue where output was being dropped in interactive sessions due to mismatched sequence IDs (output motes were using `seq_id: 0`). Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:5216473
Author:KCarretto
Committer:GitHub

[alpha] shells - mostly backend related setup (#1831) * feat(shellv2): implement new shell endpoint, task tracking, and frontend (#1824) - Update `Shell` ent schema to make task optional and add `ShellTask` relation. - Create `ShellTask` ent schema with history mixin. - Update `portal.proto` to include `ShellPayload`. - Add `createShell` mutation to GraphQL schema and implement resolver. - Implement `ShellV2Handler` with WebSocket upgrade, shell verification, auth check, and pubsub integration. - Update `tavern/app.go` to register new endpoint. - Update `ShellV2` frontend to verify shell status via GraphQL and handle errors. - Fix generated resolvers to avoid panics. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * some backend work * artisnal websockets * stubbed it out... artisnally :chefskiss: * Implement Shell V2 WebSocket backend logic (#1829) - Update `ShellPayload` in `portal.proto` to include `stream_id` for multi-user session tracking. - Implement `writeMessagesFromWebsocket` in `tavern/internal/http/shell/handler.go` to handle user input, create `ShellTask` ents, and route messages to active portals or queue them if no portal is active. - Implement `writeMessagesFromShell` to handle output from portals (interactive) or DB polling (non-interactive), with support for "Other Stream" output notifications. - Add `WebsocketMessageKindOutputFromOtherStream` and associated message struct in `websocket.go`. - Add integration tests in `tavern/internal/http/shell/integration_test.go` covering interactive, non-interactive, and multi-user scenarios. - Fix WebSocket handler to accept both `TextMessage` and `BinaryMessage` frames. - Ensure thread-safe access to `activePortal` state using `ShellSession`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * feat: ShellV2 Typed WebSocket Protocol & Improved Rendering (#1830) * feat: update ShellV2 to use typed WebSocket protocol and improved output rendering - Created `tavern/internal/www/src/pages/shellv2/websocket.ts` to mirror backend WebSocket message types. - Updated `headless-adapter.ts` to use typed messages and correct input format. - Refactored `ShellV2` component to handle asynchronous output by clearing and redrawing the input line. - Implemented specific handling for task errors (red) and control flow messages. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * minor changes --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * tried fixing but it didn't work * fixed * remove old code --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:bc071cd
Author:Hulto
Committer:GitHub

Agent builder executor (#1791) * Add executor mock & docker * Add bulid rpcs

Commit:6e40fb6
Author:Hulto
Committer:GitHub

Agent builder (#1786) * Add builder sub command * Add mtls grpc endpoint for builder * Add builder ping rpc

Commit:331fd35
Author:Claude

Update builder proto: replace callback_uri with imix_config, message with stdout/stderr - BuildAgentRequest: replace callback_uri field with imix_config - ReportBuildStatusRequest: replace message field with stdout and stderr fields https://claude.ai/code/session_01KQzziRQhqEAtRu43k8LZXw

Commit:e0b3d30
Author:Claude

Add builder gRPC API with client subcommand and e2e test Introduce a new Builder gRPC service separate from the existing C2 API, with three stubbed RPCs: BuildAgent, ReportBuildStatus, and ReportBuildArtifact. Register the service at /builder.Builder/ in the tavern HTTP router. Add a `builder` CLI subcommand that connects to an upstream tavern server (defaults to 127.0.0.1:80). Include a test helper (buildertest) and an end-to-end test verifying client-server connectivity across all three RPCs. https://claude.ai/code/session_01KQzziRQhqEAtRu43k8LZXw

Commit:2617c60
Author:google-labs-jules[bot]

Add server_id to trace events Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>

Commit:61ce612
Author:Hulto
Committer:GitHub

Add report.ntlm_hash (#1662) * Add report.ntlm_hash * fmt * fix binding test * fmt

Commit:d2d6104
Author:KaliPatriot
Committer:GitHub

Fix: DNS conversations not cleared from redirectory memory (#1614) * Fix redirector to correctly clear conversations * Ignore invalid packet types * TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO TYPO * regen pb * temp log messages * logging update * fmt * Update docs

Commit:7d496a9
Author:nullmonk

Add facts

Commit:ad064d8
Author:Hulto
Committer:GitHub

Add jwt keys (#1546) * Switch to ed25519 and shared key for oauth + grpc * Add JWT to proto * Report file sends JWT and with REPL * Fix tests * Fix v1 * Update other report funcs * Update fetch lib * Remove task id and change to warn * fix fix * fmt * Resolve feedback * Fix merge? * fmt * No bins * task context * resolve more task_context issuse * resolve merge bugs * fix failing tests * cleanup * fix all tests now * Move back to only use v2 * fmt

Commit:6100f7f
Author:google-labs-jules[bot]

Refactor reverse shell to use Portal infrastructure - Updated `portal.proto` to include `ShellPayload` and `REPLPayload`. - Refactored `tavern/internal/http/stream/websocket.go` to use `tavern/portals/stream` and `tavern/internal/portals/mux`. - Updated `tavern/app.go` and `tavern/config.go` to wire up the new Portal Mux. - Cleaned up legacy stream implementation (`mux.go`, `stream.go` etc). - Implemented `implants/imixv2/src/portal/shell.rs` and `repl.rs` to bridge Portal Motes to existing Shell/REPL logic using mocked transports. - Deleted legacy `tavern/internal/c2/api_reverse_shell.go`.

Commit:f3d6147
Author:Claude
Committer:hulto

Add JWT-based task authentication using ed25519 keys This commit implements JWT-based authentication for gRPC APIs: - Added JWT service using persistent ed25519 keys for signing - Updated protobufs to include JWT fields in: - Task (returned from ClaimTasks) - ReportTaskOutputRequest - FetchAssetRequest - ReportCredentialRequest - ReportFileRequest - Updated ClaimTasks to generate JWTs for each claimed task - Added JWT validation to gRPC APIs: - ReportTaskOutput - FetchAsset - ReportCredential - ReportFile - Invalid JWTs are logged with task ID and JWT token as warnings The ed25519 keys are stored persistently in the secrets manager, separate from the x25519 keys used for encryption.

Commit:7ffd027
Author:Hulto
Committer:GitHub

Multi transport builds (#1517) * Add multi-callback * Add DSN configuration * Force lowercase * Auto grab pubkey with multi-callback using 0th element. * Update v1 * Update callback rotation * fmt * Remove agent callback_uris and idx in favor of config's * Remove callback_uri from transport init replaced by config * remove callback_uri direct ref * fmt * Cleanup warnings * Address code review feedback - Remove unused imports and variables in agent.rs - Switch to and_then syntax for cleaner Option chaining - Refactor parse_dsn to return Transport struct directly - Convert default parameters to const values - Bubble up errors instead of returning defaults - Use named enum variants instead of numeric constants in tests - Update all test cases to use TransportType enum 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Hulto <hulto@users.noreply.github.com> * fmt * Fix test_parse_callback_interval_valid test The test was failing because parse_callback_interval() now returns anyhow::Result<u64> instead of u64. Updated the test to properly unwrap the Result before comparison. Co-authored-by: Hulto <hulto@users.noreply.github.com> * Update enum name * Fix tests * Fix tests * Setup tests * fix? --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Hulto <hulto@users.noreply.github.com>

Commit:003efd2
Author:google-labs-jules[bot]

Refactor Reverse Shell to use Portals - Defined `REPLMessage` in `portal.proto`. - Removed `ReverseShell` from `c2.proto`. - Updated `imixv2` (agent) to use `create_portal` for REPL and PTY. - Updated `transport` crate to remove `reverse_shell`. - Updated `tavern` (server): - Rewrote `websocket.go` to bridge WebSocket to `portalMux` using `Portal` entities. - Updated `api_create_portal.go` to handle keepalives. - Removed legacy `api_reverse_shell.go` and related tests. - Regenerated Go protos. - Cleaned up unused code and updated tests.

Commit:3da4cc4
Author:Claude

Add JWT-based task authentication using ed25519 keys This commit implements JWT-based authentication for gRPC APIs: - Added JWT service using persistent ed25519 keys for signing - Updated protobufs to include JWT fields in: - Task (returned from ClaimTasks) - ReportTaskOutputRequest - FetchAssetRequest - ReportCredentialRequest - ReportFileRequest - Updated ClaimTasks to generate JWTs for each claimed task - Added JWT validation to gRPC APIs: - ReportTaskOutput - FetchAsset - ReportCredential - ReportFile - Invalid JWTs are logged with task ID and JWT token as warnings The ed25519 keys are stored persistently in the secrets manager, separate from the x25519 keys used for encryption.

Commit:40e9e6d
Author:KCarretto
Committer:GitHub

[bug] Close Portals (#1530) * added close message * feat: add integration test for portal closure (#1531) Added `tavern/internal/portals/portal_close_test.go` to verify that when an agent's `CreatePortal` stream ends, the corresponding user `OpenPortal` streams are notified with a CLOSE mote and subsequently terminated. Implemented a retry mechanism with backoff for portal creation checks in the test setup. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cleanup test --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

Commit:605e830
Author:KCarretto
Committer:GitHub

[feature] Portals! (#1484) * initial stubbing and renaming * feat: implement tavern/portals/stream package (#1462) This commit introduces a new package `stream` in `tavern/portals` which provides utilities for handling ordered streams of `portalpb.Mote` messages. Key features: - `payloadSequencer`: Handles atomic sequence ID generation and mote creation. - `OrderedWriter`: Wraps a sender function (like a gRPC stream Send) to automatically sequence and write messages. - `OrderedReader`: Wraps a receiver function (like a gRPC stream Recv) to reorder incoming messages, handling out-of-order delivery with configurable buffering and stale stream detection. This package is designed to support both client and server sides of the portal stream. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * refactor reader to use functional API * Implement PubSub Multiplexer (Mux) (#1466) * Implement PubSub Multiplexer (Mux) for Portals - Created `Mux` package in `tavern/internal/portals/mux`. - Implemented dual-mode operation: In-Memory (for dev) and GCP PubSub (for prod). - Implemented `CreatePortal` and `OpenPortal` lifecycle methods with resource provisioning. - Implemented `Publish` and `Subscribe` logic with local broadcasting (fast path) and global PubSub (slow path). - Added `HistoryBuffer` for message replay. - Added intelligent topic caching to handle `mempubsub` quirks and improve performance. - Added Prometheus metrics for observability. - Verified with comprehensive unit tests using `enttest` and `mempubsub`. * Implement PubSub Multiplexer (Mux) for Portals - **Mux Package:** Created `tavern/internal/portals/mux` to route messages between local streams and global PubSub. - **Dual-Mode Operation:** Implemented support for In-Memory (dev) and GCP PubSub (prod) drivers via `gocloud.dev/pubsub`. - **Portal Lifecycle:** Added `CreatePortal` and `OpenPortal` methods managing resource provisioning, database records, and subscription lifecycles. - **Message Routing:** Implemented `Publish` (fast-path local dispatch, slow-path global send) and `Subscribe` (local channel registration). - **History Management:** Added `HistoryBuffer` in `history.go` for message replay to new subscribers. - **Concurrency & Robustness:** - Handled race conditions in shared subscription creation (`OpenPortal`). - Managed `receiveLoop` lifecycle using stored `cancelFuncs`. - Added `AlreadyExists` error handling for resource creation. - Used `sync.RWMutex` for thread safety (`activeSubs`, `subscribers`, `histMu`). - **Observability:** Added Prometheus metrics for message counts. - **Testing:** Comprehensive unit tests covering In-Memory flow, Portal creation, and Portal opening. * Refactor Mux and Address PR Feedback - **Structure:** Refactored `Mux` to use composed structs (`SubscriptionManager`, `SubscriberRegistry`, `TopicManager`, `HistoryManager`) for clearer locking semantics. - **Safety:** - Handled race conditions in `CreatePortal` and `OpenPortal` by re-checking state after lock acquisition. - Updated `teardown` logic to use `client.Portal.UpdateOneID` for reliability. - Standardized on `context.Background()` for shutdown operations to prevent context leaks. - **Features:** - Added `WithSubscriberBufferSize` to configure channel buffers. - Added `WithHistoryReplay` option to `Subscribe` for optional history. - Added `mux_messages_dropped_total` metric. - **Concurrency:** Moved global lock handling into granular manager structs to reduce contention. - **Correctness:** Fixed `CreatePortal` to use task-based lookup for dependencies and removed invalid `portalID` parameter usage in logic (though kept signature for now as per instructions). Tests passed. * Implement PubSub Multiplexer (Mux) for Portals - **Mux Package:** Created `tavern/internal/portals/mux` to route messages between local streams and global PubSub. - **Dual-Mode Operation:** Implemented support for In-Memory (dev) and GCP PubSub (prod) drivers via `gocloud.dev/pubsub`. - **Portal Lifecycle:** Added `CreatePortal` and `OpenPortal` methods managing resource provisioning, database records, and subscription lifecycles. - **Message Routing:** Implemented `Publish` (fast-path local dispatch, slow-path global send) and `Subscribe` (local channel registration). - **History Management:** Added `HistoryBuffer` in `history.go` for message replay to new subscribers. - **Concurrency & Robustness:** - Handled race conditions in shared subscription creation (`OpenPortal`). - Managed `receiveLoop` lifecycle using stored `cancelFuncs`. - Added `AlreadyExists` error handling for resource creation. - Used composed structs (`SubscriptionManager`, `SubscriberRegistry`) for granular locking. - **Observability:** Added Prometheus metrics for message counts and dropped messages. - **Testing:** Comprehensive unit tests covering In-Memory flow, Portal creation, Portal opening, and Benchmarks. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * both grpc endpoints * stub out portal-stream package * Implement portal-stream crate (#1470) * Implement portal-stream crate with sequencer, reader, and writer logic - Added `implants/lib/portals/portal-stream` crate. - Implemented `PayloadSequencer` for atomic sequence ID generation. - Implemented `OrderedReader` for reordering incoming messages with timeout and buffer handling. - Implemented `OrderedWriter` for sequencing outgoing messages. - Added comprehensive unit tests for all components. - Added crate to `implants` workspace. * Switch to anyhow for error handling in portal-stream - Replaced `thiserror` with `anyhow` in `portal-stream`. - Updated `Cargo.toml` to use `anyhow` from workspace. - Updated `reader.rs` and tests to use `anyhow::Result` and `anyhow!`. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Implement SOCKS5 Proxy using tavern/portals/stream (#1467) * Implement SOCKS5 proxy with gRPC tunneling - Added bin/socks5/proxy.go implementing a SOCKS5 proxy server. - Implemented tunneling over stream.OrderedWriter/Reader. - Supported TCP CONNECT and UDP ASSOCIATE commands. - Implemented robust lifecycle management and cleanup. - Added benchmarks in bin/socks5/proxy_test.go demonstrating high throughput. * Address PR comments: Refactor writes, defaults, and shutdown tracking - Refactored raw `conn.Write` calls into named helper functions. - Changed default upstream port to 8000. - Added `sync.WaitGroup` to track connection lifecycle. - Added logging for dropped motes in dispatcher. - Defined `maxStreamBufferedMessages` constant. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Implement Portal Infrastructure in ImixV2 (#1471) * Implement portal infrastructure in imixv2 - Added `portal-stream` dependency to `imixv2`. - Updated `Transport` trait to include `create_portal` (async). - Implemented `create_portal` in `grpc` transport. - Updated `Agent` trait to include `create_portal`. - Created `imixv2/src/portal/` module with TCP, UDP, and Bytes support using `portal-stream`. - Implemented `create_portal` in `ImixAgent`. - Exposed `create_portal` via `eldritch-libpivot`. - Updated `portal-stream` to support async writers. * Implement portal infrastructure in imixv2 - Added `portal-stream` dependency to `imixv2`. - Updated `Transport` trait to include `create_portal` (async). - Implemented `create_portal` in `grpc` transport. - Updated `Agent` trait to include `create_portal`. - Created `imixv2/src/portal/` module with TCP, UDP, and Bytes support using `portal-stream`. - Implemented `create_portal` in `ImixAgent`. - Exposed `create_portal` via `eldritch-libpivot`. - Updated `portal-stream` to support async writers. - Updated `run_create_portal` to send initial registration message. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * some changes * Add integration test * Added TRACE Bytes kind * added trace protos * Implement Trace Motes for Portals (#1473) * feat: implement end-to-end trace motes Implements application-level tracing for Portals infrastructure using the new `tracepb` definitions. * **CLI (`bin/socks5`)**: * Added `trace` subcommand to generate trace motes, send them to the server, and print a latency report. * Refactored `proxy.go` to support subcommands. * Added `addTraceEvent` helper for modifying trace motes. * **Server (`tavern`)**: * Instrumented `api_open_portal.go` and `api_create_portal.go` to inject trace events at key checkpoints (Recv, Pub, Sub, Send). * Created `trace_helper.go` to share event injection logic. * **Agent (`imixv2`)**: * Updated `run.rs` to intercept `BYTES_PAYLOAD_KIND_TRACE` motes. * Implemented logic to add `AGENT_RECV` and `AGENT_SEND` events and immediately echo the mote back. * added retry to trace --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com> * update flag to --portal * update buf size * Update portal API to send keepalive motes (#1472) - Added keepalive ticker to sendPortalInput loop in api_create_portal.go - Sends a BYTES_PAYLOAD_KIND_KEEPALIVE mote at regular intervals - Prevents connection timeouts similar to the reverse shell implementation Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com> * add tokio-console support for imixv2 * Fix SOCKS5 proxy cold start hang by avoiding BiLock on TcpStream (#1476) Replaced `tokio::io::split(stream)` with `stream.into_split()` in `implants/imixv2/src/portal/tcp.rs`. The former uses a `BiLock` which can cause deadlocks when the read and write halves are accessed concurrently in separate tasks, specifically causing the "cold start" hang where the initial payload might be blocked. `into_split()` returns owned halves that operate independently. Added a regression test `implants/imixv2/src/tests/repro_issue.rs` to verify the fix. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com> * socks proxy sends registration message now * socks5 trace must send registration message * Add E2E Portals Workflow and Playwright Test (#1478) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <Kcarretto@gmail.com> * cargo fmt * remove spammy log line * fix some tests * add create_portal fake impl * revert some changes to grpc.rs * remove grpc explicit sizes * update socks5 proxy to support auth and portals to support gcp pubsub * oops * minor cleanup * fix tests * Fix e2e workflow * use env var for auth * wait for socks to start before continuing * Add benchmark tests for cryptocodec (#1485) Added a new test file `tavern/internal/cryptocodec/cryptocodec_bench_test.go` to measure the throughput of `Encrypt` and `Decrypt` methods in `CryptoSvc`. Includes benchmarks for both encryption and decryption operations using standard payload sizes. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix race condition in TestPortalIntegration (#1487) The `TestPortalIntegration` test was flaky and often hung because the Agent would publish messages to the portal before the User had successfully subscribed to the output topic. This resulted in messages being dropped (as evidenced by "message sent to topic with no subscribers" warnings from the in-memory pubsub) and the User reader blocking indefinitely. This commit replaces the arbitrary `time.Sleep` with a deterministic synchronization mechanism. The User now sends a "ping" message to the Agent immediately after opening the portal. The Agent waits to receive this ping before proceeding. This ensures that the User's portal connection (and thus the underlying pubsub subscription) is fully established before the Agent attempts to send any data. This reduces test execution time and eliminates the race condition. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * fix proxy upstream address parsing * minor fixes & cleanup * fix collapsible if * cargo fmt * fix portal workflow * Add Tavern User Guide for Authentication and API Token (#1501) * Add documentation for TAVERN_API_TOKEN and portal auth flow This commit adds a new user guide page for Tavern (`docs/_docs/user-guide/tavern.md`) detailing the purpose of `TAVERN_API_TOKEN`. It clarifies the distinction between this token and the web OAuth token and explains the "portal auth flow" for users SSH'd into remote environments (e.g., Kali VMs) where standard auth port forwarding is not feasible. * Update TAVERN_API_TOKEN docs: remove non-existent Portal Auth Flow Per code review feedback, the "Portal Auth Flow" feature does not exist yet. This commit removes that section from the documentation, leaving the explanation of what the token is and when to use it (SSH scenarios). --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cleanup * Merge origin/main, resolve conflicts, and fix go generate (#1515) - Merged changes from origin/main, resolving conflicts in app.go, server.go, and mock transport. - Updated `golang.org/x/tools` to fix `ent` generation failure ("context without types"). - Re-ran `go generate ./...` to update generated protobuf and ent code. - Fixed compilation errors in tests due to renamed protobuf enum constants (ActiveTransport_TRANSPORT_HTTP1). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add offline filters (#1505) * feat(online-offline): Online Offline in progress * fix(online-offline): Change text * fix(query): Simplify query * fix(build): Build UI * fix(create-quest): Hide filter from create quest * Add Link entity and update CDN to use link-based file access (#1444) * Add Link entity and update CDN to use link-based file access This commit implements a new Link entity system for the CDN: - Add Link entity schema with: - path (unique, default UUIDv4) - active_before (timestamp, default epoch 0) - active_clicks (int, default 0) - edge to File entity (one-to-many relationship) - Update CDN upload handler to: - Create a new Link entity for each uploaded file - Return both file ID and link path in response - Add new CDN link download handler to: - Serve files using Link entity path instead of file name - Check active_clicks and active_before before serving - Decrement active_clicks when file is served - Return 404 if link is not active - Replace CDN route to use link-based downloads: - Changes /cdn/ endpoint from file name access to link path access - Removes ability to serve tome assets via direct file name - Maintains FetchAsset gRPC API for agent communication - Update dependencies: - Upgrade entgo.io/ent from v0.14.1 to v0.14.5 - Update related dependencies (atlas, sqlite3, tools) * go generate * Add mutations * Clarify docs * typeable random short string * Don't create link on upload * Resolve feedback --------- Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Squidli <32434695+cmp5987@users.noreply.github.com> Co-authored-by: Hulto <7121375+hulto@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>

Commit:7c4ba26
Author:KCarretto
Committer:hulto

added trace protos

Commit:8be6b91
Author:KCarretto
Committer:hulto

initial stubbing and renaming

Commit:af7a467
Author:KCarretto
Committer:hulto

both grpc endpoints

Commit:2a43322
Author:KCarretto
Committer:hulto

Added TRACE Bytes kind

Commit:c16a3c1
Author:Hulto
Committer:GitHub

Pb active transport (#1464) * Manual updates * go generated * Type * clippy isnt angry * todo * generate * Add extra field * Update docs. * Cleanup bad unwraps * Add extra to config and pass it through. * Fix proxy uri name. * Remove proxy_uri ref * Update docs. * Address PR review comments for active transport refactor (#1490) * Cleanup todos * go generate * fix e2e test * fmt

Commit:a900e0d
Author:KCarretto

added trace protos

Commit:43e7d8c
Author:KCarretto

Added TRACE Bytes kind

Commit:8745594
Author:KCarretto

both grpc endpoints

Commit:c6f6494
Author:hulto

Idk probably garbage

Commit:2a04f9d
Author:KCarretto

initial stubbing and renaming

Commit:7e89ba7
Author:google-labs-jules[bot]
Committer:GitHub

Implement portal stream package with OrderedReader/Writer (#1461) This change introduces a new `stream` package in `tavern/internal/portal/stream` to handle sequenced payload delivery for the Portal service. Key components: - `PayloadSequencer`: Manages atomic sequence IDs for payloads. - `OrderedWriter`: Wraps a sender to attach sequence IDs to outgoing payloads. - `OrderedReader`: Buffers out-of-order messages, detects duplicates, and handles stale streams with a timeout mechanism. - `portal.proto`: Added `seq_id` to `Payload` message. Coverage: 100% unit test coverage including happy paths, out-of-order delivery, duplicates, buffer limits, and timeouts. Fixed a bug in `OrderedReader` where the stale timer was reset incorrectly during nested gap scenarios. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>

Commit:a3580d1
Author:KCarretto

tests pass...

Commit:07c61dc
Author:KCarretto

create_portal

Commit:a006cb6
Author:KCarretto

implemented portals

Commit:d24629b
Author:KCarretto

okay it works?

Commit:3c61bbc
Author:KaliPatriot
Committer:GitHub

1019: Dns transport support (#1139) * DNS transport 🔥 * Add unit tests * Fixed DNS resolver to use local system resolver * fmt, fixed more hardcoded values * updated to dns protobuf * working, thanks ai! * fix * update to support new transport ent * more updates * fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt fmt * added dns to imixv2 * line endings ? * more line endings * missed transport in schema * Line endings * debug assertions, constant for dns buf size, move docs section

Commit:a5bbfc1
Author:Hulto
Committer:GitHub

Add transport type to agent config and ent (#1324) * Add transport to schema

Commit:5492530
Author:hulto

stash

Commit:a41c71b
Author:google-labs-jules[bot]

feat: Integrate HostContext and Data Marshalling for Eldritch VM - Created `eldritch-hostcontext` crate defining the strict interface via Protobuf and a synchronous Rust trait. - Implemented robust data marshalling in `eldritch-core/src/host_conversion/` to convert between dynamic Eldritch `Value`s and typed Host requests/responses. - Updated `eldritch-core` Interpreter and Environment to propagate `Arc<dyn HostContext>`. - Added comprehensive property-based tests in `eldritch-core/tests/marshalling_test.rs` to ensure safe conversion logic. - Configured `no_std` support for `eldritch-hostcontext` and `eldritch-core`.

Commit:e2ea39b
Author:KCarretto
Committer:GitHub

[Fix] Remediate all lint warnings (#1013) * Fix all lint warnings * hm

Commit:490a778
Author:Joe Abbate
Committer:Joe Abbate

Log OS Version for Hosts

Commit:a437f50
Author:KCarretto
Committer:GitHub

[feature] Reverse Shells (#699) * lots of progress * it's getting close :eyes: * ws kinda work, still having gRPC issues: * one step forward * it works but looks terrible * improve order * fixed ordering * built UI * needs polish but we're getting there * 1sec, moving devcontainers * more progress and features, need to fix golang concurrency issues * cleanup and fix close behaviour * needs tests but have fun kids * linguist-generated=true for www/build * fixed comments * fix tests * docs * fix test unrelated to anything im doing >:( * edges and active user tracking * edges and active user tracking * ** * build ** * fix edge

The documentation is generated from this commit.

Commit:41dabe4
Author:KCarretto
Committer:GitHub

[feature] Refactor Concurrency (#599) * Introduces eldritch::runtime::Message and associated message types for communication between the caller and an eldritch runtime (on separate threads) * Fixes a bug where imix would leave open an established connection (forever) * Fixes some Tavern issues * Adds a small rate limit to imix, to prevent overloading SQLlite (1req/25ms) * Implements a file.report API for sending files to tavern * Removes dependency on #[async-trait] * Adds a mock for transports * Documentation for our report library * Move protobufs to `pb` crate * Move `Transport` and `GRPC` to `transport` crate * Fix misc issues with our proto definitions for the reporting APIs

Commit:f0ae9e2
Author:KCarretto
Committer:GitHub

[bug] Fix Credential Kind Enum (#597) * fix bug with credential kind enum * fix graphql type names

Commit:b9155d1
Author:KCarretto

fix bug with credential kind enum

Commit:88fcaa4
Author:KCarretto
Committer:GitHub

[feature] Credential Reporting (#585) * added dropAllData admin mutation * added credential API * added report.user_password() eldritch method * added report.ssh_key() eldritch method --------- Co-authored-by: Hulto <7121375+hulto@users.noreply.github.com>

Commit:bfd1eb9
Author:KCarretto
Committer:GitHub

[feature] Eldritch & Imix Refactor (#509) * Refactors eldritch, introduces `eldritch::Runtime` * Refactors imix, introduces `imix::Agent` and `imix::Config` * Refactors our protobufs, creating new `eldritch` package for language specific types

Commit:66b48bf
Author:KCarretto
Committer:GitHub

[feature] Eldritch & Imix Refactor (#509) * Refactors eldritch, introduces `eldritch::Runtime` * Refactors imix, introduces `imix::Agent` and `imix::Config` * Refactors our protobufs, creating new `eldritch` package for language specific types

Commit:f5b8f2c
Author:KCarretto
Committer:GitHub

[feature] Structured Reporting - Files (#496) * update protobufs * Use c2pb enum on process ent, rename to HostProcess, add fields * Migrate to c2pb for Host_Platform enum * Fix enums, added tests * Added ReportFile gRPC API * Generate Rust Bindings * minor cleanup

Commit:7fd5b31
Author:KCarretto
Committer:GitHub

[feature] Structured Reporting - Files (#496) * update protobufs * Use c2pb enum on process ent, rename to HostProcess, add fields * Migrate to c2pb for Host_Platform enum * Fix enums, added tests * Added ReportFile gRPC API * Generate Rust Bindings * minor cleanup

Commit:75fd936
Author:KCarretto
Committer:GitHub

[feature] Structured Reporting - Process (#466) * generated entgo * Added API * Generated c2 lib rust bindings

Commit:0de1203
Author:KCarretto
Committer:GitHub

[feature] Structured Reporting - Process (#466) * generated entgo * Added API * Generated c2 lib rust bindings

Commit:3306759
Author:KCarretto
Committer:GitHub

[feature] Include quest name on gRPC task (#453) * include quest name on gRPC task * fix imix tests

Commit:cc3dd04
Author:KCarretto
Committer:GitHub

[feature] Include quest name on gRPC task (#453) * include quest name on gRPC task * fix imix tests

Commit:40b9907
Author:KCarretto
Committer:GitHub

[feature] Refactor ClaimTasks, include Tome File Names (#448) * Refactor ClaimTasks, include BundleName * bundle_name --> file_names * Fix nit * Build rust code * Fix imix test failures

Commit:b100d02
Author:KCarretto
Committer:GitHub

[feature] Refactor ClaimTasks, include Tome File Names (#448) * Refactor ClaimTasks, include BundleName * bundle_name --> file_names * Fix nit * Build rust code * Fix imix test failures

Commit:1b8bf51
Author:KCarretto
Committer:GitHub

[feature] gRPC File Download API (#447) * created gRPC file download API * regenerate entgo * remove hash parameter, use gRPC headers instead * generate rust gRPC bindings * Updated documentation * Rename header to sha3-256-checksum

Commit:659b39d
Author:KCarretto
Committer:GitHub

[feature] gRPC File Download API (#447) * created gRPC file download API * regenerate entgo * remove hash parameter, use gRPC headers instead * generate rust gRPC bindings * Updated documentation * Rename header to sha3-256-checksum

Commit:c0b59bf
Author:KCarretto
Committer:GitHub

[bug] Fix int overflow (#386) * Fix int overflow * fix agent types * debug=false

Commit:fe41827
Author:KCarretto
Committer:GitHub

[bug] Fix int overflow (#386) * Fix int overflow * fix agent types * debug=false

Commit:0bbd7ca
Author:KCarretto
Committer:GitHub

[feature] gRPC (#380) * refactoring endpoints * refactor http setup * Updated release.sh to set Tavern version * began implementing server * some more implementation * fix issues, add testing * Working on rust client * it might work ¯\_(ツ)_/¯ * it works, but im not happy about it * some cleanup, fix agent crash if no connection available * attempt to fix some codegen * log warning if protos aren't compiled * Fix build.rs * enable http2 * Use name as task.id * disable debug mode for imix: * rm dead code * remove dead code, update which version * Add some gRPC docs * move build dependencies to workspace dependencies

Commit:34acc08
Author:KCarretto
Committer:GitHub

[feature] gRPC (#380) * refactoring endpoints * refactor http setup * Updated release.sh to set Tavern version * began implementing server * some more implementation * fix issues, add testing * Working on rust client * it might work ¯\_(ツ)_/¯ * it works, but im not happy about it * some cleanup, fix agent crash if no connection available * attempt to fix some codegen * log warning if protos aren't compiled * Fix build.rs * enable http2 * Use name as task.id * disable debug mode for imix: * rm dead code * remove dead code, update which version * Add some gRPC docs * move build dependencies to workspace dependencies