Skip to content

CruxC2 Shell Interface

Haoying Cao (aka Brian Cao) edited this page Sep 22, 2025 · 2 revisions

Once a CruxAgent connects to the CruxServer, the CruxServer will present its operator with the CruxC2 Shell interface.

The CruxC2 shell prompt provides information on:

  • Username
  • Target Hostname
  • Target IP Address
CRUX|brian@rx-93-nu|127.0.0.1:46910|$

By default, Crux commands will be interpreted as single-line shell commands, which means special shell symbols such as IO redirection and piping works.

CRUX|brian@rx-93-nu|127.0.0.1:46910|$ echo "Hello World"
Hello World

CRUX|brian@rx-93-nu|127.0.0.1:46910|$ echo "Hello World" | base64
SGVsbG8gV29ybGQK

Crux Shell also implements readline functionalities, allowing operators to edit commands and cycle through previous commands.

Shell and Environment Variables

Shell variables are created, stored and interpreted inside the shell session. It would not be passed onto the client, or persist across shell sessions.

To create a shell variable, use the setvar command:

setvar <variable_name>=<variable_value>

Environment variables are stored and interpreted on the target the CruxAgent is running on. To create a shell variable, use the export command:

export <variable_name>=<variable_value>

Both variables can be referenced using $VAR or ${VAR} inside all other commands:

CRUX|brian@rx-93-nu|127.0.0.1:46910|$ setvar a="Hello"
CRUX|brian@rx-93-nu|127.0.0.1:46910|$ export b="World"

CRUX|brian@rx-93-nu|127.0.0.1:46910|$ echo "$a, ${b}"
Hello, World

When a shell variable and an environment variable both have the same name, the shell variable take precedent over environment variable.

CRUX|brian@rx-93-nu|127.0.0.1:46904|$ setvar a="Hello"
CRUX|brian@rx-93-nu|127.0.0.1:46904|$ export b="World"

CRUX|brian@rx-93-nu|127.0.0.1:46904|$ setvar b="Brian"
CRUX|brian@rx-93-nu|127.0.0.1:46904|$ echo "$a, $b"
Hello, Brian

Other Special Commands:

lhost prints out the address and port of the operator machine, while rhost prints out the address and port of the target machine.

CRUX|brian@rx-93-nu|127.0.0.1:33580|$ lhost
127.0.0.1:1337
CRUX|brian@rx-93-nu|127.0.0.1:33580|$ rhost
127.0.0.1:33580

File download and upload feature are still under construction.

To kill the current shell session, use exit or quit.

CRUX|brian@rx-93-nu|127.0.0.1:33580|$ exit
Agent 0 exiting!

After exiting, CruxServer will return listening to new incoming connections. To kill CruxServer at this point, simply CTRL+C.

Clone this wiki locally