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 |