mirror of
https://github.com/ysoftdevs/wapifuzz.git
synced 2026-03-26 03:11:15 +01:00
Merge pull request #1 from ysoftdevs/docker_fix
Running docker - simplifying
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -1,6 +1,8 @@
|
|||||||
# We need .NET Core image for running parser
|
# We need .NET Core image for running parser
|
||||||
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
|
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
|
||||||
|
|
||||||
|
ENV container=true
|
||||||
|
|
||||||
# Expose port for process monitor
|
# Expose port for process monitor
|
||||||
EXPOSE 26002/tcp
|
EXPOSE 26002/tcp
|
||||||
EXPOSE 26002/udp
|
EXPOSE 26002/udp
|
||||||
@@ -15,11 +17,11 @@ COPY fuzzer /usr/local/fuzzer/fuzzer
|
|||||||
COPY parser /usr/local/fuzzer/parser
|
COPY parser /usr/local/fuzzer/parser
|
||||||
COPY reporter /usr/local/fuzzer/reporter
|
COPY reporter /usr/local/fuzzer/reporter
|
||||||
|
|
||||||
# And finally, copy the run script
|
|
||||||
COPY run.sh /usr/local/bin/
|
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /usr/local/fuzzer/
|
WORKDIR /usr/local/fuzzer/
|
||||||
|
|
||||||
|
COPY run.sh /usr/local/fuzzer/run.sh
|
||||||
|
RUN chmod +x /usr/local/fuzzer/run.sh
|
||||||
|
|
||||||
# Set run script as an entry point of the container
|
# Set run script as an entry point of the container
|
||||||
ENTRYPOINT ["run.sh"]
|
ENTRYPOINT ["/usr/local/fuzzer/run.sh"]
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ Execute `run.sh config_file_path openapi_doc_file_path [custom_payloads_file_pat
|
|||||||
### Docker
|
### Docker
|
||||||
You just need to run the container with following arguments:
|
You just need to run the container with following arguments:
|
||||||
|
|
||||||
`docker run -p {host_port}:{container_port} -v $(pwd):/usr/local/fuzzer/mnt/ starek4/wfuzz:latest mnt/config.json mnt/sqta.yaml [mnt/custom_payloads.txt]`
|
`docker run -p {host_port}:{container_port} -v $(pwd):/usr/local/fuzzer/mnt/ starek4/wfuzz:latest config.json sqta.yaml [custom_payloads.txt]`
|
||||||
|
|
||||||
where files `config.json`, `sqta.yaml` and `custom_payloads` needs to be stored in the working directory.
|
where files `config.json`, `sqta.yaml` and `custom_payloads` needs to be stored in the working directory.
|
||||||
With parameter `-p` you also need to bind port number, which is used for communication with your web API, to the container.
|
With parameter `-p` you also need to bind port number, which is used for communication with your web API, to the container.
|
||||||
|
|||||||
39
run.sh
39
run.sh
@@ -9,25 +9,11 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if config file and documentation file are valid files
|
# Load script arguments
|
||||||
WFUZZ_CONFIG=$1
|
WFUZZ_CONFIG=$1
|
||||||
OPENAPI_DOCUMENTATION=$2
|
OPENAPI_DOCUMENTATION=$2
|
||||||
CUSTOM_PAYLOADS_FILE=$3
|
CUSTOM_PAYLOADS_FILE=$3
|
||||||
|
|
||||||
if [ ! -f "$WFUZZ_CONFIG" ]
|
|
||||||
then
|
|
||||||
echo "Configuration file path is not valid!" >&2
|
|
||||||
echo $USAGE >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$OPENAPI_DOCUMENTATION" ]
|
|
||||||
then
|
|
||||||
echo "OpenApi documentation file path is not valid!" >&2
|
|
||||||
echo $USAGE >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Define binary binaries paths
|
# Define binary binaries paths
|
||||||
PIP3_BIN=pip3
|
PIP3_BIN=pip3
|
||||||
PYTHON3_BIN=python3
|
PYTHON3_BIN=python3
|
||||||
@@ -47,14 +33,33 @@ FUZZER_LOG=fuzzing.log
|
|||||||
XUNIT2HTML_XSL=./reporter/xunit_to_html.xsl
|
XUNIT2HTML_XSL=./reporter/xunit_to_html.xsl
|
||||||
SAXON9HE=./reporter/saxon9he.jar
|
SAXON9HE=./reporter/saxon9he.jar
|
||||||
|
|
||||||
# If there is mounted Docker directory, write output files into it
|
# If we are in Docker container, write output files into mounted folder and append this folder before input files paths
|
||||||
if [ -d "mnt/" ]; then
|
if [ "$container" = "true" ]; then
|
||||||
echo "Founded mounted Docker directory, you can find WFuzz artifacts in your working directory."
|
echo "Founded mounted Docker directory, you can find WFuzz artifacts in your working directory."
|
||||||
|
WFUZZ_CONFIG="./mnt/$WFUZZ_CONFIG"
|
||||||
|
OPENAPI_DOCUMENTATION="./mnt/$OPENAPI_DOCUMENTATION"
|
||||||
|
CUSTOM_PAYLOADS_FILE="./mnt/$CUSTOM_PAYLOADS_FILE"
|
||||||
|
|
||||||
FUZZER_LOG="./mnt/$FUZZER_LOG"
|
FUZZER_LOG="./mnt/$FUZZER_LOG"
|
||||||
JUNIT_TEST_REPORT="./mnt/$JUNIT_TEST_REPORT_FILENAME"
|
JUNIT_TEST_REPORT="./mnt/$JUNIT_TEST_REPORT_FILENAME"
|
||||||
HTML_TEST_REPORT="./mnt/$HTML_TEST_REPORT_FILENAME"
|
HTML_TEST_REPORT="./mnt/$HTML_TEST_REPORT_FILENAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if config file and documentation file are valid files
|
||||||
|
if [ ! -f "$WFUZZ_CONFIG" ]
|
||||||
|
then
|
||||||
|
echo "Configuration file path is not valid!" >&2
|
||||||
|
echo $USAGE >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$OPENAPI_DOCUMENTATION" ]
|
||||||
|
then
|
||||||
|
echo "OpenApi documentation file path is not valid!" >&2
|
||||||
|
echo $USAGE >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Define docker images tags
|
# Define docker images tags
|
||||||
REPORTER_IMAGE_TAG=wfuzz:reporter
|
REPORTER_IMAGE_TAG=wfuzz:reporter
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user