diff --git a/exercise.py b/exercise.py index 340b5fd..63619fa 100644 --- a/exercise.py +++ b/exercise.py @@ -89,15 +89,20 @@ def restore_exercices_progress(): db.USER_ID_TO_AUTHKEY_MAPPING[int(user_id_str)] = authkey except: logger.info('Could not restore exercise progress') - db.EXERCISES_STATUS = {} - db.SELECTED_EXERCISES = [] - db.USER_ID_TO_EMAIL_MAPPING = {} - db.USER_ID_TO_AUTHKEY_MAPPING = {} + resetAll() if len(db.EXERCISES_STATUS) == 0: init_exercises_tasks() +def resetAll(): + db.EXERCISES_STATUS = {} + db.SELECTED_EXERCISES = [] + db.USER_ID_TO_EMAIL_MAPPING = {} + db.USER_ID_TO_AUTHKEY_MAPPING = {} + init_exercises_tasks() + + def is_validate_exercises(exercises: list) -> bool: exercises_uuid = set() tasks_uuid = set() @@ -222,6 +227,11 @@ def resetAllExerciseProgress(): backup_exercises_progress() +def resetAllCommand(): + resetAll() + backup_exercises_progress() + + def get_completed_tasks_for_user(user_id: int): completion = get_completion_for_users().get(user_id, {}) completed_tasks = {} diff --git a/exercises/ransomware-encoding.json b/exercises/ransomware-encoding.json index 1e6930a..7863538 100644 --- a/exercises/ransomware-encoding.json +++ b/exercises/ransomware-encoding.json @@ -54,8 +54,7 @@ "followed_by": [ "3e61a340-0314-4622-91cc-042f3ff8543a" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -66,7 +65,7 @@ "inject_uuid": "3e61a340-0314-4622-91cc-042f3ff8543a", "reporting_callback": [], "requirements": { - "inject_uuid": "8f636640-e4f0-4ffb-abff-4e85597aa1bd" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ @@ -76,8 +75,7 @@ "followed_by": [ "8a2d58c8-2b3a-4ba2-bb77-15bcfa704828" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -88,7 +86,7 @@ "inject_uuid": "8a2d58c8-2b3a-4ba2-bb77-15bcfa704828", "reporting_callback": [], "requirements": { - "inject_uuid": "3e61a340-0314-4622-91cc-042f3ff8543a" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ @@ -98,8 +96,7 @@ "followed_by": [ "9df13cc8-b61b-4c9f-a1a8-66def8b64439" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -110,7 +107,7 @@ "inject_uuid": "9df13cc8-b61b-4c9f-a1a8-66def8b64439", "reporting_callback": [], "requirements": { - "inject_uuid": "8a2d58c8-2b3a-4ba2-bb77-15bcfa704828" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ @@ -120,8 +117,7 @@ "followed_by": [ "c5c03af1-7ef3-44e7-819a-6c4fd402148a" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -132,7 +128,7 @@ "inject_uuid": "c5c03af1-7ef3-44e7-819a-6c4fd402148a", "reporting_callback": [], "requirements": { - "inject_uuid": "9df13cc8-b61b-4c9f-a1a8-66def8b64439" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ @@ -142,8 +138,7 @@ "followed_by": [ "11f6f0c2-8813-42ee-a312-136649d3f077" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -154,7 +149,7 @@ "inject_uuid": "11f6f0c2-8813-42ee-a312-136649d3f077", "reporting_callback": [], "requirements": { - "inject_uuid": "c5c03af1-7ef3-44e7-819a-6c4fd402148a" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ @@ -164,8 +159,7 @@ "followed_by": [ "e3ef4e5f-454a-48c8-a5d7-b3d1d25ecc9f" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null @@ -176,23 +170,21 @@ "inject_uuid": "e3ef4e5f-454a-48c8-a5d7-b3d1d25ecc9f", "reporting_callback": [], "requirements": { - "inject_uuid": "11f6f0c2-8813-42ee-a312-136649d3f077" + "inject_uuid": "8e8dbda2-0f5e-4101-83ff-63c1ddda2cae" }, "sequence": { "completion_trigger": [ "time_expiration", "completion" ], - "trigger": [ - ] + "trigger": [] }, "timing": { "triggered_at": null } } ], - "inject_payloads": [ - ], + "inject_payloads": [], "injects": [ { "action": "event-creation", @@ -210,8 +202,7 @@ ], "result": "MISP Event created", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -248,8 +239,7 @@ ], "result": "Infection Email added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -285,8 +275,7 @@ ], "result": "Malicious payload added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -322,8 +311,7 @@ ], "result": "C2 IP added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -352,15 +340,14 @@ "extract_type": "all", "comparison": "contains-regex", "values": [ - "HKCU.+SOFTWARE.+CryptoLocker.*" + "HKCU.+SOFTWARE.+CryptoLocker.*" ] } } ], "result": "Registry key added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -389,15 +376,14 @@ "extract_type": "all", "comparison": "contains-regex", "values": [ - "-----BEGIN PUBLIC KEY-----.*" + "-----BEGIN PUBLIC KEY-----.*" ] } } ], "result": "Public key added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -433,8 +419,7 @@ ], "result": "Context added", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -469,8 +454,7 @@ ], "result": "Event published", "evaluation_strategy": "data_filtering", - "evaluation_context": { - }, + "evaluation_context": {}, "score_range": [ 0, 20 @@ -482,4 +466,4 @@ "uuid": "e3ef4e5f-454a-48c8-a5d7-b3d1d25ecc9f" } ] -} +} \ No newline at end of file diff --git a/server.py b/server.py index 32220b2..eea5681 100755 --- a/server.py +++ b/server.py @@ -118,6 +118,10 @@ async def mark_task_incomplete(sid, payload): async def reset_all_exercise_progress(sid): return exercise_model.resetAllExerciseProgress() +@sio.event +async def reset_all(sid): + return exercise_model.resetAllCommand() + @sio.event async def reset_notifications(sid): return notification_model.reset_notifications() diff --git a/src/components/TheAdminPanel.vue b/src/components/TheAdminPanel.vue index 5b4a685..0dd8a23 100644 --- a/src/components/TheAdminPanel.vue +++ b/src/components/TheAdminPanel.vue @@ -1,6 +1,6 @@