Skip to content

Instantly share code, notes, and snippets.

@abronte
Last active November 6, 2023 21:33
Show Gist options
  • Save abronte/bf8d8816e8c8069e0c646ce2cf8d3821 to your computer and use it in GitHub Desktop.
Save abronte/bf8d8816e8c8069e0c646ce2cf8d3821 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# check if semgrep is installed
if ! command -v semgrep &> /dev/null
then
echo "semgrep could not be found"
exit
fi
# check if snyk is installed
if ! command -v snyk &> /dev/null
then
echo "snyk could not be found"
exit
fi
CMD="$@"
echo "Running $CMD"
REPORT=$($CMD)
echo "Finished running scan."
echo "Uploading results to Corgea"
FILES=$(echo $REPORT | tr "," "\n" | grep '"path": ' | uniq)
for i in $FILES
do
if [[ ! $i == *'"path"'* ]]; then
echo $i | tr -d "\""
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment