diff options
author | Emiliano Ciavatta | 2020-09-16 19:18:06 +0000 |
---|---|---|
committer | Emiliano Ciavatta | 2020-09-16 19:18:06 +0000 |
commit | 4cfdf6e2dfe9184e988a145495e072571d512cdc (patch) | |
tree | 6505e7b3aee0bf452e9f5c749d6cb54b95064b5c /scripts | |
parent | 047cc0971697d1059e2aa8cb7d32fc47c05c4e0f (diff) |
Add example_commands script (from @therealbobo)
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/example_commands.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/scripts/example_commands.sh b/scripts/example_commands.sh new file mode 100755 index 0000000..4664235 --- /dev/null +++ b/scripts/example_commands.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +function setup_service(){ + PORT="$1" + NAME="$2" + COLOR="$3" + curl --request PUT \ + --url http://localhost:3333/api/services \ + --header 'content-type: application/json' \ + --data "{\"port\":$PORT,\"name\":\"$NAME\",\"color\":\"#$COLOR\",\"notes\":\"\"}" +} + +BACKEND=false +FRONTEND=false +SETUP=true +IMPORT=true +START=false + + +if $START; then + pkill caronte +fi + +if $BACKEND ; then + go mod download && go build || exit -1 +fi + +if $FRONTEND ; then + cd frontend && yarnpkg install && yarnpkg build || exit -2 + cd - +fi + +if $START; then + docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:4 && sleep 3 + ./caronte & + sleep 2 +fi + +# setup +if $SETUP ; then + curl \ + --header "Content-Type: application/json" \ + --request POST \ + --data '{"config": {"server_address": "10.10.1.1", "flag_regex": "flg[a-zA-Z0-9]{25}", "auth_required": false}, "accounts": {"usr1": "pwd1"}}' \ + http://localhost:3333/setup + + setup_service 8080 crashair E53935 + setup_service 27017 aircnc 5E35B1 + setup_service 80 lostpropertyhub F9A825 + setup_service 5555 theone F9A435 + #setup_service 3306 crashair E53935 +fi + + +# import pcaps +if $IMPORT ; then + PCAP_DIR="~/pcaps" + for PCAP in $PCAP_DIR/*.pcap ; do + echo "[+] Uploading $PCAP" && \ + curl -F "file=@$PCAP" "http://localhost:3333/api/pcap/upload" + done +fi + |