Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.

Get firewall statistics

#!/bin/bash
# Filename: fwanalogcron.sh
# Version: 140112
# Author: robz
# This script runs fwanalog to analyse ufw statistics and notify you to view.
# You'll need fwanalog from the repositories, a dingdong.wav sound and an icon.
# Use this in your root crontab, it'll run the script at 6 hour intervals.
# 05 */6 * * * export DISPLAY=:0 && $HOME/.scripts/security_scripts/fwlogcron
# > /dev/null 2>&1    # NB. All on one line for cron, no newline breaks!
# You could set up a launcher using the one of the commented out lines at the
# end of this script in the "Command" box, uncomment the line to start a up a
# browser automatically, or just go to /var/log/fwanalog/ and open any .html
# that tickles yer fancy.

MYFILE="robz"                                           
# Your user name.
SOUND=
"/home/robz/Audio/DingLing.wav"                   # Path to sound file.
ICON="/home/robz/Pictures/Firewall.png"                 # Path to icon file.

rm -f /var/log/fwanalog/fwanalog.lock                   # Delete any residuals.

fwanalog -t                                             # Analyze today.
# fwanalog -y                                           # Analyze yesterday.
sudo chown -R "$MYFILE" '/var/log/fwanalog/'            # Allow user access.

notify-send -i "$ICON" "New firewall stats are ready" \
"View at: /var/log/fwanalog/today.html"                 # Announce new stats.
/usr/bin/canberra-gtk-play --volume 2 -f $SOUND         # HELLO, stats :)

#google-chrome --incognito %U file:///var/log/fwanalog/today.html
#chromium-browser --incognito %U file:///var/log/fwanalog/today.html
#firefox --private-toggle %U file:///var/log/fwanalog/today.html
#opera --newprivatetab %U file:///var/log/fwanalog/today.html


No comments: