diff --git a/README.md b/README.md index d3cc006fc..031c8f2c8 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,38 @@ To get a list of all options and switches use: python sqlmap.py -hh +## Using Docker + +Download the Dockerfile: + +```bash +mkdir docker +cd docker +wget https://github.com/sqlmapproject/sqlmap/raw/master/docker/Dockerfile +``` + +Build the Docker images: + +```bash +docker build -t sqlmap:latest . +``` + +Run the sqlmap from image: + +```bash +docker run -it --rm sqlmap python sqlmap.py -h +``` +Or +```bash +docker run -it --rm sqlmap python sqlmap.py -hh +``` + +Run and attach interactive shell to the sqlmap docker container to work from inside the running container: + +```bash +docker run -it --rm sqlmap /bin/bash +``` + You can find a sample run [here](https://asciinema.org/a/46601). To get an overview of sqlmap capabilities, a list of supported features, and a description of all options and switches, along with examples, you are advised to consult the [user's manual](https://github.com/sqlmapproject/sqlmap/wiki/Usage). diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..056d7fe19 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,42 @@ +FROM ubuntu:20.04 +RUN \ + # configure the "sqlmap" user + groupadd sqlmap && \ + useradd sqlmap -s /bin/bash -m -g sqlmap -G sudo && \ + echo 'sqlmap:sqlmap' |chpasswd && \ + export DEBIAN_FRONTEND=noninteractive && \ + export TZ=Europe\Paris && \ + ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ + apt-get update && \ + # install utilities + apt-get install -y \ + git \ + python3 \ + sudo && \ + # cleanup + apt-get clean && \ + rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* + +RUN ln -s /usr/bin/python3 /usr/bin/python + +WORKDIR "/home/sqlmap/" + +RUN \ + # install the sqlmap + git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap && \ + # fix sqlmap user permissions + chown -R sqlmap:sqlmap \ + /home/sqlmap/sqlmap && \ + # cleanup + rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* + +USER sqlmap +ENV PATH $PATH:/usr/bin +WORKDIR "/home/sqlmap/sqlmap" +CMD ["python", "sqlmap.py", "-hh"] \ No newline at end of file