Last active
July 21, 2017 06:16
-
-
Save seadog007/3ad6c54916796aa495bb4525c1560f8b to your computer and use it in GitHub Desktop.
HITCON ZeroDay publish notification to Telegram channel
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
#!/bin/bash | |
token='token_only' | |
disable_preview='True' | |
for i in `seq 1 10` | |
do | |
curl -s https://zeroday.hitcon.org/vulnerability/disclosed/page/$i | grep vu-l-data-titl | tr -d $'\t' | \ | |
while read line | |
do | |
link=`echo $line | grep -oP '<a\ href="\K.*(?=")'` | |
title=`echo $line | grep -oP '<a.*">\K.*(?=</a)'` | |
[ -z "`grep $link sent`" ] && res=`curl -s 'https://zeroday.hitcon.org'$link | tr -d $'\t' | tr -d '\r' | tr -d '\n' ` | |
org=`echo $res | grep -oP '<span class="label">Vendor: </span> <span class="value">\K.*?(?=<)'` | |
detail=`echo $res | grep -oP '<h3>敘述<\/h3>.*?<p>\K.*?(?=</p)'| sed 's/<br\ \/>/\\n/g'` | |
dis_date=`echo $res | grep -oP '<li><span class="stat-log-date">\K.*?(?=<.*新)' | head -n1` | |
pub_date=`echo $res | grep -oP '<li><span class="stat-log-date">\K.*?(?=<.*)' | tail -n1` | |
output=`echo -ne "發現日期:$dis_date\n公開日期:$pub_date\n\n標題:$title\n\n單位:$org\n\n敘述:\n$detail\n\n引用來源:https://zeroday.hitcon.org$link" | sed -e 's/&/%26/g' -e "s/'/%27/g"` | |
[ -z "`grep $link sent`" ] && echo 'sending '$link && curl -s -o /dev/null --data "chat_id=-1001111646175&disable_web_page_preview=$disable_preview&text=$output" -X GET 'https://api.telegram.org/bot'$token'/sendMessage' && echo $link >> sent | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment