mac에서 docker로 pwngdb 환경 구성

skyepodium·2023년 6월 4일
0

매번 새로 설치하는것이 귀찮아서, DockerFile로 이미지를/컨테이너를 생성하도록 작성했습니다.

1) DockerFile 생성

pwndbg 최신 버전을 설치하면 제대로 동작하지 않는 현상이 있어서, 2022.08.30 버전을 설치합니다.

# Use Ubuntu as base image
FROM ubuntu:latest

# Update and install required packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends file git curl gcc vim python3 python3-pip && \
    rm -rf /var/lib/apt/lists/*

# Clone the pwndbg repo and checkout to specified tag
RUN git clone https://github.com/pwndbg/pwndbg && \
    cd pwndbg && \
    git checkout tags/2022.08.30

# Install pwndbg
RUN cd pwndbg && ./setup.sh

# Update .gdbinit to source pwndbg
RUN echo 'source /pwndbg/gdbinit.py' >> /root/.gdbinit

# Install pwntools
RUN pip3 install pwntools ropgadget

# Set up environment for interactive bash shell
CMD ["/bin/bash"]

2) 도커 이미지 생성

docker build -t ubuntu-pwndbg .

3) 도커 컨테이너 생성

mkdir ubuntu-pwndbg

cd ubuntu-pwndbg

docker run -it --name ubuntu-pwndbg -u root -v "$(pwd)":/workspace ubuntu-pwndbg

4) root로 실행

root로 실행하면, tab 자동완성, ll alias 등이 지원됩니다.

docker ps

docker exec -i -t --user root e235a20ac238 bash

5) 확인

profile
callmeskye

1개의 댓글

comment-user-thumbnail
2023년 8월 20일

혹시 m1이나 m2로 하신 건가요?

답글 달기