|
| 1 | +--- |
| 2 | +title: "[Linux] Bandit Study Write-Up (kredsya)" |
| 3 | +excerpt: "2025-1학기 Linux Bandit 스터디 Write-Up" |
| 4 | +author: kredsya |
| 5 | +categories: |
| 6 | + - study |
| 7 | +tags: |
| 8 | + - [linux, bandit] |
| 9 | +date: 2025-03-31 |
| 10 | +last_modified_at: 2025-03-31 |
| 11 | +--- |
| 12 | + |
| 13 | +# Level 0 → Level 4 |
| 14 | + |
| 15 | +## Level 0 |
| 16 | + |
| 17 | +### Goal |
| 18 | + |
| 19 | +SSH로 접속. |
| 20 | + |
| 21 | +### Solve |
| 22 | + |
| 23 | +| host name | user name | password | port | |
| 24 | +|---|---|---|---| |
| 25 | +| bandit.labs.overthewire.org | bandit0 | bandit0 | 2220 | |
| 26 | + |
| 27 | +```shell |
| 28 | + |
| 29 | + _ _ _ _ |
| 30 | + | |__ __ _ _ __ __| (_) |_ |
| 31 | + | '_ \ / _` | '_ \ / _` | | __| |
| 32 | + | |_) | (_| | | | | (_| | | |_ |
| 33 | + |_.__/ \__,_|_| |_|\__,_|_|\__| |
| 34 | +
|
| 35 | +
|
| 36 | + This is an OverTheWire game server. |
| 37 | + More information on http://www.overthewire.org/wargames |
| 38 | +
|
| 39 | +[email protected]'s password: [<- 여기에 bandit0 입력] |
| 40 | +``` |
| 41 | +
|
| 42 | +### Digression |
| 43 | +
|
| 44 | +`-p` 옵션과 포트 넘버를 띄어쓰기로 구분할 필요가 없고, destination보다 앞인지 뒤인지도 상관이 없다. |
| 45 | +```shell |
| 46 | + |
| 47 | +``` |
| 48 | +
|
| 49 | +## Level 0 → Level 1 |
| 50 | +
|
| 51 | +### Goal |
| 52 | +
|
| 53 | +home directory `bandit0@bandit:~$`의 readme 읽기기. |
| 54 | +
|
| 55 | +### Solve |
| 56 | +
|
| 57 | +password는 마스킹 처리했습니다. |
| 58 | +
|
| 59 | +```shell |
| 60 | +bandit0@bandit:~$ ll |
| 61 | +total 24 |
| 62 | +drwxr-xr-x 2 root root 4096 Sep 19 2024 ./ |
| 63 | +drwxr-xr-x 70 root root 4096 Sep 19 2024 ../ |
| 64 | +-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout |
| 65 | +-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc |
| 66 | +-rw-r--r-- 1 root root 807 Mar 31 2024 .profile |
| 67 | +-rw-r----- 1 bandit1 bandit0 438 Sep 19 2024 readme |
| 68 | +bandit0@bandit:~$ cat readme |
| 69 | +Congratulations on your first steps into the bandit game!! |
| 70 | +Please make sure you have read the rules at https://overthewire.org/rules/ |
| 71 | +If you are following a course, workshop, walkthrough or other educational activity, |
| 72 | +please inform the instructor about the rules as well and encourage them to |
| 73 | +contribute to the OverTheWire community so we can keep these games free! |
| 74 | +
|
| 75 | +The password you are looking for is: ******************************** |
| 76 | +
|
| 77 | +``` |
| 78 | +
|
| 79 | +### Digression |
| 80 | +
|
| 81 | +`ll`은 `ls -alF`의 약어로 디렉토리 내용을 보기 쉽게 만들어준다. |
| 82 | +
|
| 83 | +## Level 1 → Level 2 |
| 84 | +
|
| 85 | +### Goal |
| 86 | +
|
| 87 | +`-` 파일 읽기. |
| 88 | +
|
| 89 | +### Solve |
| 90 | +
|
| 91 | +```shell |
| 92 | +bandit1@bandit:~$ ls |
| 93 | +- |
| 94 | +bandit1@bandit:~$ cat ./- |
| 95 | +******************************** |
| 96 | +``` |
| 97 | +
|
| 98 | +### Digression |
| 99 | +
|
| 100 | +`.`는 현재 디렉토리를 의미한다. 그래서 `./-`는 `/home/bandit1/-`와 같은 표현이다. |
| 101 | +
|
| 102 | +## Level 2 → Level 3 |
| 103 | +
|
| 104 | +### Goal |
| 105 | +
|
| 106 | +파일 이름에 공백이 포함된 파일 읽기. |
| 107 | +
|
| 108 | +### Solve |
| 109 | +
|
| 110 | +```shell |
| 111 | +bandit2@bandit:~$ ll |
| 112 | +total 24 |
| 113 | +drwxr-xr-x 2 root root 4096 Sep 19 2024 ./ |
| 114 | +drwxr-xr-x 70 root root 4096 Sep 19 2024 ../ |
| 115 | +-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout |
| 116 | +-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc |
| 117 | +-rw-r--r-- 1 root root 807 Mar 31 2024 .profile |
| 118 | +-rw-r----- 1 bandit3 bandit2 33 Sep 19 2024 spaces in this filename |
| 119 | +bandit2@bandit:~$ cat spaces\ in\ this\ filename |
| 120 | +******************************** |
| 121 | +``` |
| 122 | +
|
| 123 | +### Digression |
| 124 | +
|
| 125 | +`\`는 escape character, 제어 문자로 보통 문자 출력을 제어한다. 그 예시로 `\n` line feed, `\r` carriage return 등이 있는데 문법과 겹쳐 출력할 수 없는 일부 특수문자를 출력하기 위해서 사용되기도 한다. `\"` 큰 따옴표 출력이 그 예시이고 공백도 출력할 수 있다. |
| 126 | +
|
| 127 | +## Level 3 → Level 4 |
| 128 | +
|
| 129 | +### Goal |
| 130 | +
|
| 131 | +`inhere` 디렉토리 안에 숨겨진 파일 읽기. |
| 132 | +
|
| 133 | +### Solve |
| 134 | +
|
| 135 | +```shell |
| 136 | +bandit3@bandit:~$ ls |
| 137 | +inhere |
| 138 | +bandit3@bandit:~$ ls -a inhere |
| 139 | +. .. ...Hiding-From-You |
| 140 | +bandit3@bandit:~$ cat inhere/...Hiding-From-You |
| 141 | +******************************** |
| 142 | +``` |
| 143 | +
|
| 144 | +### Digression |
| 145 | +
|
| 146 | +파일 이름이 `.`으로 시작하면 숨은 파일이 된다. `ls -a` 옵션으로 볼 수 있다. |
| 147 | +
|
| 148 | +`ll`은 `-a` 옵션이 포함되어 있으니 `ll` 사용해도 된다. |
0 commit comments