인터넷을 끄적이다가 bandit
라는거를 발견했다.
뭔가 linux를 처음 공부하는 사람들을 위한 리눅스와 친숙해지는?? 그런 프로그램인 듯 하다.
$ ssh -p 2220 bandit0@bandit.labs.overthewire.org
Passwd : bandit0
$ cat readme
$PASSWD
$ ssh -p 2220 bandit1@bandit.labs.overthewire.org
Passwd : $PASSWD
파일 이름이 -
으로 설정되어 있다. cat -
커맨드로는 옵션이랑 섞여가지구 확인이 안되겠지,,,,
이런 함정이라니 생각보다 재밌는거 같다.
$ cat ~/-
$PASSWD
$ ssh -p 2220 bandit2@bandit.labs.overthewire.org
Passwd : $PASSWD
다음은 파일 명에 공백이 있는경우이다. 공백을 \를 이용해 표현하거나, 따옴표를 이용해 하는 방법 2가지가 있을 거 같다.
$ cat spaces\ in\ this\ filename
$PASSWD
$ cat 'spaces in this filename'
$PASSWD
$ ssh -p 2220 bandit3@bandit.labs.overthewire.org
Passwd : $PASSWD
파일명이 .로 시작하는 경우. 리눅스에서는 이러한 파일들이 ls 명령어로는 보이지 않는다. ls -alh
로 파일명 확인 후, cat 찍어버리면 된다.
$ ls -alh inhere/
total 12K
drwxr-xr-x 2 root root 4.0K Apr 23 18:04 .
drwxr-xr-x 3 root root 4.0K Apr 23 18:04 ..
-rw-r----- 1 bandit4 bandit3 33 Apr 23 18:04 .hidden
$ cat inhere/.hidden
$PASSWD
$ ssh -p 2220 bandit4@bandit.labs.overthewire.org
Passwd : $PASSWD
폴더 안에 사람이 읽을 수 있는 파일에 정답이 있다고 한다. cat으로 찍어보는것도 방법이지만, 대충 file 찍으면 보일 거 같아서 찍어봤더니 바로 보인다.
$ file ./inhere/*
./inhere/-file00: data
./inhere/-file01: data
./inhere/-file02: data
./inhere/-file03: data
./inhere/-file04: data
./inhere/-file05: data
./inhere/-file06: data
./inhere/-file07: ASCII text
./inhere/-file08: data
./inhere/-file09: Non-ISO extended-ASCII text, with no line terminators
$ cat ./inhere/-file07
$PASSWD
$ ssh -p 2220 bandit5@bandit.labs.overthewire.org
Passwd : $PASSWD
여기서 잠깐 흠칫 했다. 디렉토리 안에 디렉토리가 있고, 그 안에 파일 중
human-readable
1033 bytes in size
not executable
한 친구를 찾으라길래 자연스럽게
$ ls -al inhere/*/* | grep 1033
$
으로 찾으려고 했는데, 나오지 않았다. 그래서 find로 찾아야 하나 해서 찾아보니 바로 나오더라
$ find inhere/ -size 1033c
inhere/maybehere07/.file2
숨김파일이라서 와일드카드로 안찾아졌고, 그래서 grep으로도 안잡힌 듯 하다.
$ cat inhere/maybehere07/.file2
$PASSWD
$ ssh -p 2220 bandit6@bandit.labs.overthewire.org
Passwd : $PASSWD