Linux Jedi Challenge

Categories:

Run

1docker run --rm -it public.ecr.aws/p5e0b0g4/kjpgit/linux-jedi-challenge:latest

Level 1

I created 22 bad files in your home directory (/root/). Delete them.
(The files are in the container, not in your real computer, don’t worry.)

Do NOT delete these files: a, b, c, db-backup, .ssh_config.

Solution

1find /root/ -type f -regextype posix-extended \
2  -not -regex '^[^/]*/(\.profile|\.bashrc|\.ssh_config|[abc]|db-backup)$' -delete

Level 2

I created 22 bad files in /level2/.
Some contain the word “virus” in their data, and the others contain “spam”.
Move the “virus” files to /level2/virus/, but don’t rename them.
Leave the “spam” files alone.

Solution

1grep -FZls 'virus' /level2/* | xargs -0 mv -t /level2/virus/