quinta-feira, 5 de fevereiro de 2015

OvertheWire - Bandit - Parte 1


O objetivo deste artigo é demonstrar passo a passo o que tem que ser feito no game.

No segunda parte do artifgo estarei explicando um a um e como chegar na logico, lembrando que a importância do MANno linux para este tipo de Game é fundamental.

O foco deste é aprofundar os conhecimentos em Bash.

Level 0

ssh -p 22 -l bandit0 bandit.labs.overthewire.org

bandit0@melinda:~$ ls
readme
bandit0@melinda:~$ cat readme 
boJ9jbbUNNfktd78OOpsqOltutMc3MY1


Level 0 ==> 1 

ssh -p 22 -l bandit1 bandit.labs.overthewire.org

Level 1 ==> 2

bandit1@melinda:~$ ls -las
total 24
4 -rw-r-----   1 bandit2 bandit1   33 Jun  6  2013 -
4 drwxr-xr-x   2 root    root    4096 Jun  6  2013 .
4 drwxr-xr-x 160 root    root    4096 Oct 17 09:23 ..
4 -rw-r--r--   1 root    root     220 Apr  3  2012 .bash_logout
4 -rw-r--r--   1 root    root    3486 Apr  3  2012 .bashrc
4 -rw-r--r--   1 root    root     675 Apr  3  2012 .profile
bandit1@melinda:~$ cat ./-
CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9
bandit1@melinda:~$


Level 2 ==> 3

bandit2@melinda:~$ ls -las
total 24
4 drwxr-xr-x   2 root    root    4096 Jun  6  2013 .
4 drwxr-xr-x 160 root    root    4096 Oct 17 09:23 ..
4 -rw-r--r--   1 root    root     220 Apr  3  2012 .bash_logout
4 -rw-r--r--   1 root    root    3486 Apr  3  2012 .bashrc
4 -rw-r--r--   1 root    root     675 Apr  3  2012 .profile
4 -rw-r-----   1 bandit3 bandit2   33 Jun  6  2013 spaces in this filename
bandit2@melinda:~$ cat spaces\ in\ this\ filename
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK


Level 3 ==> 4


bandit3@melinda:~$ ls -lsas
total 24
4 drwxr-xr-x   3 root root 4096 Jun  6  2013 .
4 drwxr-xr-x 160 root root 4096 Oct 17 09:23 ..
4 -rw-r--r--   1 root root  220 Apr  3  2012 .bash_logout
4 -rw-r--r--   1 root root 3486 Apr  3  2012 .bashrc
4 -rw-r--r--   1 root root  675 Apr  3  2012 .profile
4 drwxr-xr-x   2 root root 4096 Jun  6  2013 inhere
bandit3@melinda:~$ cd inhere/
bandit3@melinda:~/inhere$ ls -las
total 12
4 drwxr-xr-x 2 root    root    4096 Jun  6  2013 .
4 drwxr-xr-x 3 root    root    4096 Jun  6  2013 ..
4 -rw-r----- 1 bandit4 bandit3   33 Jun  6  2013 .hidden
bandit3@melinda:~/inhere$ cat .hidden
pIwrPrtPN36QITSp3EQaw936yaFoFgAB


Level 4 ==> 5

bandit4@melinda:~/inhere$ ls -h 
-file00  -file01  -file02  -file03  -file04  -file05  -file06  -file07  -file08  -file09
bandit4@melinda:~/inhere$ for f in ./*; do cat $f; done;
?S?U??1?&?????ɦ?7??n?|???/?$?Q?J
??NO2???s??=\?1?OF???
4?<?o?l?????՚?~{b?W?$?s<??~(????Å?8??b
                                      dhz??c?
                                             g7?!?x?Ӈ???Eo[??B?
                                                               ??&6]U?w޽RZ!N?o?h??)??'߳e?l??-p#?s???~?$???????<??Dj?N#C????0?|???T????G?@???koReBOKuIDDepwhWk7jZC0RTdopnAYKh
????dC?g?b?.<??"Q 2B????{????3S?~і?????|?M?^߮?-%ƌ
????"^??kUbandit4@melinda:~/inhere$ 


Level 5 ==> 6 

bandit5@melinda:~$ ls -las
total 24
4 drwxr-xr-x   3 root root    4096 Jun  6  2013 .
4 drwxr-xr-x 160 root root    4096 Oct 17 09:23 ..
4 -rw-r--r--   1 root root     220 Apr  3  2012 .bash_logout
4 -rw-r--r--   1 root root    3486 Apr  3  2012 .bashrc
4 -rw-r--r--   1 root root     675 Apr  3  2012 .profile
4 drwxr-x---  22 root bandit5 4096 Jun  6  2013 inhere
bandit5@melinda:~$ cd inhere/
bandit5@melinda:~/inhere$ find -readable -size 1033c ! -executable
./maybehere07/.file2
bandit5@melinda:~/inhere$ cat ./maybehere07/.file2
DXjZPULLxYr17uwoI01bNLQbtFemEgo7


Level 6 ==> 7

bandit6@melinda:~$ find / -size 33c -group bandit6 -user bandit7
find: `/var/www/natas/natas8': Permission denied
find: `/var/www/natas/natas2': Permission denied
find: `/var/lib/cron-apt/_-_etc_-_cron-apt_-_config': Permission denied
find: `/var/lib/sudo': Permission denied
find: `/var/lib/php5': Permission denied
find: `/var/lib/mysql': Permission denied
/var/lib/dpkg/info/bandit7.password
find: `/lost+found': Permission denied
find: `/run/shm': Permission denied

bandit6@melinda:~$ cat /var/lib/dpkg/info/bandit7.password
HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs


Level 7 ==> 8

bandit7@melinda:~$ ls -las
total 4112
   4 drwxr-xr-x   2 root    root       4096 Jun  6  2013 .
   4 drwxr-xr-x 160 root    root       4096 Oct 17 09:23 ..
   4 -rw-r--r--   1 root    root        220 Apr  3  2012 .bash_logout
   4 -rw-r--r--   1 root    root       3486 Apr  3  2012 .bashrc
   4 -rw-r--r--   1 root    root        675 Apr  3  2012 .profile
4092 -rw-r-----   1 bandit8 bandit7 4184396 Jun  6  2013 data.txt
bandit7@melinda:~$ cat data.txt |grep "millionth"
millionth    cvX2JJa4CFALtqS87jk27qwqGhBM9plV