본문 바로가기
IT 및 정보보호 관련 소식&정보

Linux study_Over The Wire_bandit [01 : ls, cat, find -type ]

by 건행오 2020. 4. 16.
반응형

안녕하세요 은남입니다. :)

 

리눅스 공부차 포스팅합니다.

https://overthewire.org/wargames/bandit/

 

OverTheWire: Bandit

We're hackers, and we are good-looking. We are the 1%. Bandit The Bandit wargame is aimed at absolute beginners. It will teach the basics needed to be able to play other wargames. If you notice something essential is missing or have ideas for new levels, p

overthewire.org

 

The Bandit wargame is aimed at absolute beginners. It will teach the basics needed to be able to play other wargames. If you notice something essential is missing or have ideas for new levels, please let us know!

 

bandit은 윈도우를 쓰시던, 맥을 쓰시던 상관없이 해당 가상 호스트에 접근하여 이용이 가능한 wargame입니다. 제 경우에는 리눅스 및 보안 관련 취약점에 친숙해지기 위해서 시작을 해보게 되었습니다. 뭐 결국 리눅스에 친해지는 게 더 목적이긴 합니다.

총 level 33까지 있는데 하나하나 돌파해가면서 공부해본 것들을 남겨놓으려 합니다.ㅎㅎ


Bandit Level 0

Level Goal

The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0. Once logged in, go to the Level 1 page to find out how to beat Level 1.

 

유저는 bandit0   ssh로 접근해야 하는 서버는 bandit.labs.overthewire.org  포트는 2220

ssh bandit0@bandit.labs.overthewire.org -p 2220

ls : 현재 디렉터리에 있는 목록 출력

ls -a : 현재 디렉토리 내에 숨겨진 파일까지 출력

ls -alp : 현재 디렉터리에 있는 목록 및 숨겨진 파일, 권한, 소유자 등 상세 출력

cat 파일명 : 파일의 내용 출력

cat > 파일명 : 파일 내용 작성 후 저장(CTRL + D)

 

boJ9jbbUNNfktd78OOpsqOltutMc3MY1  를 복사해서 다음 단계로 갑니다.


Bandit Level 0 → Level 1

Level Goal

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.

 

다음 단계의 비밀번호는 home 디렉터리의 readme에 있으며 해당 패스워드로 bandit1 계정으로 ssh 접근하기


Bandit Level 1 → Level 2

Level Goal

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

 

home 디렉터리의 - 파일 내용을 열면 다음 패스워드를 확인 가능

CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9


Bandit Level 2 → Level 3

Level Goal

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

 

이번엔 파일명이 공백인 것 을 열어보라고 합니다.

cat ./space\ in\ this\ filename


Bandit Level 3 → Level 4

Level Goal

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

 

: inhere 폴더 내에 숨겨진 파일 열기

cat inhere/.hidden

pIwrPrtPN36QITSp3EQaw936yaFoFgAB

 


Bandit Level 4 → Level 5

Level Goal

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 디렉터리 내 사람이 읽을 수 있는 파일을 읽으면 패스워드가 있답니다.

막 도전하다보니 두가지 방법으로 해봤습니다.

cat ./*

그랬더니 구분없이 막 출력되었습니다. 뭐 눈대중으로

koReBOKuIDDepwhWk7jZC0RTdopnAYKh

겠거니 했으나 다른 방법을 찾아서 해봤습니다.

find . -type f | xargs file

ASCII 코드로 된 타입을 분류하여 확인하였습니다.

find 명령어를 사용하였는데요 옵션 정보는 다음과 같습니다.

 

-type : 지정된 파일 타입에 해당하는 파일 검색 옵션 임

추가적으로....

-name : 지정된 문자열 패턴에 해당하는 파일 검색.

-empty : 빈 디렉토리 또는 크기가 0인 파일 검색.

-delete : 검색된 파일 또는 디렉토리 삭제.

-exec : 검색된 파일에 대해 지정된 명령 실행.

-path : 지정된 문자열 패턴에 해당하는 경로에서 검색.

-print : 검색 결과를 출력. 검색 항목은 newline으로 구분. (기본 값)

-print0 : 검색 결과를 출력. 검색 항목은 null로 구분.

-size : 파일 크기를 사용하여 파일 검색.

-mindepth : 검색을 시작할 하위 디렉토리 최소 깊이 지정.

-maxdepth : 검색할 하위 디렉토리의 최대 깊이 지정.

-atime : 파일 접근(access) 시각을 기준으로 파일 검색.

-ctime : 파일 내용 및 속성 변경(change) 시각을 기준으로 파일 검색.

-mtime : 파일의 데이터 수정(modify) 시각을 기준으로 파일 검색.

반응형

댓글