티스토리 뷰

Goal
The password for the next level is stored in the file data.txt and is the only line of text that occurs only once
다음 레벨의 패스워드는 `data.txt` 파일에 저장되어 있으며 단 한 번만 나타난다.
Commands you may need to solve this level
`grep`, `sort`, `uniq`, `strings`, `base64`, `tr`, `tar`, `gzip`, `bzip2`, `xxd`
Write Up
bandit8@bandit:~$ ls -al
total 56
drwxr-xr-x 2 root root 4096 Oct 5 2023 .
drwxr-xr-x 70 root root 4096 Oct 5 2023 ..
-rw-r--r-- 1 root root 220 Jan 6 2022 .bash_logout
-rw-r--r-- 1 root root 3771 Jan 6 2022 .bashrc
-rw-r----- 1 bandit9 bandit8 33033 Oct 5 2023 data.txt
-rw-r--r-- 1 root root 807 Jan 6 2022 .profile
bandit8@bandit:~$ file data.txt
data.txt: ASCII text
bandit8@bandit:~$ head data.txt
kjIuqjobFBhKw9Mmfj2wAnWbXB2VxSfv
5Y76FifuxKStZi4CVovF2uPhgLrZnLzG
AiYd84lOOVTA4gqJPX7f6DH8eG3zwq1W
A16BW831T94qcsYcGDSkgzYhxnX2xUdK
vlsSKqk3yVx2PZxIkBuZPR3KKIf8hGi1
cEqNrEqHVIIi9fQKdcvAxaip1brmsSxT
FQIgwPiuPKftkFhIy9Nzm94sWdNGTlHd
P8jd7Kr8GXVKTLhe1Y7cVYAARwh4lN4A
`data.txt`는 ASCII text 파일이므로 `sort` 커맨드와 `uniq` 커맨드 이용해 정렬하고 중복을 제거할 수 있다. `sort`의 `--unique` 옵션은 연속적으로 중복된 값만 제거할 수 있으므로 정렬의 결과를 `uniq` 커맨드로 넘겨 출력한다.
bandit8@bandit:~$ cat data.txt | sort | uniq -c
`-c` 옵션으로 중복 횟수를 카운트해서 출력할 수 있다. 파일 사이즈가 크면 `grep` 커맨드를 추가로 호출해 필요한 라인만 출력할 수 있다.
bandit8@bandit:~$ cat data.txt | sort | uniq -c | grep "1\ "'Wargame > Bandit' 카테고리의 다른 글
| Bandit Level 10 → Level 11 (0) | 2024.05.16 |
|---|---|
| Bandit Level 9 → Level 10 (0) | 2024.05.16 |
| Bandit Level 7 → Level 8 (0) | 2024.05.16 |
| Bandit Level 6 → Level 7 (0) | 2024.05.16 |
| Bandit Level 5 → Level 6 (0) | 2024.05.16 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- opengraph
- Dreamhack
- PS
- sqli
- CSRF
- SEO
- Spring Security
- linux
- math
- Framework
- oauth2
- WEB
- java
- XSS
- JPA
- Spring
- test
- Database
- Transaction
- WarGame
- Misc
- Bandit
- 회고
- askers
- DP
- sql injection
- React
- webgoat
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
글 보관함