mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-27 08:30:10 +03:00
feat: build and run from Docker Support
Build and run from docker image support added. Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
This commit is contained in:
parent
13a2ab3fa3
commit
162a9aab75
32
README.md
32
README.md
|
@ -35,6 +35,38 @@ To get a list of all options and switches use:
|
||||||
|
|
||||||
python sqlmap.py -hh
|
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).
|
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).
|
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).
|
||||||
|
|
||||||
|
|
42
docker/Dockerfile
Normal file
42
docker/Dockerfile
Normal file
|
@ -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"]
|
Loading…
Reference in New Issue
Block a user