github twitter facebook email
Docker
Oct 23, 2018
2 minutes read

docker build -t 이름/태그 .

docker run -d -p 외부포트:내부포트 이름/태그

# attack
service attack
{
        disable         = no
        flags           = REUSE
        socket_type     = stream
        protocol        = tcp
        user            = attack
        wait            = no
        server          = /home/attack/main
}

pwnable binary

# Dockerfile
FROM ubuntu:16.04

MAINTAINER c2w2m2 juchang0308@gmail.com

RUN apt-get update
RUN apt-get install -y xinetd 
ENV TERM=linux

RUN useradd attack
RUN mkdir /home/attack
WORKDIR /home/attack

ADD main /home/attack
ADD flag /home/attack
ADD flag /
ADD exp.py /home/attack
ADD attack /etc/xinetd.d

RUN chmod 460 /home/attack/*
RUN chown attack:root /home/attack/*
RUN chmod +x /home/attack/main

RUN echo "attack 2222/tcp" >> /etc/services
EXPOSE 2222

CMD ["/usr/sbin/xinetd","-dontfork"]

Python binary

# Dockerfile
FROM ubuntu:16.04

MAINTAINER c2w2m2 juchang0308@gmail.com

RUN apt-get update
RUN apt-get install -y xinetd 
RUN apt-get install -y python2.7

ENV TERM=linux

RUN useradd attack
RUN mkdir /home/attack
WORKDIR /home/attack

ADD main /home/attack
ADD flag /home/attack
ADD flag /
ADD attack /etc/xinetd.d

RUN chmod 460 /home/attack/*
RUN chown attack:root /home/attack/*
RUN chmod +x /home/attack/main

RUN echo "attack 2222/tcp" >> /etc/services
EXPOSE 2222

CMD ["/usr/sbin/xinetd","-dontfork"]

Python flask

# Dockerfile
FROM ubuntu:16.04

MAINTAINER c2w2m2 juchang0308@gmail.com

RUN apt-get clean
RUN apt-get update
RUN apt-get install -y python2.7 
RUN apt-get install -y curl
RUN curl https://bootstrap.pypa.io/get-pip.py | python2.7
RUN pip install flask

ENV TERM=linux

RUN useradd attack
RUN mkdir /home/attack
WORKDIR /home/attack

ADD main /home/attack
RUN chmod 460 /home/attack/*
RUN chown attack:root /home/attack/*
RUN chmod +x /home/attack/main

EXPOSE 2222

CMD ["/home/attack/main"]

Back to posts


comments powered by Disqus