2018-12-10 19:08:59 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Absolute monkey's path
|
2020-04-17 06:04:40 +08:00
|
|
|
export MONKEY_FOLDER_NAME="infection_monkey"
|
2018-12-10 19:08:59 +08:00
|
|
|
# Url of public git repository that contains monkey's source code
|
2020-04-17 06:04:40 +08:00
|
|
|
export MONKEY_GIT_URL="https://github.com/guardicore/monkey"
|
|
|
|
|
2020-12-09 01:25:41 +08:00
|
|
|
exists() {
|
|
|
|
command -v "$1" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
2020-04-17 06:04:40 +08:00
|
|
|
get_latest_release() {
|
2020-12-09 01:25:41 +08:00
|
|
|
RELEASE_URL="https://api.github.com/repos/$1/releases/latest"
|
|
|
|
|
|
|
|
if exists wget; then
|
|
|
|
RELEASE_INFO=$(wget --quiet -O - "$RELEASE_URL") # Get latest release from GitHub API
|
|
|
|
else
|
|
|
|
RELEASE_INFO=$(curl --silent "$RELEASE_URL") # Get latest release from GitHub API
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$RELEASE_INFO" |
|
|
|
|
grep '"tag_name":' | # Get tag line
|
|
|
|
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
2020-04-17 06:04:40 +08:00
|
|
|
}
|
|
|
|
|
2020-10-05 15:24:37 +08:00
|
|
|
MONKEY_LATEST_RELEASE=$(get_latest_release "guardicore/monkey")
|
2018-12-10 19:08:59 +08:00
|
|
|
|
|
|
|
# Monkey binaries
|
2020-12-10 04:06:39 +08:00
|
|
|
export LINUX_32_BINARY_NAME="monkey-linux-32"
|
|
|
|
export LINUX_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$MONKEY_LATEST_RELEASE/monkey-linux-32"
|
|
|
|
|
|
|
|
export LINUX_64_BINARY_NAME="monkey-linux-64"
|
|
|
|
export LINUX_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$MONKEY_LATEST_RELEASE/monkey-linux-64"
|
|
|
|
|
|
|
|
export WINDOWS_32_BINARY_NAME="monkey-windows-32.exe"
|
|
|
|
export WINDOWS_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$MONKEY_LATEST_RELEASE/monkey-windows-32.exe"
|
|
|
|
|
|
|
|
export WINDOWS_64_BINARY_NAME="monkey-windows-64.exe"
|
|
|
|
export WINDOWS_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$MONKEY_LATEST_RELEASE/monkey-windows-64.exe"
|
2018-12-10 19:08:59 +08:00
|
|
|
|
2021-04-26 20:38:37 +08:00
|
|
|
# Swimm
|
|
|
|
export SWIMM_URL=https://github.com/swimmio/SwimmReleases/releases/download/v0.4.4-0/Swimm_0.4.4-0_Setup.deb
|