우당탕탕 개발일지
[Linux] OverTheWire Lv0 ~ Lv10 본문
https://overthewire.org/wargames/bandit/bandit0.html
Lv0
ssh bandit0@bandit.labs.overthewire.org -p 2220
bandit0 ##pw
ls
cat readme
## NH2SXQwcBdpmTEzi3bvBHMM9H66vVXjL
Lv 1
ssh bandit1@bandit.labs.overthewire.org -p 2220
NH2SXQwcBdpmTEzi3bvBHMM9H66vVXjL
ls
cat ./-
## rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi
Lv2
ssh bandit2@bandit.labs.overthewire.org -p 2220
rRGizSaX8Mk1RTb1CNQoXTcYZWU6lgzi
ls
cat spaces\ in\ this\ filename
##aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG
Lv3
ssh bandit3@bandit.labs.overthewire.org -p 2220
aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG
ls -al
cd inhere
ls -al
cat ./.hidden
##2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe
Lv4 : File 명령어 // 파일의 type을 알 수 있다
ssh bandit4@bandit.labs.overthewire.org -p 2220
2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe
cd inhere
ls -al
file ./-file* ##file 명령어는 file의 타입을 알려준다.
cat ./-file07
## lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR
Lv 5 : Find 명령어 / 상세한 조건으로 데이터를 검색하고 싶을때 사용한다.
ssh bandit5@bandit.labs.overthewire.org -p 2220
lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR
cd inhere
find --help ## help 검색가능
find -readable ! -executable -size 1033c
cat ./maybehere07/.file2
##P4L4vucdmLnm8I7Vl7jG1ApGSfjYKqJU
https://www.tecmint.com/35-practical-examples-of-linux-find-command/
Find에 대한 자세한 설명을 시간날때 찾아보도록 하자.
lv6
Find 명령어 중, -user 과 -group 옵션에 대한 문제이다. 또한 ~ 경로에는 파일이 없으므로, 검색 경로를 / 로 설정한다.
find / -size 33c -user bandit7 -group bandit6 2>/dev/null
##z7WtoNQU2XfjmMtWA8u5rN4vzqu4v99S
맨 뒤의 2>/dev/null 부분 없이 실행해보면 PermissionDenied 된 파일들이 너무 많아서, 원하는 값을 찾기가 쉽지 않다. 이 부분을 제거하기 위해 붙이는 명령어이다. 오류가 발생한 것들은 /dev/null 로 보내라는 의미이다.
grep "Permission" 은 정상적으로 작동하지 않는데 , grep 명령어를 실행하기 전에 에러가 발생하기 떄문이다.
lv7.
grep 명령어에 대한 문제이다.
cat data.txt | grep "millionth'
##TESKZC0XvTetK0S9xNwm25STk5iWrBvP
lv8
sort 와 uniq 명령어에 대한 문제이다. 처음에는 uniq -u 만 사용했는데 정상적으로 작동하지 않았다. 알고보니, uniq 명령어는 데이터가 정렬되어있어야 정상적으로 작동한다. 그래서 sort와 함께 쓰이는것이 보통이다.
cat data.txt | sort | uniq -u
##EN632PlfYiZbn3PhVK3XOGSlNInNE00t
sort 와 uniq 에 많은 옵션이 있으니, 익혀두면 좋을것같다.
https://websecurity.tistory.com/80
lv9.
strings 명령어에 대한 문제이다. 주어진 내용에서 문자열만 추출해서 출력하는 명령어이다.
strings data.txt | grep '=='
## G7w8LIi6J3kTb8A7j9LgrywtEUlyyp6s
문제에서 여러개의 = 로 시작한다고 하였기 때문에 grep을 이용해 필터링해주었다.
lv10
base64 명령어에 대한 문제이다. base64 인코딩/디코딩을 수행할 수 있다. 이 문제에서는 base64 로 인코딩 되어있다 하였으므로, 디코딩을 해주면된다.
base64 -d data.txt
## 6zPeziLdR2RKNdNYFNb6nVCKzphlXHBM
다음문제는 아래 링크!
'Linux' 카테고리의 다른 글
[Linux] OverTheWire Lv21~ Lv33 (1) | 2024.03.21 |
---|---|
[Linux] OverTheWire Lv11~ Lv20 (0) | 2024.03.19 |
[Kali] Docker 에 kali linux 설치하기 (0) | 2024.03.15 |