Wooyun BUGs finder

From NAT, 7 Years ago, written in Bash, viewed 653 times.
URL https://code.nat.moe/view/866b159e Embed
Download Paste or View Raw
  1. #!/bin/bash
  2. # date-fetch: get the list of bugs on wooden that publish after a given date.
  3.  
  4. CHANNEL=new_public
  5. IFS=$'\n'
  6. TMP=$TMPDIR/wooyun-fetch.tmp
  7.  
  8. function fetch {
  9.         curl http://www.wooyun.org/bugs/$CHANNEL/page/$1|grep -E '<th>20|<td><a href'|sed -e 's/<th>//g; s/<\/th>/: /g; '|tr -d '\t'|tr -d '\r\n'|sed -e 's/<\/a>/\
  10. /g; s/<td><a href="/http:\/\/www.wooyun.org/g; s/">/ /g' 2> /dev/null
  11. }
  12.  
  13. function main {
  14.         read -p "View the bugs after (YYYY-MM-DD): " key
  15.         read -p "                     Search from: " from
  16.         read -p "                              To: " to
  17.         for page in $(seq $from $to)
  18.         do
  19.                 fetch $page > $TMP 2> /dev/null
  20.                 for bug in $(cat $TMP)
  21.                 do
  22.                         _date=$(echo $bug | awk -F": " '{print $1}' | sed -e "s/-/,/g; s/,0/,/g;")
  23.                         _def_date=$(echo $key | sed -e "s/-/,/g; s/,0/,/g;")
  24.                         [[ $(python -c "from datetime import date; print (date($_date)-date($_def_date))"|sed -e 's/days.*//g') > 0 ]] && echo $bug
  25.                 done
  26.         done
  27. }
  28. main

Reply to "Wooyun BUGs finder"

Here you can reply to the paste above

captcha