aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-09-21 17:08:35 +0000
committerGitHub2020-09-21 17:08:35 +0000
commit8c8487b79300342b4c6dafe9c3691d43b8dc8e37 (patch)
treedef44b1d04e689b1f4e8e25e5ca9c5cff7abe557 /scripts
parent98355cdf838d8c18e9a28176ae7a847770545395 (diff)
parent65f9bb547a24dd851d366f22950cb4301f3e8ae4 (diff)
Merge pull request #17 from therealbobo/file-load
File load
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/example_commands.sh63
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
+