From 089d3819ceaf0819757215a7f30b7838a66d098a Mon Sep 17 00:00:00 2001 From: Wes Lambert Date: Wed, 28 Oct 2020 01:33:47 +0000 Subject: [PATCH] Use Github API for latest release download --- Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index a86e049..93bef47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,17 +6,21 @@ ENV VERSION="0.5.1" COPY ./entrypoint . RUN chmod +x entrypoint && \ apt-get update && \ - apt-get install -y wget && \ - # Create dirs for Velox binaries + apt-get install -y curl wget jq && \ + # Create dirs for Velo binaries mkdir -p /opt/velociraptor && \ for i in linux mac windows; do mkdir -p /opt/velociraptor/$i; done && \ # Get Velox binaries - wget -O /opt/velociraptor/linux/velociraptor https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-1-linux-amd64 && \ - wget -O /opt/velociraptor/mac/velociraptor_client https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-darwin-amd64 && \ - wget -O /opt/velociraptor/windows/velociraptor_client.exe https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-1-windows-amd64.exe && \ - wget -O /opt/velociraptor/windows/velociraptor_client.msi https://github.com/Velocidex/velociraptor/releases/download/v$VERSION/velociraptor-v$VERSION-1-windows-amd64.msi && \ + WINDOWS_EXE=$(curl -s https://api.github.com/repos/velocidex/velociraptor/releases/latest | jq -r 'limit(1 ; ( .assets[].browser_download_url | select ( contains("windows-amd64.exe") )))') && \ + WINDOWS_MSI=$(curl -s https://api.github.com/repos/velocidex/velociraptor/releases/latest | jq -r 'limit(1 ; ( .assets[].browser_download_url | select ( contains("windows-amd64.msi") )))') && \ + LINUX_BIN=$(curl -s https://api.github.com/repos/velocidex/velociraptor/releases/latest | jq -r 'limit(1 ; ( .assets[].browser_download_url | select ( contains("linux-amd64") )))') && \ + MAC_BIN=$(curl -s https://api.github.com/repos/velocidex/velociraptor/releases/latest | jq -r 'limit(1 ; ( .assets[].browser_download_url | select ( contains("darwin-amd64") )))') && \ + wget -O /opt/velociraptor/linux/velociraptor "$LINUX_BIN" && \ + wget -O /opt/velociraptor/mac/velociraptor_client "$MAC_BIN" && \ + wget -O /opt/velociraptor/windows/velociraptor_client.exe "$WINDOWS_EXE" && \ + wget -O /opt/velociraptor/windows/velociraptor_client.msi "$WINDOWS_MSI" && \ # Clean up - apt-get remove -y --purge wget && \ + apt-get remove -y --purge curl wget jq && \ apt-get clean WORKDIR /velociraptor CMD ["/entrypoint"]