diff --git a/evaluation_examples/examples/os/5812b315-e7bd-4265-b51f-863c02174c28.json b/evaluation_examples/examples/os/5812b315-e7bd-4265-b51f-863c02174c28.json index 0f5446e..162d0f4 100644 --- a/evaluation_examples/examples/os/5812b315-e7bd-4265-b51f-863c02174c28.json +++ b/evaluation_examples/examples/os/5812b315-e7bd-4265-b51f-863c02174c28.json @@ -1,13 +1,13 @@ { "id": "5812b315-e7bd-4265-b51f-863c02174c28", "snapshot": "os", - "instruction": "Please create an SSH user named \"charles\" with password \"Ex@mpleP@55w0rd!\" on Ubuntu who is only allowed to access the folder \"test1\".", + "instruction": "Please create an SSH user named \"charles\" with password \"Ex@mpleP@55w0rd!\" on Ubuntu who is only allowed to access the folder \"/home/test1\".", "source": "https://superuser.com/questions/149404/create-an-ssh-user-who-only-has-permission-to-access-specific-folders", "config": [ { "type": "execute", "parameters": { - "command": "mkdir /test1", + "command": "mkdir /home/test1", "shell": true } } @@ -17,16 +17,47 @@ "os" ], "evaluator": { - "func": "exact_match", + "postconfig": [ + { + "type": "execute", + "parameters": { + "command": "echo 'password' | sudo -S apt-get install -y expect", + "shell": true + } + }, + { + "type": "download", + "parameters": { + "files": [ + { + "url": "https://drive.usercontent.google.com/download?id=1lOkekinDJRPBqmQN4Xx6pV4WO2uSwKln&export=download&authuser=0&confirm=t&uuid=52b722f4-ec9e-40a1-9b4f-02cb4c5d6b5b&at=APZUnTVY8y0fxhsUBPuc4zC250kv:1707208254033", + "path": "check_password.sh" + } + ] + } + }, + { + "type": "execute", + "parameters": { + "command": "chmod +x check_password.sh", + "shell": true + } + } + ], + "func": "check_include_exclude", "result": { "type": "vm_command_line", - "command": "[[ $(getent passwd charles) && $(getent passwd charles | cut -d: -f6) = \"/test1\" ]] && echo \"User charles exists and has /test1 as their home directory\" || echo \"User charles does not exist or doesn't have /test1 as their home directory\"", + "command": "USERNAME=\"charles\"; HOMEDIR=\"/home/test1\"; PASSWORD=\"Ex@mpleP@55w0rd!\"; ./check_password.sh \"$USERNAME\" \"$PASSWORD\" && [ \"$(getent passwd \"$USERNAME\" | cut -d: -f6)\" = \"$HOMEDIR\" ] && [ $(stat -c \"%A\" \"$HOMEDIR\" | cut -b 3) = \"w\" ] && echo \"Password, home directory, and write permission check passed\" || echo \"Check failed\"", "shell": true }, "expected": { "type": "rule", - "rules":{ - "expected": "User charles exists and has /test1 as their home directory" + "rules": { + "include": [ + "Password, home directory, and write permission check passed" + ], + "exclude": [ + ] } } } diff --git a/evaluation_examples/examples/os/cc9d4f34-1ca0-4a1b-8ff2-09302696acb9.json b/evaluation_examples/examples/os/cc9d4f34-1ca0-4a1b-8ff2-09302696acb9.json index f1ff95a..7f37e6d 100644 --- a/evaluation_examples/examples/os/cc9d4f34-1ca0-4a1b-8ff2-09302696acb9.json +++ b/evaluation_examples/examples/os/cc9d4f34-1ca0-4a1b-8ff2-09302696acb9.json @@ -17,17 +17,29 @@ "os" ], "evaluator": { - "func": "exact_match", + "postconfig": [ + { + "type": "sleep", + "parameters": { + "seconds": 5 + } + } + ], + "func": "check_include_exclude", "result": { "type": "vm_command_line", - "command": "[[ -z $(ps -ef | grep -v grep | grep my_process) ]] && echo \"Process killed\" || echo \"Process still running\"", + "command": "ps -ef | grep my_process.sh", "shell": true }, "expected": { - "type": "rule", - "rules":{ - "expected": "Process killed" - } + "type": "rule", + "rules": { + "include": [ + ], + "exclude": [ + "/bin/sh ./my_process.sh" + ] } } + } } \ No newline at end of file