# Havoc Teamserver Dockerfile
# ------------------------------------------------------------------------------
# Commands for usage:
#
#	Build image file:
#		'docker build -t havoc-teamserver -f Teamserver-Dockerfile .'
#	(Optional) Create Data volume for persistence:
#		`docker volume create <volume_name>`
#	Run Built Image file(`-d` for persistence):
#		'docker run -ti -d -v havoc-teamserver-data:/data havoc-teamserver'
#	Copy built Teamserver from container:
#		'docker cp <containerID>:/go/Build/bin/teamserver /host/path/target'
#
#	Run Built Teamserver from Docker container:
#		`docker run -p40056:40056 -p 443:443 -it -d -v havoc-c2-data:/data havoc-teamserver`
#		`docker exec -t <container_id> "/go/Build/bin/teamserver"`
#
# Extras
# 	Create Data storage for persistence
#       'docker volume create havoc-teamserver-data'
# 	Enter Container:
#		'docker run exec -it <containerID> bash'
# ------------------------------------------------------------------------------
ARG GO_VERSION="1.19.1"
FROM golang:${GO_VERSION}
#
ENV PATH=/root/.local/bin:$PATH
ENV USER=root
#
RUN apt update \
	&& apt -y install \
	alien \
	debhelper \
	devscripts \
	golang-go \
	nasm \
	mingw-w64 \
	dh-golang \
	dh-make \
	fakeroot \
	pkg-config \
	python3-all-dev \
	python3-pip \
	rpm \
	sudo \
	libcap2-bin \
	upx-ucl \
	&& pip install --upgrade jsonschema
#
# Copy over the client
#COPY . Build/
#RUN cd Build/ && make
#
# Pull the repo from Github
RUN git clone https://github.com/HavocFramework/Havoc
#
# Build the cloned repos copy of the Teamserver-Client
RUN cd Havoc/teamserver/ && chmod +x ./Install.sh && ./Install.sh && cd .. && make ts-build
#
# ------------------------------------------------------------------------------#
# original @author      Nicola Asuni <info@tecnick.com>
# @copyright   2016-2022 Nicola Asuni - Tecnick.com LTD
# @license     MIT (see LICENSE)
# @link        https://github.com/tecnickcom/alldev
# ------------------------------------------------------------------------------
