Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
add git version via version.sh (generated at build time)
Browse files Browse the repository at this point in the history
  • Loading branch information
drstrange committed Jan 29, 2020
1 parent 340419f commit cccc5ea
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,23 @@ set -o errexit;
# ref: https://stackoverflow.com/a/4774063/87207
readonly current_directory="$( cd "$(dirname "$0")" ; pwd -P )"

# generate a version file with GIT metadata
version_file="$current_directory/version.sh";
if [ -f "$version_file" ]; then
rm "$version_file";
fi
echo "git_tag=$(git describe --tags)" > $version_file;
echo "git_hash=$(git rev-parse HEAD)" >> $version_file;

# not all FreeBSD/NetScaler devices have mktemp.
readonly staging_directory="/tmp/$(date +%s)";
mkdir "$staging_directory";

cp "$current_directory/ioc-scanner-CVE-2019-19781.sh" "$staging_directory/ioc-scanner-CVE-2019-19781.sh";
cp "$current_directory/version.sh" "$staging_directory/version.sh";
cp -r "$current_directory/scanners/" "$staging_directory/scanners/" >/dev/null;
cd "$staging_directory";
tar czvf "payload.tgz" "ioc-scanner-CVE-2019-19781.sh" "./scanners/" >/dev/null;
tar czvf "payload.tgz" "ioc-scanner-CVE-2019-19781.sh" "./scanners/" "version.sh" >/dev/null;
cd - >/dev/null;
readonly payload=$(cat "$staging_directory/payload.tgz" | base64 -);

Expand Down

1 comment on commit cccc5ea

@tatedogg17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting an error when trying v1.3. Says missing script version.sh and when I change build.sh to version it gives me an error "/tmp/ioc-scanner-CVE-2019-19781-master/version.sh: line 23: current_directory: readonly variable"

Please sign in to comment.