OverTheWire: Level Goal: Bandit Level 2 → Level 3

2022. 4. 10. 06:11·OS/LINUX

[ Bandit Level 2 → Level 3 문제 리뷰 ]


Bandit Level 2 → Level 3

레벨 목표

 

다음 레벨의 password는 home 디렉토리의 spaces in this filename 이라는 파일에 저장되어 있습니다.

 

이 문제를 풀기 위해 필요할 수도 있는 명령어들

 

ls, cd, cat, file, du, find


 

문제 해설

(1) 파일명에 공백이 포함된 파일을 읽는 법

spaces in this filename이라는 파일을 읽기 위해 

cat spaces in this filename

을 입력한다면 아래와 같이 실행될 것이다.

이렇게 실행이 되는 이유는 띄어쓰기를 할 때마다 다른 파일로 인식을 하기 때문이다.

cat 은 여러 파일의 내용을 한 번에 출력시키기도 가능하다.

그래서 "cat spaces in this filename"을cat [파일명] [파일명] [파일명] 처럼 인식을 한 것이다.

 

 

① 해결책 1 : 공백을 문자로 인식시키기

리눅스는 \를 특수문자 뒤에 입력하면 '문자'로 인식한다. 

이렇게 백슬래시를 공백 앞에 써넣음으로써 해결할 수 있다.

 

② 해결책 2 : 자동 완성 시키기

"cat spaces"까지 입력 후 tab키를 눌러 자동 완성 시킬 수 있다.

자동 완성을 시키면 저절로 \가 띄어쓰기 앞에 붙는다.

 

③ 해결책 3 : 따옴표 사용하기

"를 파일명 앞 뒤에 붙여 문자열로 인식시킬 수 있다.

 

 

위의 방법들을 이용해 파일 내용을 조회하면

UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

가 Level 3으로 가는 password임을 알 수 있다.

 


Level 3 → Level 4 의 해설 ⤵

2022.04.10 - [LINUX] - OverTheWire: Level Goal: Bandit Level 3 → Level 4

'OS > LINUX' 카테고리의 다른 글

OverTheWire: Level Goal: Bandit Level 4 → Level 5  (0) 2022.04.10
OverTheWire: Level Goal: Bandit Level 3 → Level 4  (0) 2022.04.10
OverTheWire: Level Goal: Bandit Level 1 → Level 2  (0) 2022.04.10
OverTheWire: Level Goal: Bandit Level 0 → Level 1  (0) 2022.04.10
OverTheWire: Level Goal: Bandit Level 0  (0) 2022.04.10
'OS/LINUX' 카테고리의 다른 글
  • OverTheWire: Level Goal: Bandit Level 4 → Level 5
  • OverTheWire: Level Goal: Bandit Level 3 → Level 4
  • OverTheWire: Level Goal: Bandit Level 1 → Level 2
  • OverTheWire: Level Goal: Bandit Level 0 → Level 1
602zzang
602zzang
  • 602zzang
    yks_STUDY
    602zzang
  • 전체
    오늘
    어제
    • 분류 전체보기 (77)
      • Programming Language (36)
        • C (15)
        • PYTHON (9)
        • RUST (12)
      • Reverse Engineering (3)
      • OS (17)
        • LINUX (17)
      • 보안 이슈 (6)
      • Digital Forensics (1)
      • CTF (8)
      • 기타 (6)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    코드업
    cyberdefenders
    P4C
    백준
    picoCTF
    Rocky Linux
    TeamH4C
    드림핵
    보안이슈
    빡공팟
    c
    bandit
    공급망
    rust
    보안동향
    소켓 통신
    umassctf2025
    파이썬
    rustling
    python
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
602zzang
OverTheWire: Level Goal: Bandit Level 2 → Level 3
상단으로

티스토리툴바