Skip to content

Execution example

Now, we will walk through a simple attack scenario execution.

In case you need a testing environment or an advanced example, feel free to use the playground.

Prerequisites

It is assumed that you've followed the quick-start guide.

Create a plan template

The first step to run an automated attack is to create its description - template.

We will be using this example.
It describes an attack scenario with 2 steps (actions). First, it scans the target host and checks if SSH (port 22) is open. If it's open, it checks if the provided credentials are correct.

Download the template
curl -O https://gitlab.ics.muni.cz/cryton/cryton/-/raw/stable/2/examples/basic-example/template.yml
wget https://gitlab.ics.muni.cz/cryton/cryton/-/raw/stable/2/examples/basic-example/template.yml

Validate the template first

Before we upload the template, we should validate it. However, for our template to be validated correctly, we have to provide an inventory file, which is described here. Once we have it, we can simply run:

cryton-cli plans validate template.yml -i inventory.yml

Example
cryton-cli plans validate template.yml -i inventory.yml

Expected output:

Plan successfully validated! (<response>)

If we are satisfied with our template, we can upload it using CLI:

cryton-cli plan-templates create path/to/template.yml

Example
cryton-cli plan-templates create template.yml

Expected output:

Template successfully created! ({'id': 1})

Create a Plan instance

Now we need to create a Plan instance we will use for the attack. Create it using a combination of the previously uploaded template and an inventory file which is used to fill the missing variables in our template.
The inventory file can be found here.

Download the inventory file
curl -O https://gitlab.ics.muni.cz/cryton/cryton/-/raw/stable/2/examples/basic-example/inventory.yml
wget https://gitlab.ics.muni.cz/cryton/cryton/-/raw/stable/2/examples/basic-example/inventory.yml

To create a new Plan instance use:

cryton-cli plans create <TEMPLATE_ID> -i path/to/my/inventory.yml

Example
cryton-cli plans create 1 -i inventory.yml

Expected output:

Plan Instance successfully created! ({'id': 1})

Register the Worker

To be able to run the scenario, we need to register an existing Worker. Keep in mind that WORKER_NAME must match the Worker’s CRYTON_WORKER_NAME setting:

cryton-cli workers create <WORKER_NAME> -d <WORKER_DESCRIPTION>

Example
cryton-cli workers create local_worker -d "my worker on localhost"

Expected output:

Worker successfully created! ({'id': 1})

To check if the Worker is running, run a health check:

cryton-cli workers health-check <WORKER_ID>

Example
cryton-cli workers health-check 1

Expected output:

The Worker successfully checked! (<response>)

Create a Run

Finally, we create a new Run using the previously created Plan instance and Worker:

cryton-cli runs create <PLAN_INSTANCE_ID> <WORKER_ID>

Example
cryton-cli runs create 1 1

Expected output:

Run successfully created! ({'id': 1})

Execute the Run

It works... but at what cost?

Before you proceed, make sure that you are allowed to scan and brute-force the selected target. Otherwise, there may be consequences.

Now that everything is prepared, we can execute our Run immediately or schedule it for later.

To execute the Run immediately:

cryton-cli runs execute <RUN_ID>
Example
cryton-cli runs execute 1

Expected output:

Run successfully executed! (Run 1 was executed.)

Run executions can be scheduled to a specific date and time. By default, the system timezone will be used. To use the UTC timezone, use the --utc-timezone flag.

cryton-cli runs schedule <RUN_ID> <DATE> <TIME>

Example
cryton-cli runs schedule 1 2020-06-08 10:00:00

Expected output:

Run successfully scheduled! (Run 1 is scheduled for 2020-06-08 10:00:00.)

Show Run information

Check Run's state and other useful information:

cryton-cli runs show <RUN_ID>

Example
cryton-cli runs show 1

Expected output:

id: 1, schedule_time: None, start_time: 2021-05-24T00:08:45.200025, pause_time: None, finish_time: 2021-05-24T00:09:18.397199, state: RUNNING

Get a report

Get a report of your Run and its results anytime during its execution:

cryton-cli runs report <RUN_ID>

Example
cryton-cli runs report 1

Expected output:

Successfully created Run's report! (file saved at: /tmp/report_run_1_2020-06-08-10-15-00-257994_xdQeV)

Read the report directly

Reports can be viewed directly in cryton-cli (to quit, press Q):

cryton-cli runs report <RUN_ID> --less

Example
cryton-cli runs report 1 --less