Impacket and Docker

Almost everything I do in my Development career involves Docker and almost everything in my Information Security career involves Impacket. So, it was only natural that the two would meet and fall in love. Here's how to create an Impacket Docker image that you too can fall in love with.

Prerequisite

  • Docker
  • Impacket

If you haven't already installed Docker do it now. The Docker documentation is the best place to find help with that.

Create Impacket Docker Image

Create a file called Dockerfile and enter the following.

Dockerfile

FROM python:2.7

RUN pip install --upgrade pip

RUN pip install ldap3==2.5.1 \
    future \
    dnspython \
    cryptography==2.3 \
    MarkupSafe==0.23

RUN git clone https://github.com/SecureAuthCorp/impacket.git
RUN cd impacket && python setup.py install
ENTRYPOINT ["/bin/bash"]

Now build the Docker image.

docker build -t impacket .

Once it has finished building you can run the image.

docker run -it --rm impacket

Now in the docker container you run any of the tools that are available in Impacket. For example psexec.

psexec.py vagrant:vagrant@192.168.1.100

Summary

Docker and Impacket are heavily used in my projects. I hope this is as useful to you as it is to me. There is one thing to note here and that is Impacket is Python2 and does not work with Python3. As annoying as that is it shouldn't stop you from using it. Especially now with your very own docker image. There is no reason to even install python on your machine.