Skip to content

Instantly share code, notes, and snippets.

@labunix
Created May 24, 2012 12:37
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 labunix/2781338 to your computer and use it in GitHub Desktop.
Save labunix/2781338 to your computer and use it in GitHub Desktop.
Debianセキュリティ情報 DSAレポートメール
#!/bin/bash
# Author : labunix
# Description : DSA Report from http://www.debian.org/security
# Last Update : 2012/05/24
set -e
# for proxy
PROXY="/etc/profile.d/proxy.sh"
test -x "$PROXY" && . "$PROXY"
# for home directory
echo "$HOME" | grep "`whoami`" | HOME="/home/`whoami`"
cd "$HOME" || exit 1
# for debian security URL
HURL="www.debian.org"
test -d "$HURL" || mkdir "$HURL"
cd "$HURL" || exit 1
# diff settings
HGET="getlist.txt"
BASE="base.txt"
COMP="comp.txt"
test -f "$HGET" || touch "$HGET"
test -f "$BASE" || touch "$BASE"
test -f "$COMP" || touch "$COMP"
# get debian security list
w3m -dump "http://${HURL}/security" | grep "\[.*DSA" > "$COMP"
# diff to BASE ?
diff --left-column "$BASE" "$COMP" | sed s/"> "//g | grep "DSA" > "$HGET"
# mail
if [ -s "$HGET" ];then
cat "$HGET" | mail -s "Debian Security Report" root
mv "$COMP" "$BASE"
else
echo "Do Nothing"
fi
unset PROXY HOME HURL HDAY HGET BASE COMP
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment