templates: add script to copy and run golang program
This commit is contained in:
parent
2b313e2eab
commit
f54a2c931a
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue