카테고리 없음

bandit 문제풀이

20308박동진 2022. 10. 6. 23:37

Level 0 → 1

문 : The password for the next level is stored in a file called readme located in the home directory. Use this password to log into bandit1 using SSH. Whenever you find a password for a level, use SSH (on port 2220) to log into that level and continue the game.

 

 : 다음 문제로 가는 패스워드는 readme라고 불리는 파일에있다.

 

cat readme로 읽어준다.

 

 

Level 1 → 2

문 : The password for the next level is stored in a file called - located in the home directory

 

: 다음문제로 가는 패스워드는 -파일에있다.

 

cat ./를 사용해서 현재로 이동한 다음 -를 써서 읽어주자. 

 

 

Level 2 → 3

문 : The password for the next level is stored in a file called spaces in this filename located in the home directory

 

: hidden file에 있다.

 

ls로 보니 spaces in this filename 경로에 있다.

귀찮으니 cat "spaces in this filename" 으로 한번에 들어가자

 

 

 

 

Level 3 → 4

문 : The password for the next level is stored in a hidden file in the inhere directory.

: inhere 디렉토리 안에있는 hidden file에 있다.

 

ls 로 찾아보니 inhere디렉토리가 있다. cd inhere로 들어간 후 ls -a를 써보니 .hidden이 나왔다.

 

Level 4 → 5

문 : The password for the next level is stored in the only human-readable file in the inhere directory.

Tip: if your terminal is messed up, try the “reset” command.

: inhere 안에 사람이 읽을 수 있는 그러니까 아스키코드로 되어있는 파일이 있다.

 

ls로  inhere를 찾고 ls -al로 file들을 찾아주고, file ./*를 사용해 아스키코드로 쓰여진 파일을 확인

Level 5 → 6

문 : The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:

  • human-readable
  • 1033 bytes in size
  • not executable

: 솔직히 읽자.. 힘드러 읽으면 이정도는 동시번역 되잖슴...

 

 

 

Level 6 → 7

문 : The password for the next level is stored somewhere on the server and has all of the following properties:

  • owned by user bandit7
  • owned by group bandit6
  • 33 bytes in size

 * /dev/null < 주기적으로 비워지는 공간이다. 

 

 

Level 7 → 8

문 : The password for the next level is stored in the file data.txt next to the word millionth

 

들어가기전에...

리다이렉션 (Redirection) 에 대해 알아봅시다.

- 명령의 출력을 변경할 수 있음

- 파일에 기록가능 

- 기존 파일의 내용을 삭제하고 새로 결과를 저장할 때는 >를, 기존 파일의 내용 뒤에 결과를 추가할 때는 >>를 사용

(

< / << : 입력 방향 재지정

> / >> : 출력 방향 재지정

> : 덮어씀

>> : 추가됨

)

 

각각 쉘에서 키보드로 명령을 입력받는 표준 입력(standard input, STDIN),

키보드로 입력 받은 명령의 실행결과를 모니터로 출력하는표준 출력(standard output, STDOUT),

표준 에러(standard error, STDERR)

가 있는데 각각의 순서대로 파일 디스크립터(file descriptor)는 0,1,2임

 

(표준 입력 *스트림은 입력을 위한 스트림이고, 표준 출력 스트림은 출력을 위한 스트림, 표준 에러 스트림은 에러메시지 출력을 위한 스트림입니다.)

 

*스트림: 유닉스 계열 운영체제에서 프로그램(프로세스)과 주변 기기 사이에 미리 연결된 입출력 통로.

.

.

.

.

.

.

다시 문제로 돌아가면

1. ls -al로 파일 찾아줌

2. grep :파일내에 특정 문자열을 찾아줌(-> grep "millionth" data.txt)