Kiosk #3: Linux Primer
This kiosk was a pretty basic linux primer in which you find all of the lollipops stolen by munchkins by using linux commands to unearth them. It was located in the rear courtyard, right next to the Santa Shop "Point-Of-Sale Password Recovery" Objective:
-
Perform a directory Listing of your home directory to find a munchkin and retrieve a lollipop!
ls
-
Now find the munchkin inside the munchkin.
cat munchkin_19315479765589239
-
Great, now remove teh munchkin in your home directory.
rm ./munchkin_19315479765589239
-
Print the present working directory using a command.
pwd
-
Good job but it looks like another munchkin hid itself in you home directory. Find the hidden munchkin!
ls -la
-
Excellent, now find the munchkin in your command history.
history
-
Find the munchkin in your environment variables.
env
-
Next, head into the workshop.
cd workshop
-
A munchkin is hiding in one of the workshop toolboxes. Use "Grep" while ignoring case to find which toolbox the munchkin is in.
elf@17ddbb161cae:~/workshop$ grep -i munchkin *
grep: electrical: Is a directory
toolbox_191.txt:mUnChKin.4056180441832623
- A munchkin is blocking the lollipop_engine from starting. Run the lollipop_engine binary to retrieve this munchkin.
elf@17ddbb161cae:~$ find / -name lollipop_engine 2>/dev/null
/opt/lollipop_engine
/home/elf/workshop/lollipop_engine
elf@17ddbb161cae:~$ ./workshop/lollipop_engine
bash: ./workshop/lollipop_engine: Permission denied
elf@17ddbb161cae:~$ chmod +x ./workshop/lollipop_engine
elf@17ddbb161cae:~$ ./workshop/lollipop_engine
munchkin.898906189498077
- Munchkins have blown the fuses in /home/elf/workshop/electrical. cd into electrical and rename blown_fuse0 to fuse0.
elf@17ddbb161cae:~$ cd workshop/electrical/
elf@17ddbb161cae:~/workshop/electrical$ ls
blown_fuse0
elf@17ddbb161cae:~/workshop/electrical$ mv blown_fuse0 fuse0
-
Now, make a symbolic link (symlink) named fuse1 that points to fuse0.
ln -s fuse0 fuse1
-
Make a copy of fuse1 named fuse2.
cp fuse1 fuse2
-
We need to make sure munchkins don't come back. Add the characters "MUNCHKIN_REPELLENT" into the file fuse2.
echo "MUNCHKIN_REPELLENT" > fuse2
-
Find the munchkin somewhere in /opt/munchkin_den.
elf@17ddbb161cae:/opt/munchkin_den$ find . -iname \*munchkin\*
./apps/showcase/src/main/resources/mUnChKin.6253159819943018
- Find the file somewhere in /opt/munchkin_den that is owned by the user munchkin.
elf@17ddbb161cae:/opt/munchkin_den$ find . -user munchkin
./apps/showcase/src/main/resources/template/ajaxErrorContainers/niKhCnUm_9528909612014411
- Find the file created by munchkins that is greater than 108 kilobytes and ss than 110 kilobytes located somewhere in /opt/munchkin_den
elf@17ddbb161cae:/opt/munchkin_den$ find . -type f -size +108k -size -110k
./plugins/portlet-mocks/src/test/java/org/apache/m_u_n_c_h_k_i_n_2579728047101724
- List running processes to find another munchkin.
elf@17ddbb161cae:/opt/munchkin_den$ ps -ef
UID PID PPID C STIME TTY TIME CMD
init 1 0 0 21:17 pts/0 00:00:00 /usr/bin/python3 /usr/local/bin/tmuxp load ./mysession.yaml
elf 27976 27973 1 21:35 pts/2 00:00:00 /usr/bin/python3 /14516_munchkin
elf 28630 1244 0 21:35 pts/3 00:00:00 ps -ef
- 14516_munchkin process is listening on a tcp port. Use a command to have the only listening port display to the screen.
elf@17ddbb161cae:/opt/munchkin_den$ netstat -lenpt
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:54321 0.0.0.0:* LISTEN 1051 408570374 27976/python3
- The service listening on port 54321 is an HTTP server. Interact with this server to retrieve the last munchkin.
elf@17ddbb161cae:/opt/munchkin_den$ curl http://localhost:54321 && echo
munchkin.73180338045875
- Your final task is to stop the 14516_munchkin process to collect the remaining lollipops.
elf@17ddbb161cae:/opt/munchkin_den$ ps aux | grep 14516_munchkin
elf 27976 0.0 0.0 160448 26884 pts/2 S+ 21:35 0:00 /usr/bin/python3 /14516_munchkin
elf 52345 0.0 0.0 13240 1104 pts/3 S+ 21:49 0:00 grep --color=auto 14516_munchkin
elf@17ddbb161cae:/opt/munchkin_den$ kill -9 27976
Got all of the lollipops!