[Info] Ubuntu 22.04 Docker for PWN

2025. 3. 2. 00:50·INFO

0x00. Intro

pwnable을 하며 Docker로 로되리안 및 로안리되를 경험하며 도커의 필요성을 느꼈고, Docker 설치 및 실행을 오류 없이, 편리하게 하는 방법을 공부하며 알게된 내용과 내가 사용할 방법을 기록하기 위해서 적는 글

 

0x01. Build and Run

Build :

docker build -t [IMAGE_NAME] .

Run :

docker run -u root -v /mnt/c/Kim_Jun_Won/03_Programming/6_HACKING/Wargame\\(Dreamhack\\):/shared_dir -it [IMAGE_NAME] /bin/bash

> 이러면 /mnt/c/....(local)과 Docker내의 shared_dir이라는 폴더가 공유됨

 

 

0x02. Dreamhack에서 제공된 도커에 모듈들을 설치할 때

  • 요약 : 걍 아래의 코드를 중간에 넣어주고 바로 빌드 n 실행 ([*] Build and Run -> 이거 그대로)
# 닥치고 아래 복붙붙
ENV PATH="${PATH}:/usr/local/lib/python3.6/dist-packages/bin"
ENV LC_CTYPE=C.UTF-8

RUN apt update
RUN apt install -y \\
    gcc \\
    git \\
    python3 \\
    python3-pip \\
    ruby \\
    sudo \\
    tmux \\
    vim \\
    wget \\
    checksec

# install pwndbg
WORKDIR /root
RUN git clone <https://github.com/pwndbg/pwndbg>
WORKDIR /root/pwndbg
RUN git checkout 2023.03.19
RUN ./setup.sh

# install pwntools
RUN pip3 install --upgrade pip
RUN pip3 install pwntools

RUN gem install one_gadget

python, pwndbg, pwntools, one_gadget, vim을 설치

 

0x03. 도커 버전만 보고 미리 만들어둔 도커를 사용할 때

# Dockerfile로 저장후 빌드 n 실행 (`[*] Build and Run` -> 이거 그대로로)
FROM ubuntu:22.04

ENV PATH="${PATH}:/usr/local/lib/python3.6/dist-packages/bin"
ENV LC_CTYPE=C.UTF-8

RUN apt update
RUN apt install -y \\
    gcc \\
    git \\
    python3 \\
    python3-pip \\
    ruby \\
    sudo \\
    tmux \\
    vim \\
    wget \\
    checksec

# install pwndbg
WORKDIR /root
RUN git clone <https://github.com/pwndbg/pwndbg>
WORKDIR /root/pwndbg
RUN git checkout 2023.03.19
RUN ./setup.sh

# install pwntools
RUN pip3 install --upgrade pip
RUN pip3 install pwntools

RUN gem install one_gadget

WORKDIR /root

 

 

0x04. Conclusion

그동안 개고생하며 안되었던 것들을 해결하였다.

22.04 버전의 기본적인 것만 만들었지만, 이 버전에 모듈을 추가하고, 18.04 같은 다른 버전들도 직접 만들어봐야 할 것 같다.

(수정1 : 2025. 01. 08)

(최종수정 : 2025. 03. 02) - velog에서 tistory로 옮김

'INFO' 카테고리의 다른 글

[Info] Docker와 Visual Studio Code를 연결하는 방법  (2) 2025.08.27
[Info] Using Docker in PWNABLE (dreamhack)  (0) 2025.03.18
'INFO' 카테고리의 다른 글
  • [Info] Docker와 Visual Studio Code를 연결하는 방법
  • [Info] Using Docker in PWNABLE (dreamhack)
Hello🖐️I'm pandas from KDMHS
Hello🖐️I'm pandas from KDMHS
한국디지털미디어고등학교 23기 웹 프로그래밍과에서 해킹을 공부하고 있는 pandas입니다.
  • Hello🖐️I'm pandas from KDMHS
    웹 프로그래밍과에서 시스템 해킹 공부하기
    Hello🖐️I'm pandas from KDMHS
  • 공지사항

    • Hello I'm pandas 🖐️
    • 분류 전체보기 (26)
      • CTF (9)
      • 디미고 (8)
      • 백준 (1)
      • Dreamhack (5)
      • INFO (3)
  • 전체
    오늘
    어제
  • 블로그 메뉴

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

  • 인기 글

  • 태그

    Baekjoon
    ctf
    reversing
    백준
    docker
    Python
    DreamHack
    웹프로그래밍과
    팰린드롬
    info
    해킹
    pwnable
    회고록
    디미고
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
Hello🖐️I'm pandas from KDMHS
[Info] Ubuntu 22.04 Docker for PWN
상단으로

티스토리툴바