Skip to content
Open

Del v1 #1631

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .github/workflows/e2e-portals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 8000

- name: 🤖 Build & Run Agent
working-directory: implants/imixv2
working-directory: implants/imix
env:
IMIX_CALLBACK_URI: "http://localhost:8000"
IMIX_CALLBACK_INTERVAL: 1
Expand All @@ -70,10 +70,10 @@ jobs:
export IMIX_SERVER_PUBKEY=$PUBKEY
echo "Got pubkey: $IMIX_SERVER_PUBKEY"

echo "Building imixv2..."
cargo build --bin imixv2 --target-dir ./build
echo "Building imix..."
cargo build --bin imix --target-dir ./build
# Run agent and pipe logs to a file
./build/debug/imixv2 > agent.log 2>&1 &
./build/debug/imix > agent.log 2>&1 &

# Give the agent a moment to perform the initial handshake
echo "Agent started. Waiting for initial callback..."
Expand Down Expand Up @@ -158,4 +158,4 @@ jobs:
name: e2e-portal-logs
path: |
tavern.log
implants/imixv2/agent.log
implants/imix/agent.log
10 changes: 5 additions & 5 deletions .github/workflows/e2e-repl-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# Wait for port 8000
timeout 30 sh -c 'until nc -z $0 $1; do sleep 1; done' localhost 8000
- name: 🤖 Run Agent
working-directory: implants/imixv2
working-directory: implants/imix
env:
IMIX_CALLBACK_URI: "http://localhost:8000"
IMIX_CALLBACK_INTERVAL: 1
Expand All @@ -66,10 +66,10 @@ jobs:
export IMIX_SERVER_PUBKEY=$PUBKEY
echo "Got pubkey: $IMIX_SERVER_PUBKEY"

echo "Building imixv2..."
cargo build --bin imixv2 --target-dir ./build
echo "Building imix..."
cargo build --bin imix --target-dir ./build
# Run agent and pipe logs to a file
./build/debug/imixv2 > agent.log 2>&1 &
./build/debug/imix > agent.log 2>&1 &

# Give the agent a moment to perform the initial handshake
echo "Agent started. Waiting for initial callback..."
Expand All @@ -90,4 +90,4 @@ jobs:
name: e2e-logs
path: |
tavern.log
implants/imixv2/agent.log
implants/imix/agent.log
2 changes: 1 addition & 1 deletion bin/reflective_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The reflective loader gets automatically compiled
# By the eldritch `build.rs` file. There's some differences
# in how to build the loader with `gnu` and `msvc`. If you're
# curious chekc out `realm/implants/lib/eldritch/build.rs`
# curious check out `realm/implants/lib/eldritch/build.rs`
#

[package]
Expand Down
109 changes: 42 additions & 67 deletions docs/_docs/dev-guide/eldritch.md

Large diffs are not rendered by default.

55 changes: 19 additions & 36 deletions docs/_docs/dev-guide/imix.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ Once you've finished making your changes apply these changes across the project

To generate the associated agent proto's use cargo build in the `implants` directory. This will copy the necessary protos from tavern and perform the code generation.

In addition to config syncronization claimTasks also authorizes the agent to access assets, and report data using a signed JWT per task. This prevents unauthorized users from reading tavern data, or spamming DB writes.


### Adding enums

Add your enum type to the `*.proto` file under the message type that will use it.
For example:
```
message ActiveTransport {
message Transport {
string uri = 1;
uint64 interval = 2;

Expand Down Expand Up @@ -148,11 +151,11 @@ We've tried to make Imix super extensible for transport development. In fact, al

Realm currently includes three transport implementations:

- **`grpc`** - Default gRPC transport (with optional DoH support via `doh` feature)
- **`grpc`** - Default gRPC transport
- **`http1`** - HTTP/1.1 transport
- **`dns`** - DNS-based covert channel transport

**Note:** Only one transport may be selected at compile time. The build will fail if multiple transport features are enabled simultaneously.
_grpc & http1 both support doh and http proxy set through the extra argument_

### Creating a New Transport

Expand Down Expand Up @@ -256,16 +259,12 @@ pub enum ActiveTransport {
Http(http::HTTP),
#[cfg(feature = "dns")]
Dns(dns::DNS),
#[cfg(feature = "custom")]
Custom(custom::Custom), // <-- Add your transport here
#[cfg(feature = "mock")]
Mock(mock::MockTransport),
Empty,
}
```

**Note:** Multiple transport features can be enabled at compile time, and the enum will include all enabled variants. The actual transport used is determined at runtime based on the agent's configuration.

#### 2. Update Transport Library Dependencies

Add your new feature and any required dependencies to `realm/implants/lib/transport/Cargo.toml`:
Expand All @@ -275,9 +274,9 @@ Add your new feature and any required dependencies to `realm/implants/lib/transp

[features]
default = []
grpc = []
grpc = ["pb/grpc"]
doh = ["dep:hickory-resolver"]
http1 = []
http1 = ["pb/http1"]
dns = ["dep:base32", "dep:rand", "dep:hickory-resolver", "dep:url"]
custom = ["dep:your-custom-dependency"] # <-- Add your feature here
mock = ["dep:mockall"]
Expand All @@ -286,48 +285,32 @@ mock = ["dep:mockall"]
# ... existing dependencies ...

# Add any dependencies needed by your transport
your-custom-dependency = { version = "1.0", optional = true }
your-custom-dependency = { workspace = true, optional = true }

# more stuff below
```


#### 3. Enable Your Transport in Imix

To use your new transport, update the imix Cargo.toml at `realm/implants/imix/Cargo.toml`:

```toml
# more stuff above
Add a proxy for your feature to `realm/implants/imix/Cargo.toml`

```toml
[features]
# Check if compiled by imix
win_service = []
default = ["transport/grpc"] # Default transport
default = ["install", "grpc", "http1", "dns", "doh", "custom"]
grpc = ["transport/grpc"]
http1 = ["transport/http1"]
dns = ["transport/dns"]
custom = ["transport/custom"] # <-- Add your feature here
transport-doh = ["transport/doh"]

# more stuff below
doh = ["transport/doh"]
custom = ["transport/custom"]
```

#### 4. Build Imix with Your Transport

Compile imix with your custom transport:

```bash
# From the repository root
cd implants/imix

# Build with your transport feature
cargo build --release --features custom --no-default-features

# Or for the default transport (grpc)
cargo build --release
```
**Note:** By default all transports are enabled by default but for advanced use cases they can be disabled via feature flags

**Important:** Only specify one transport feature at a time. The build will fail if multiple transport features are enabled. Ensure you include `--no-default-features` when building with a non-default transport.

#### 5. Set Up the Corresponding Redirector
#### 4. Set Up the Corresponding Redirector

For your agent to communicate, you'll need to implement a corresponding redirector in Tavern. See the redirector implementations in `tavern/internal/redirectors/` for examples:

Expand All @@ -337,4 +320,4 @@ For your agent to communicate, you'll need to implement a corresponding redirect

Your redirector must implement the `Redirector` interface and register itself in the redirector registry. See `tavern/internal/redirectors/redirector.go` for the interface definition.

And that's all that is needed for Imix to use a new Transport! The agent code automatically uses whichever transport is enabled at compile time via the `ActiveTransport` type alias.
And that's all that is needed for Imix to use a new Transport!
16 changes: 8 additions & 8 deletions docs/_docs/user-guide/eldritch.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,38 +124,38 @@ for user_home_dir in file.list("/home/"):

## Agent

### agent._terminate_this_process_clowntown (V2-Only)
### agent._terminate_this_process_clowntown

`agent._terminate_this_process_clowntown() -> None`

> [!CAUTION]
> **DANGER**: The **agent._terminate_this_process_clowntown** method terminates the agent process immediately by calling `std::process::exit(0)`. This effectively kills the agent and should be used with extreme caution. This function does not return as the process exits.

### agent.get_config (V2-Only)
### agent.get_config

`agent.get_config() -> Dict<str, Value>`

The **agent.get_config** method returns the current configuration of the agent as a dictionary containing configuration keys and values. This method will error if the configuration cannot be retrieved.

### agent.get_transport (V2-Only)
### agent.get_transport

`agent.get_transport() -> str`

The **agent.get_transport** method returns the name of the currently active transport (e.g., "http", "grpc").

### agent.list_transports (V2-Only)
### agent.list_transports

`agent.list_transports() -> List<str>`

The **agent.list_transports** method returns a list of available transport names supported by the agent.

### agent.get_callback_interval (V2-Only)
### agent.get_callback_interval

`agent.get_callback_interval() -> int`

The **agent.get_callback_interval** method returns the current callback interval in seconds.

### agent.list_tasks (V2-Only)
### agent.list_tasks

`agent.list_tasks() -> List<Dict>`

Expand All @@ -166,7 +166,7 @@ The **agent.list_tasks** method returns a list of dictionaries representing the
[{"id": 42949672964, "quest_name": "The Nightmare of the Netherworld Nexus"}]
```

### agent.stop_task (V2-Only)
### agent.stop_task

`agent.stop_task(task_id: int) -> None`

Expand Down Expand Up @@ -455,7 +455,7 @@ The <b>file.moveto</b> method moves a file or directory from `src` to `dst`. If

The <b>file.parent_dir</b> method returns the parent directory of a give path. Eg `/etc/ssh/sshd_config` -> `/etc/ssh`

### file.pwd (V2-Only)
### file.pwd

`file.pwd() -> Option<str>`

Expand Down
75 changes: 35 additions & 40 deletions implants/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,62 +1,57 @@
[workspace]
members = [
"imix",
"imixv2",
"golem",
"golemv2",
"lib/eldritch",
"lib/transport",
"lib/pb",
"lib/host_unique",
"lib/netstat",
"lib/eldritchv2/eldritch-core",
"lib/eldritchv2/eldritch-macros",
"lib/eldritchv2/eldritch-repl",
"lib/eldritchv2/eldritch-agent",
"lib/eldritchv2/stdlib/eldritch-libagent",
"lib/eldritchv2/stdlib/eldritch-libassets",
"lib/eldritchv2/stdlib/eldritch-libcrypto",
"lib/eldritchv2/stdlib/eldritch-libfile",
"lib/eldritchv2/stdlib/eldritch-libhttp",
"lib/eldritchv2/stdlib/eldritch-libpivot",
"lib/eldritchv2/stdlib/eldritch-libprocess",
"lib/eldritchv2/stdlib/eldritch-librandom",
"lib/eldritchv2/stdlib/eldritch-libregex",
"lib/eldritchv2/stdlib/eldritch-libreport",
"lib/eldritchv2/stdlib/eldritch-libsys",
"lib/eldritchv2/stdlib/eldritch-libtime",
"lib/eldritchv2/stdlib/tests",
"lib/eldritchv2/stdlib/migration",
"lib/eldritchv2/eldritchv2",
"lib/eldritch/eldritch-core",
"lib/eldritch/eldritch-macros",
"lib/eldritch/eldritch-repl",
"lib/eldritch/eldritch-agent",
"lib/eldritch/stdlib/eldritch-libagent",
"lib/eldritch/stdlib/eldritch-libassets",
"lib/eldritch/stdlib/eldritch-libcrypto",
"lib/eldritch/stdlib/eldritch-libfile",
"lib/eldritch/stdlib/eldritch-libhttp",
"lib/eldritch/stdlib/eldritch-libpivot",
"lib/eldritch/stdlib/eldritch-libprocess",
"lib/eldritch/stdlib/eldritch-librandom",
"lib/eldritch/stdlib/eldritch-libregex",
"lib/eldritch/stdlib/eldritch-libreport",
"lib/eldritch/stdlib/eldritch-libsys",
"lib/eldritch/stdlib/eldritch-libtime",
"lib/eldritch/stdlib/tests",
"lib/eldritch/eldritch",
"lib/portals/portal-stream",
]
resolver = "2"

[workspace.dependencies]
transport = { path = "./lib/transport" }
eldritch = { path = "./lib/eldritch" }
host_unique = { path = "./lib/host_unique" }
pb = { path = "./lib/pb" }
netstat = { path = "./lib/netstat" }

# Eldritch V2
eldritch-core = {path = "lib/eldritchv2/eldritch-core", default-features = false }
eldritch-macros = {path = "lib/eldritchv2/eldritch-macros", default-features = false}
eldritch-repl = {path = "lib/eldritchv2/eldritch-repl", default-features = false}
eldritchv2 = {path = "lib/eldritchv2/eldritchv2", default-features = false}
eldritch-agent = {path = "lib/eldritchv2/eldritch-agent"}
eldritch-libagent = {path = "lib/eldritchv2/stdlib/eldritch-libagent", default-features = false}
eldritch-libassets = {path = "lib/eldritchv2/stdlib/eldritch-libassets", default-features = false}
eldritch-libcrypto = {path = "lib/eldritchv2/stdlib/eldritch-libcrypto",default-features = false }
eldritch-libfile = {path = "lib/eldritchv2/stdlib/eldritch-libfile",default-features = false }
eldritch-libhttp = {path = "lib/eldritchv2/stdlib/eldritch-libhttp",default-features = false }
eldritch-libpivot = {path = "lib/eldritchv2/stdlib/eldritch-libpivot",default-features = false }
eldritch-libprocess = {path = "lib/eldritchv2/stdlib/eldritch-libprocess",default-features = false }
eldritch-librandom = {path = "lib/eldritchv2/stdlib/eldritch-librandom", default-features = false }
eldritch-libregex = {path = "lib/eldritchv2/stdlib/eldritch-libregex",default-features = false }
eldritch-libreport = {path = "lib/eldritchv2/stdlib/eldritch-libreport",default-features = false }
eldritch-libsys = {path = "lib/eldritchv2/stdlib/eldritch-libsys",default-features = false }
eldritch-libtime = {path = "lib/eldritchv2/stdlib/eldritch-libtime",default-features = false }
eldritch-core = {path = "lib/eldritch/eldritch-core", default-features = false }
eldritch-macros = {path = "lib/eldritch/eldritch-macros", default-features = false}
eldritch-repl = {path = "lib/eldritch/eldritch-repl", default-features = false}
eldritch = {path = "lib/eldritch/eldritch", default-features = false}
eldritch-agent = {path = "lib/eldritch/eldritch-agent"}
eldritch-libagent = {path = "lib/eldritch/stdlib/eldritch-libagent", default-features = false}
eldritch-libassets = {path = "lib/eldritch/stdlib/eldritch-libassets", default-features = false}
eldritch-libcrypto = {path = "lib/eldritch/stdlib/eldritch-libcrypto",default-features = false }
eldritch-libfile = {path = "lib/eldritch/stdlib/eldritch-libfile",default-features = false }
eldritch-libhttp = {path = "lib/eldritch/stdlib/eldritch-libhttp",default-features = false }
eldritch-libpivot = {path = "lib/eldritch/stdlib/eldritch-libpivot",default-features = false }
eldritch-libprocess = {path = "lib/eldritch/stdlib/eldritch-libprocess",default-features = false }
eldritch-librandom = {path = "lib/eldritch/stdlib/eldritch-librandom", default-features = false }
eldritch-libregex = {path = "lib/eldritch/stdlib/eldritch-libregex",default-features = false }
eldritch-libreport = {path = "lib/eldritch/stdlib/eldritch-libreport",default-features = false }
eldritch-libsys = {path = "lib/eldritch/stdlib/eldritch-libsys",default-features = false }
eldritch-libtime = {path = "lib/eldritch/stdlib/eldritch-libtime",default-features = false }
portal-stream = { path = "lib/portals/portal-stream" }

aes = "0.8.3"
Expand Down
6 changes: 0 additions & 6 deletions implants/golem/.gitignore

This file was deleted.

Loading
Loading