Skip to content

Commit

Permalink
Forgotten tool to corrupt sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hook25 committed Feb 4, 2025
1 parent 52c32af commit 9f97fdd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Empty file.
24 changes: 24 additions & 0 deletions metabox/metabox/tools/session_corruptor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import gzip
import json

from pathlib import Path


def corrupt(path):
with gzip.open(str(path)) as f:
session = json.load(f)
session["session"]["desired_job_list"].append(
"@ invalid id - intentionally corrupted session"
)
with gzip.open(str(path), "wt") as f:
json.dump(session, f)


def main():
for session in Path("/var/tmp/checkbox-ng/sessions").glob("*/session"):
print("Corrupting session", str(session))
corrupt(session)


if __name__ == "__main__":
main()

0 comments on commit 9f97fdd

Please sign in to comment.