Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick & dirty Docker support #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# pull the base image
FROM debian:bookworm-slim


RUN mkdir /copilot
RUN mkdir /copilot/output
RUN mkdir /copilot/exclude
RUN echo "export TERM=dumb" >> ~/.bashrc
RUN echo 'export GOPATH=$HOME/go' >> ~/.bashrc
RUN echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
RUN bash -c "source ~/.bashrc"
# copy current directory files into the container

COPY . /copilot
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh


# set work directory
WORKDIR /copilot

RUN echo "test"> /copilot/output/test.txt

RUN DEBIAN_FRONTEND=noninteractive && apt update
RUN DEBIAN_FRONTEND=noninteractive && apt -y install git wget sudo bash curl


RUN DEBIAN_FRONTEND=noninteractive && export TERM=dumb && chmod +x /copilot/webcopilot install.sh && \
mv /copilot/webcopilot /usr/bin/ && \
/copilot/install.sh

# command to run on container start


ENTRYPOINT ["/bin/bash", "/usr/bin/entrypoint.sh"]

# build
# docker build -t webcopilot:latest .

# Run using this command
# docker run -it -v $PWD/output:/copilot/output -v $PWD/exclude:/copilot/exclude webcopilot:latest -d <destination> -b <BXSS Server> -a -x /copilot/exclude/exclude.txt -t <number of threads>
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,28 @@ Time: 28-04-2024 17:16:49
[+] Subdomain Takeover: 0
[+] Nuclei: 0
```

# Docker

Build the docker image

```bash
g!2m0:~ docker build -t webcopilot:2.0-beta .
```

Run the image
Make sure that the directory ./output exists. it will be used to store the results
- You can use all supported command line switches except -o. Instead mount the docker directory ``/copilot/output`` to a host directory
- An exclude file can be stored in a host folder mapped to /copilot/exclude. Make sure that the host folder is mapped to the container directory ``/copilot/exclude`` and that you this directory when running the container

```bash
g!2m0:~ docker run -it -v $PWD/output:/copilot/output -v $PWD/exclude:/copilot/exclude webcopilot:2.0-beta -d <destination> -b <BXSS Server> -a -x /copilot/exclude/exclude.txt -t <number of threads>
```





---

### Acknowledgement
Expand Down
24 changes: 24 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

target=""
output_dir="/copilot/output/"

# Parse command line arguments
while getopts "d:" opt; do
case ${opt} in
d)
target=$OPTARG
;;
*)
;;
esac
done

if [[ -n $target ]]; then
output_dir="$output_dir$target-$(date +"%Y%m%d_%H%M%S")/"
else
output_dir="$output_dir$(date +"%Y%m%d_%H%M%S")/"
fi

/usr/bin/webcopilot -o "$output_dir" "$@"

11 changes: 9 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,11 @@ configs(){

# Copy gf examples if they haven't been copied before
if [ ! -d "~/.gf/examples" ]; then
cp -r ~/go/src/github.com/tomnomnom/gf/examples ~/.gf/
cp -r ~/go/src/github.com/tomnomnom/gf/examples ~/.gf/ 2> /dev/null

# ::stalpers::
# pipe to /dev/null to catch errors - causing Dockerfile build

fi

# Add gf completion to bashrc if it's not already there
Expand Down Expand Up @@ -646,7 +650,10 @@ main(){
echo -e "${GREEN}[*]${NORMAL} All Tools are installed successfully"
# echo -e "${YELLOW}[*]${NORMAL} Please configure notify API's in ${BOLD}${RED}~/.config/notify/provider-config.yaml${NORMAL} file"
# echo -e "${YELLOW}[*]${NORMAL}${BOLD} Don't forget to add your API keys in the config file of the tools"
webcopilot -h 2> /dev/null

# ::stalpers::
# removed the call to webcopilot to avoid non-zero exit code
# webcopilot -h 2> /dev/null
}

while true; do
Expand Down