Skip to content

Instantly share code, notes, and snippets.

@code-scan
Last active October 31, 2021 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save code-scan/b620fa80e6ed4fd1799b1dd2d441bed2 to your computer and use it in GitHub Desktop.
Save code-scan/b620fa80e6ed4fd1799b1dd2d441bed2 to your computer and use it in GitHub Desktop.
github-CveMonitor
function CveMonitor(){
lastResult=$(cat last.txt)
result=$(curl -s 'https://api.github.com/search/repositories?sort=updated&order=desc&q=CVE-202'|jq '.items[]|.html_url +" "+.description+"|||"'|sed 's/"//g')
echo $result|sed 's/|||/\n/g' > current.txt
diff=$(diff last.txt current.txt|sort|uniq)
if [ -z "$diff" ];
then
echo not change
else
curl -G \
--data-urlencode "text=${diff}" \
--data-urlencode "chat_id={YouID}" \
https://api.telegram.org/bot{YouToken}/sendmessage
echo $diff
fi
mv current.txt last.txt
}
while true
do
CveMonitor
sleep 6
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment