Last active
October 31, 2021 15:18
-
-
Save code-scan/b620fa80e6ed4fd1799b1dd2d441bed2 to your computer and use it in GitHub Desktop.
github-CveMonitor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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