forked from p15670423/monkey
Merge pull request #624 from guardicore/623/get-version-from-github-api
623/get version from GitHub api
This commit is contained in:
commit
965be23f18
|
@ -1,21 +1,44 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Absolute monkey's path
|
# Absolute monkey's path
|
||||||
MONKEY_FOLDER_NAME="infection_monkey"
|
export MONKEY_FOLDER_NAME="infection_monkey"
|
||||||
# Url of public git repository that contains monkey's source code
|
# Url of public git repository that contains monkey's source code
|
||||||
MONKEY_GIT_URL="https://github.com/guardicore/monkey"
|
export MONKEY_GIT_URL="https://github.com/guardicore/monkey"
|
||||||
|
|
||||||
|
get_latest_release() {
|
||||||
|
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub API
|
||||||
|
grep '"tag_name":' | # Get tag line
|
||||||
|
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
|
||||||
|
}
|
||||||
|
|
||||||
|
MONKEY_LATEST_RELEASE=$(get_latest_release "monkey/guardicore")
|
||||||
|
|
||||||
# Monkey binaries
|
# Monkey binaries
|
||||||
LINUX_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/monkey-linux-32"
|
|
||||||
LINUX_32_BINARY_NAME="monkey-linux-32"
|
LINUX_32_BINARY_NAME="monkey-linux-32"
|
||||||
LINUX_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/monkey-linux-64"
|
LINUX_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/monkey-linux-32"
|
||||||
|
export LINUX_32_BINARY_URL
|
||||||
|
export LINUX_32_BINARY_NAME
|
||||||
|
|
||||||
LINUX_64_BINARY_NAME="monkey-linux-64"
|
LINUX_64_BINARY_NAME="monkey-linux-64"
|
||||||
WINDOWS_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/monkey-windows-32.exe"
|
LINUX_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/monkey-linux-64"
|
||||||
|
export LINUX_64_BINARY_URL
|
||||||
|
export LINUX_64_BINARY_NAME
|
||||||
|
|
||||||
WINDOWS_32_BINARY_NAME="monkey-windows-32.exe"
|
WINDOWS_32_BINARY_NAME="monkey-windows-32.exe"
|
||||||
WINDOWS_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/monkey-windows-64.exe"
|
WINDOWS_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/monkey-windows-32.exe"
|
||||||
|
export WINDOWS_32_BINARY_URL
|
||||||
|
export WINDOWS_32_BINARY_NAME
|
||||||
|
|
||||||
WINDOWS_64_BINARY_NAME="monkey-windows-64.exe"
|
WINDOWS_64_BINARY_NAME="monkey-windows-64.exe"
|
||||||
|
WINDOWS_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/monkey-windows-64.exe"
|
||||||
|
export WINDOWS_64_BINARY_URL
|
||||||
|
export WINDOWS_64_BINARY_NAME
|
||||||
|
|
||||||
# Other binaries for monkey
|
# Other binaries for monkey
|
||||||
TRACEROUTE_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/traceroute64"
|
TRACEROUTE_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/traceroute64"
|
||||||
TRACEROUTE_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/traceroute32"
|
export TRACEROUTE_64_BINARY_URL
|
||||||
SAMBACRY_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/sc_monkey_runner64.so"
|
TRACEROUTE_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/traceroute32"
|
||||||
SAMBACRY_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/v1.7.0/sc_monkey_runner32.so"
|
export TRACEROUTE_32_BINARY_URL
|
||||||
|
SAMBACRY_64_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/sc_monkey_runner64.so"
|
||||||
|
export SAMBACRY_64_BINARY_URL
|
||||||
|
SAMBACRY_32_BINARY_URL="https://github.com/guardicore/monkey/releases/download/$($MONKEY_LATEST_RELEASE)/sc_monkey_runner32.so"
|
||||||
|
export SAMBACRY_32_BINARY_URL
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
# Absolute monkey's path
|
# Absolute monkey's path
|
||||||
$MONKEY_FOLDER_NAME = "infection_monkey"
|
$MONKEY_FOLDER_NAME = "infection_monkey"
|
||||||
# Url of public git repository that contains monkey's source code
|
# Url of public git repository that contains monkey's source code
|
||||||
|
$MONKEY_REPO = "guardicore/monkey"
|
||||||
$MONKEY_GIT_URL = "https://github.com/guardicore/monkey"
|
$MONKEY_GIT_URL = "https://github.com/guardicore/monkey"
|
||||||
$MONKEY_RELEASES_URL = $MONKEY_GIT_URL + "/releases"
|
$MONKEY_RELEASES_URL = $MONKEY_GIT_URL + "/releases"
|
||||||
$MONKEY_LATEST_VERSION = "v1.7.0"
|
$MONKEY_API_RELEASES_URL = "https://api.github.com/repos/$MONKEY_REPO/releases"
|
||||||
|
$MONKEY_LATEST_VERSION = (Invoke-WebRequest $MONKEY_API_RELEASES_URL | ConvertFrom-Json)[0].tag_name
|
||||||
$MONKEY_DOWNLOAD_URL = $MONKEY_RELEASES_URL + "/download/" + $MONKEY_LATEST_VERSION + "/"
|
$MONKEY_DOWNLOAD_URL = $MONKEY_RELEASES_URL + "/download/" + $MONKEY_LATEST_VERSION + "/"
|
||||||
# Link to the latest python download or install it manually
|
# Link to the latest python download or install it manually
|
||||||
$PYTHON_URL = "https://www.python.org/ftp/python/3.7.6/python-3.7.6-amd64.exe"
|
$PYTHON_URL = "https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe"
|
||||||
|
|
||||||
|
|
||||||
# Monkey binaries
|
# Monkey binaries
|
||||||
|
|
Loading…
Reference in New Issue