Skip to content

Commit

Permalink
Added examples/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Razvan committed Jun 14, 2019
1 parent 78ae381 commit 17b1df7
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/action_demo/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

Test Scenario: Action Demo
--------------------------

This directory is provided for test purposes, and we recommend running
the included training in order to understand the operation of
CyPROM. The command to be run is as follows (we assume execution from
the test scenario directory; program argument paths are relative to
the 'main/' directory):

$ ../../main/cyprom.py -s ../examples/action_demo

The training includes one scenario file that demonstrates the use of
action modules in CYPROM. All the scenario actions have as target the
machine 'server1'.

The included scenario file is "scenario.yml" with the following
outline. A message is displayed first, followed by a question. In case
the question is answered correctly, a final message is shown, and the
training session ends. Otherwise, an increasing number of hints is
displayed, so as to enable the participant to answer the question as
the training session continues.

In order to answer the question without a graphical interface,
commands such as the ones below can be used:

$ echo "wrong answer" | nc 127.0.0.1 10000
$ echo "wrong answer" | nc 127.0.0.1 10001
$ echo "correct answer" | nc 127.0.0.1 10002
32 changes: 32 additions & 0 deletions examples/action_demo/scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
scenario:
- step: Action 1 (message)
target: server1
action:
module: message
message: This training consists of a simple quiz.

- step: Action 2 (question)
target: server1
action:
module: question
question:
- What is the meaning of XSS?
- Please reply with all lower-case letters.
answer: cross-site scripting
success: Action 4 (message)

- step: Action 3 (hint)
target: server1
action:
module: hint
hint:
- "It's something about scripting."
- It also has to do with web sites.
- '"X" looks somehow like a cross.'
success: Action 2 (question)

- step: Action 4 (message)
target: server1
action:
module: message
message: Congratulations for completing the training!
41 changes: 41 additions & 0 deletions examples/attack_scoring/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

Test Scenario: Attack Scoring
-----------------------------

This directory is provided for test purposes, and we recommend running
the included training in order to understand the operation of
CyPROM. The command to be run is as follows (we assume execution from
the test scenario directory; program argument paths are relative to
the 'main/' directory):

$ ../../main/cyprom.py -s ../examples/attack_scoring

The training includes two scenario files, and when the activity
starts, one of them will be selected at random. The training activity
continues until both files are completed, according to the branching
logic of each file. All the scenario actions have as target the
machine 'server1', and the specified action module is 'test', which
will randomly returns SUCCESS or FAILURE.

The included scenario files are:

* scenario1.yml: A sequence of 2 attacks with the following branching
logic: (i) success of both of them leads to preserving the scenario
for repeated execution; (ii) failure of either of them leads to
finishing the scenario. This logic assumes that the training is done
for defense purposes, and if the attacks are successfull the
trainees should be given the opportunity to improve their defense
strategy.

* scenario2.yml: A set of three attacks with a similar branching logic
to that mentioned above.

For each attack, the participants' score is calculated as follows: (i)
in case of success, points are subtracted from the score (as penalty
for weak defense); (ii) in case of failure, points are added to it (as
reward for a good defense strategy). To analyze the performance of
each participant, we suggest generating the training reports using the
following command (the CSV file will be written in the 'main/'
directory, as 'Team A.csv', etc.):

$ ../../main/cyprom.py --report
21 changes: 21 additions & 0 deletions examples/attack_scoring/scenario1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
scenario:
- step: Attack 1.1
target: server1
action:
module: test
success:
points: -100
failure:
points: 200
next: FINISH

- step: Attack 1.2
target: server1
action:
module: test
success:
points: -50
next: REPEAT
failure:
points: 100
next: FINISH
31 changes: 31 additions & 0 deletions examples/attack_scoring/scenario2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
scenario:
- step: Attack 2.1
target: server1
action:
module: test
success:
points: -100
failure:
points: 200
next: FINISH

- step: Attack 2.2
target: server1
action:
module: test
success:
points: -50
failure:
points: 100
next: FINISH

- step: Attack 2.3
target: server1
action:
module: test
success:
points: -25
next: REPEAT
failure:
points: 50
next: FINISH
35 changes: 35 additions & 0 deletions examples/basic_logic/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Test Scenario: Basic Logic
--------------------------

This directory is provided for test purposes, and we recommend running
the included training in order to understand the operation of
CyPROM. The command to be run is as follows (we assume execution from
the test scenario directory):

$ ../../main/cyprom.py

NOTE: In case you have changed the default scenario directory in the
'config' file, use the following command (program argument paths are
relative to the 'main/' directory):

$ ../../main/cyprom.py -s ../examples/basic_logic

The training includes two scenario files, and when the activity
starts, the one called 'scenario.yml' (which is a predefined name)
will be selected first. The training activity continues until both
files are completed, according to the branching logic of each
scenario. All the scenario actions have as target the machine
'server1', and the specified action module is 'test', which will
randomly returns SUCCESS or FAILURE.

The included scenario files are:

* scenario.yml: A set of 2 actions with the following branching logic:
failure of the either of them leads to completing the training. This
logic assumes that both actions are mandatory and must be executed
successfully in order for the training to proceed (e.g., some
configuration actions).

* scenario2.yml: A set of 3 actions with a similar branching logic
to that mentioned above.
12 changes: 12 additions & 0 deletions examples/basic_logic/scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
scenario:
- step: Action 1.1
target: server1
action:
module: test
failure: COMPLETE

- step: Action 1.2
target: server1
action:
module: test
failure: COMPLETE
18 changes: 18 additions & 0 deletions examples/basic_logic/scenario2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
scenario:
- step: Action 2.1
target: server1
action:
module: test
failure: COMPLETE

- step: Action 2.2
target: server1
action:
module: test
failure: COMPLETE

- step: Action 2.3
target: server1
action:
module: test
failure: COMPLETE
11 changes: 11 additions & 0 deletions examples/target.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Team A]
server1 = 127.0.0.1
server2 = 127.0.0.1

[Team B]
server1 = 127.0.0.1
server2 = 127.0.0.1

[Team C]
server1 = 127.0.0.1
server2 = 127.0.0.1
31 changes: 31 additions & 0 deletions examples/trigger_demo/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Test Scenario: Trigger Demo
---------------------------

This directory is provided for test purposes, and we recommend running
the included training in order to understand the operation of
CyPROM. The command to be run is as follows (we assume execution from
the test scenario directory; program argument paths are relative to
the 'main/' directory):

$ ../../main/cyprom.py -s ../examples/test_triggers

The training includes one scenario file that demonstrates the use of
trigger modules in CYPROM. The training activity continues linearly
until the file is completed. All the scenario actions have as target
the machine 'server1', and the specified action module is 'test',
which will randomly returns SUCCESS or FAILURE.

The included scenario file is "scenario.yml" with the following
outline. A sequence of 2 actions is executed one after the other: (i)
the first action has a delayed execution by using the 'timer' trigger;
(ii) the second action execution is controlled externally via the
'signal' trigger.

In order to unblock the second action execution without a graphical
interface, commands such as the ones below can be used (the message
content is irrelevant in this case):

$ echo "SIGNAL" | nc 127.0.0.1 10000
$ echo "SIGNAL" | nc 127.0.0.1 10001
$ echo "SIGNAL" | nc 127.0.0.1 10002
16 changes: 16 additions & 0 deletions examples/trigger_demo/scenario.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
scenario:
- step: Action 1 (timer trigger)
target: server1
trigger:
module: timer
delay: 5
action:
module: test

- step: Action 2 (signal trigger)
target: server1
trigger:
module: signal
message: Signal received
action:
module: test

0 comments on commit 17b1df7

Please sign in to comment.