diff options
author | Joseph Graham <joseph@xylon.me.uk> | 2017-06-03 18:48:12 +0100 |
---|---|---|
committer | Joseph Graham <joseph@xylon.me.uk> | 2017-06-03 18:48:12 +0100 |
commit | ff6119f99a9a4c804936a8e07f69a2d94795a77a (patch) | |
tree | 0fbf083551594e75366f6efff3c69000b515ea6b /bug_tracker_change_detector | |
parent | e1c4ef87e665a1a8476e063f03797f4e0496ac8b (diff) |
started abusing it to spam the channel and other users on
FreeNode. The feature could be secured but since nobody normally uses
it anyway I think it's not worth it.
Also tidied up to code a bit and got rid of some old files.
Diffstat (limited to 'bug_tracker_change_detector')
-rwxr-xr-x | bug_tracker_change_detector | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/bug_tracker_change_detector b/bug_tracker_change_detector deleted file mode 100755 index e4de7ba..0000000 --- a/bug_tracker_change_detector +++ /dev/null @@ -1,94 +0,0 @@ -#! /bin/bash - -while true -do - source common_codez - - log_file=bug_sums - - temp_file=$( mktemp ) - - temp_changes=$( mktemp ) - - changes="/tmp/un-provoked-message-store" - - for url in $( curl --compressed "https://bugs.parabolagnulinux.org/bugs/issue?@pagesize=99999" 2> /dev/null | grep -E 'href="issue[[:digit:]]+' | cut -d '"' -f 2 ) - do - tfile="$( mktemp )" - - try_count=1 - - # Get the URL and make sure it's not empty. - until curl --compressed "https://bugs.parabolagnulinux.org/bugs/${url}" > "${tfile}" 2> /dev/null && (( $( wc -l "${tfile}" 2> /dev/null | cut -d ' ' -f 1 ) )) - do - # The time we sleep doubles each time up to a maximum of 512 - # seconds, before restarting the entire script. - sleep "${try_count}" - - if (( try_count < 512 )) - then - try_count=$(( try_count * 2 )) - else - continue 2 - fi - done - - echo "${url} $( md5sum < ${tfile} | cut -d ' ' -f 1 )" >> "${temp_file}" - - rm "${tfile}" - done - - # Check that the log file is not empty as a sanity check. TODO record WHEN - # it last checked the bug tracker for changes so we can also check if it was - # too long ago. - if (( $( wc -l "${log_file}" 2> /dev/null | cut -d ' ' -f 1 ) )) - then - cat "${temp_file}" | - while read -r line - do - bug_number="${line%% *}" - # If this bug is not in the log file then it must be new. - if { ! grep "${bug_number}" "${log_file}" > /dev/null ; } - then - tdir="$( mktemp -d )" - curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%<title>%1' - bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) - cat ${tdir}/xx* | csplit -f "${tdir}/gg" - '%<th class="required">Priority</th>%1' - priority=$( head -1 ${tdir}/gg* ) - priority=${priority#*>} - priority=${priority%<*} - rm -r "${tdir}" - echo "${bug_number} created: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title% - Parabola\'s issue tracker} [${priority}])" >> "${temp_changes}" - # It is in the log file so now we check if the entire line is there, - # because if it's not then the md5sum must have changed. - elif { ! grep "${line}" "${log_file}" > /dev/null ; } - then - tdir="$( mktemp -d )" - curl --compressed "https://bugs.parabolagnulinux.org/bugs/${bug_number}" 2> /dev/null | csplit -f "${tdir}/xx" - '%<title>%1' - bug_title=$( head -1 ${tdir}/xx* | replace_wierd_html_chars ) - cat ${tdir}/xx* | csplit -f "${tdir}/gg" - '%<th class="required">Priority</th>%1' - priority=$( head -1 ${tdir}/gg* ) - priority=${priority#*>} - priority=${priority%<*} - rm -r "${tdir}" - echo "${bug_number} changed: https://bugs.parabolagnulinux.org/bugs/${bug_number} (${bug_title% - Parabola\'s issue tracker} [${priority}])" >> "${temp_changes}" - fi - done - fi - - if (( $( wc -l "${temp_changes}" 2> /dev/null | cut -d ' ' -f 1 ) > 12 )) - then - echo "More than 12 changes have been detected on the bug tracker. Ignoring." >> "${changes}" - else - while read line - do - echo "${line}" >> "${changes}" - done < "${temp_changes}" - fi - - mv "${temp_file}" "${log_file}" - - rm -f "${temp_changes}" - - sleep 5m -done |