diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..28932c9 --- /dev/null +++ b/templates/README.md @@ -0,0 +1,12 @@ +# Attack Templates + +This directory contains template code that can be used for your attack. +Feel free to change it however you like, or not use it at all! + +We currently have support for: +- [Golang](/golang) + +A "copy and run" script is provided for each template, which will: +* Copy the code in your working directory into the `flagship` container +* Update `run.sh` with execution commands (if not already present) +* Run `./run.sh` inside of the container diff --git a/templates/copy_and_run_golang.sh b/templates/copy_and_run_golang.sh new file mode 100755 index 0000000..9b9ed20 --- /dev/null +++ b/templates/copy_and_run_golang.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Removing old golang code in container" +kubectl exec -it warnet-armada/flagship -- rm -rf /golang + +echo "Copying code in /golang into container" +kubectl cp golang warnet-armada/flagship:/ + +if ! kubectl exec -it flagship -n warnet-armada -- bash -c 'cat run.sh | grep -q "go install"'; then + echo "Adding instructions to run script" + kubectl exec -it flagship -n warnet-armada -- bash -c 'echo "cd /golang" >> /run.sh' + kubectl exec -it flagship -n warnet-armada -- bash -c 'echo "go install" >> /run.sh' + kubectl exec -it flagship -n warnet-armada -- bash -c 'echo "/root/go/bin/attackathon" >> /run.sh' +fi + +echo "Running script 😈" +kubectl exec -it flagship -n warnet-armada -- ./run.sh