Cleaned this repo up some, moved irssi scripts into a folder, removed old awful or broken scripts, removed projects that hve since been given their own repo
This commit is contained in:
parent
ac800cb412
commit
a2264b2e07
|
@ -0,0 +1,13 @@
|
|||
script-collection
|
||||
=================
|
||||
|
||||
Preface
|
||||
-------
|
||||
|
||||
I write scripts a lot. Partly as a hobby, partly to make my own work easier and partly for my job.
|
||||
I tend to choose whatever language is most appropriate for what I'm doing, although I usually prefer perl or bash.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Unless otherwise stated, all scripts and code in this repo are licensed under the 3-clause BSD license.
|
52
abused
52
abused
|
@ -1,52 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Binaries
|
||||
LOGGER_BIN=$(command -v logger)
|
||||
LOGGER_ARGS="-s -t abused"
|
||||
VZPS=0
|
||||
PS_BIN=$(command -v ps)
|
||||
VZPS_BIN=$(command -v vzps)
|
||||
if [ $? -eq 0 ]; then VZPS=1; fi
|
||||
KILL_BIN=$(command -v kill)
|
||||
PS_ARGS="aux"
|
||||
VZPS_ARGS="-E"
|
||||
|
||||
#Processes to kill
|
||||
PROCS='dos2.pl stealth kaiten dos.pl exploit msfconsole ddos tfn-child tfn-daemon trinoo lool slap.pl brute pscan2 SpyEyeCollector trinity shaft vadimII vadimii vadim2 vadimI xdestroy xshock udp.pl trash trash2 synsend synk synk7 synhose stream stream2 smurf5 smurf6 smack slice2 slice3 sl2 sl3 rc8 overdrop nestea juno da.sh bloop alpha udp2.pl fiberlamp'
|
||||
|
||||
#If possible, we use vzps. We fall back to standard `ps` in cases where vzps is not available (not all our servers have it)
|
||||
PSOUT=""
|
||||
if [ $VZPS -eq 1 ]; then
|
||||
PSOUT=$($VZPS_BIN $PS_ARGS $VZPS_ARGS)
|
||||
else
|
||||
PSOUT=$($PS_BIN $PS_ARGS)
|
||||
fi
|
||||
|
||||
#Could probably be done better
|
||||
OUT=""
|
||||
IFSB="$IFS"
|
||||
IFSN="
|
||||
"
|
||||
PROCS=$(echo $PROCS|perl -pe 's/ /|/g')
|
||||
OUT=$(echo "$PSOUT"|egrep "$PROCS")
|
||||
IFS=$IFSN
|
||||
for proc in $OUT; do
|
||||
IFS=$IFSB
|
||||
CTID="NaN"
|
||||
PID=""
|
||||
CMDLINE=""
|
||||
if [ $VZPS -eq 1 ]; then
|
||||
CTID=$(echo "$proc"|awk '{print $1}')
|
||||
PID=$(echo "$proc"|awk '{print $3}')
|
||||
else
|
||||
PID=$(echo "$proc"|awk '{print $2}')
|
||||
fi
|
||||
CMDLINE=$(echo "$proc"|perl -pe 's/.*:.*:[0-9]+ //')
|
||||
if [ "$CTID" != "0" ]; then
|
||||
$LOGGER_BIN $LOGGER_ARGS -- Potentially abusive process \<$CMDLINE\>/$PID in CT $CTID killed! 2>>/var/log/abusers.log
|
||||
else
|
||||
$LOGGER_BIN $LOGGER_ARGS -- Found odd process running under CT 0: \<$CMDLINE\>/$PID 2>>/var/log/abusers.log
|
||||
fi
|
||||
IFS=$IFSN
|
||||
done
|
||||
IFS=$IFSB
|
|
@ -1,319 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#rdns.sh - script for dealing with rDNS.
|
||||
|
||||
#TODO
|
||||
#Add more _BIN variables to decrease reliance on $PATH
|
||||
#IPv6 support
|
||||
#Finish domain validation function
|
||||
#RDNS_QUERY_SERVER round-robin?
|
||||
|
||||
#variables
|
||||
PROVIDERNAME=""
|
||||
DEFAULT_RDNS="hosted-by.$PROVIDERNAME."
|
||||
ZONE_LOCATION="/var/named/"
|
||||
ZONE_TAIL="in-addr.arpa"
|
||||
ZONE_FTAIL=".db"
|
||||
SYNC_SCRIPT="/scripts/dnscluster synczone"
|
||||
RDNS_QUERY_SERVER="8.8.4.4"
|
||||
DIG_BIN="$(command -v dig)"
|
||||
if [ $? -ne 0 -o -z "$DIG_BIN" ]; then
|
||||
echo "Failed to locate 'dig'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#functions
|
||||
function usage () {
|
||||
# Usage function. Obvious.
|
||||
echo "$0 - Usage
|
||||
$0 ip.address : Show current rDNS for the given IP address.
|
||||
$0 ip.address dns.address : Set given IP address's rDNS to the given DNS address.
|
||||
$0 -v ip.address dns.address : Set given IP's rDNS, and verify it after syncing.
|
||||
$0 -nv ip.address dns.address : Set given IP's rDNS without checking forward DNS first.
|
||||
$0 -r ip.address : Reset given IP's rDNS to the default ($DEFAULT_RDNS).
|
||||
$0 -rS ip.address : Reset given IP's rDNS as -r does, but don't sync to DNS cluster.
|
||||
$0 -R ip.address : Remove the given IP's rDNS entry altogether.
|
||||
$0 -S ip.address : Sync the authoritative zone for the given IP address to the DNS cluster.
|
||||
$0 [-h|--help] : Show this help text."
|
||||
}
|
||||
|
||||
function validateIP () {
|
||||
#validateIP - validates a given IP to ensure it isn't invalid.
|
||||
local IP=$1
|
||||
local stat=1
|
||||
#Regex to do basic IP validation.
|
||||
if [[ $IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
OIFS=$IFS
|
||||
IFS="."
|
||||
IP=($IP)
|
||||
IFS=$OIFS
|
||||
if [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]; then
|
||||
stat=0
|
||||
else
|
||||
stat=1
|
||||
fi
|
||||
fi
|
||||
return $stat
|
||||
}
|
||||
|
||||
function convertIPToDNSZone () {
|
||||
#Converts a given IP to an in-addr.arpa zone (ie, convertIPToDNSZone 192.210.132.5 would return "132.210.192.in-addr.arpa."
|
||||
OIFS=$IFS
|
||||
set `IFS=".";echo $1`
|
||||
IFS=$OIFS
|
||||
echo $3.$2.$1.$ZONE_TAIL
|
||||
}
|
||||
|
||||
function getLastOctet () {
|
||||
#Gets the last octet of an IP. Since all our IP ranges are /24s, this is okay.
|
||||
OIFS=$IFS
|
||||
set `IFS=".";echo $1`
|
||||
IFS=$OIFS
|
||||
echo $4
|
||||
}
|
||||
|
||||
function validateDomain () {
|
||||
#Validate a given domain to ensure it's a real domain.
|
||||
#This will be implemented later. For now, just please make sure the PTR value is valid.
|
||||
return 0
|
||||
}
|
||||
|
||||
function setRDNS () {
|
||||
#Modify the rDNS record for the given IP.
|
||||
TARGET_IP=$1
|
||||
NEW_PTR=$2
|
||||
ZONEFILE=$(convertIPToDNSZone $TARGET_IP)
|
||||
RECORD=$(getLastOctet $TARGET_IP)
|
||||
if [ ! -w "$ZONE_LOCATION$ZONEFILE$ZONE_FTAIL" ]; then
|
||||
echo "Failed to locate: $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL"
|
||||
return 1
|
||||
fi
|
||||
CUR_REC=$(getRDNS $TARGET_IP)
|
||||
if [ $? -ne 0 ]; then
|
||||
#we create the record
|
||||
APPENDREC="$RECORD 14400 IN PTR $DEFAULT_RDNS"
|
||||
#This is disabled for now. We warn, but do not touch.
|
||||
echo "$APPENDREC" >> $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL
|
||||
echo "Warning: Record for $TARGET_IP did not exist, new record has been created."
|
||||
CUR_REC=$(getRDNS $TARGET_IP)
|
||||
fi
|
||||
#I would use sed for this, but for some reason I can't get match groups to work in sed.
|
||||
perl -pi.bak -e "s/^($RECORD\s+.*)\s$CUR_REC/\1\t$NEW_PTR/" $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL
|
||||
return 0
|
||||
}
|
||||
|
||||
function getRDNS () {
|
||||
#Retrieve the current rDNS record (if any) for the given IP
|
||||
ZONEFILE=$(convertIPToDNSZone $1)
|
||||
RECORD=$(getLastOctet $1)
|
||||
if [ ! -w "$ZONE_LOCATION$ZONEFILE$ZONE_FTAIL" ]; then
|
||||
echo "Failed to locate: $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL"
|
||||
return 1
|
||||
fi
|
||||
ZRECORD=$(egrep "^$RECORD\s.*PTR" $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ZONEFILE: $ZONEFILE$ZONE_FTAIL ; LAST OCTET: $RECORD"
|
||||
return 1
|
||||
fi
|
||||
echo $ZRECORD|perl -pe 's/^.*PTR\s+//'
|
||||
return 0
|
||||
}
|
||||
|
||||
function removeRDNS () {
|
||||
TARGET_IP=$1
|
||||
ZONEFILE=$(convertIPToDNSZone $TARGET_IP)
|
||||
RECORD=$(getLastOctet $TARGET_IP)
|
||||
CUR_PTR="$(getRDNS $TARGET_IP)"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "rDNS entry doesn't exist for $TARGET_IP!"
|
||||
return 1
|
||||
fi
|
||||
perl -pi.bak -e "s/^($RECORD\s+.*\n)//" $ZONE_LOCATION$ZONEFILE$ZONE_FTAIL
|
||||
}
|
||||
|
||||
function verifyRDNS () {
|
||||
#Check that the rDNS was actually set, using 'host'.
|
||||
HOSTOUT=$($DIG_BIN @$RDNS_QUERY_SERVER +short -x $1|sed 's/^[\s ]+//'|sed 's/[\s ]+$//')
|
||||
if [ "$HOSTOUT" != "$2" ]; then
|
||||
echo $HOSTOUT
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function checkForwardDNS () {
|
||||
#Verify that forward DNS is set properly, using 'dig'. This specifically requests an A record, we won't need to worry about AAAA records for a while.
|
||||
DIGOUT="$($DIG_BIN @$RDNS_QUERY_SERVER +short $1 A)"
|
||||
if [ "$DIGOUT" != "$2" ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
#main script
|
||||
MODE=""
|
||||
GOPTS=""
|
||||
IPADDR=""
|
||||
DESTDNS=""
|
||||
ZONE_FILE=""
|
||||
DO_SYNC=0
|
||||
|
||||
#Get options and arguments. I do this old school because I'm too lazy to l2getopts
|
||||
if [ "$1" == "-h" -o "$1" == "-r" -o "$1" == "-v" -o "$1" == "-R" -o "$1" == "-nv" -o "$1" == "-rS" -o "$1" == "-S" ]; then
|
||||
GOPTS="$1"
|
||||
IPADDR="$2"
|
||||
DESTDNS="$3"
|
||||
else
|
||||
IPADDR="$1"
|
||||
DESTDNS="$2"
|
||||
fi
|
||||
#First, we ensure that DESTDNS ends with a period.
|
||||
#We make sure the new PTR value ends with a period.
|
||||
if [ ! -z "$DESTDNS" ]; then
|
||||
TAILREC="$(echo $DESTDNS|tail -c2)"
|
||||
if [ "$TAILREC" != "." ]; then
|
||||
DESTDNS="$DESTDNS."
|
||||
fi
|
||||
fi
|
||||
#First we get usage out of the way. Usage is shown if there are no options, or if the only option given is -h, or if $IPADDR is empty.
|
||||
if [ -z "$IPADDR" -o "$GOPTS" == "-h" ]; then
|
||||
usage
|
||||
exit
|
||||
fi
|
||||
|
||||
#Then we validate input. $IPADDR should -always- be an IP address, and $DESTDNS should always be a valid DNS address that exists.
|
||||
validateIP $IPADDR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: IP address given ($IPADDR) was not valid."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
#Now we can be sure the IP address given exists. Get our "mode" and then start working.
|
||||
case $GOPTS in
|
||||
-r)
|
||||
MODE="RESET"
|
||||
;;
|
||||
-rS)
|
||||
MODE="RESETNOSYNC"
|
||||
;;
|
||||
-R)
|
||||
MODE="REMOVE"
|
||||
;;
|
||||
-S)
|
||||
MODE="NOOP"
|
||||
DO_SYNC="1"
|
||||
;;
|
||||
-v) MODE="SETANDVALIDATE"
|
||||
;;
|
||||
*)
|
||||
if [ ! -z "$DESTDNS" ]; then
|
||||
MODE="SET"
|
||||
elif [ ! -z "$IPADDR" ]; then
|
||||
MODE="GET"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ "$MODE" == "SET" -a "$GOPTS" == "-nv" ]; then
|
||||
MODE="SETNOVERIFY"
|
||||
fi
|
||||
#We do the work.
|
||||
case $MODE in
|
||||
RESET)
|
||||
setRDNS $IPADDR $DEFAULT_RDNS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to set rDNS!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS set!"
|
||||
DO_SYNC=1
|
||||
;;
|
||||
RESETNOSYNC)
|
||||
setRDNS $IPADDR $DEFAULT_RDNS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to set rDNS!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS set!"
|
||||
;;
|
||||
GET)
|
||||
RDNS=$(getRDNS $IPADDR)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to get rDNS for '$IPADDR'! Message: $RDNS"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS for '$IPADDR': $RDNS"
|
||||
;;
|
||||
SET)
|
||||
checkForwardDNS $DESTDNS $IPADDR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Forward DNS does not match requested reverse!"
|
||||
exit 1
|
||||
fi
|
||||
setRDNS $IPADDR $DESTDNS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to set rDNS!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS set!"
|
||||
DO_SYNC=1
|
||||
;;
|
||||
SETNOVERIFY)
|
||||
checkForwardDNS $DESTDNS $IPADDR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Warning: Forward DNS does not match requested reverse! Continuing anyway.."
|
||||
fi
|
||||
setRDNS $IPADDR $DESTDNS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to set rDNS!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS set!"
|
||||
DO_SYNC=1
|
||||
;;
|
||||
SETANDVALIDATE)
|
||||
checkForwardDNS $DESTDNS $IPADDR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Forward DNS does not match requested reverse!"
|
||||
exit 1
|
||||
fi
|
||||
setRDNS $IPADDR $DESTDNS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to set rDNS!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS set!"
|
||||
DO_SYNC=1
|
||||
;;
|
||||
REMOVE)
|
||||
removeRDNS $IPADDR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to remove rDNS record!"
|
||||
exit 1
|
||||
fi
|
||||
echo "rDNS record removed!"
|
||||
DO_SYNC=1
|
||||
;;
|
||||
NOOP)
|
||||
;;
|
||||
*)
|
||||
echo "Clearly, you used this script incorrectly."
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $DO_SYNC -eq 1 ]; then
|
||||
$SYNC_SCRIPT $(convertIPToDNSZone $IPADDR)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Sync failed!"
|
||||
fi
|
||||
if [ "$MODE" == "SETANDVALIDATE" ]; then
|
||||
sleep 5
|
||||
FORWARDDNS=$(verifyRDNS $IPADDR $DESTDNS)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Current rDNS for $IPADDR ($FORWARDDNS) does not match '$DESTDNS'!"
|
||||
else
|
||||
echo "rDNS was properly synchronised and is set to '$DESTDNS'."
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -3,24 +3,25 @@
|
|||
use strict;
|
||||
|
||||
use vars qw($VERSION %IRSSI);
|
||||
$VERSION = '2014112900';
|
||||
$VERSION = '2003021201';
|
||||
%IRSSI = (
|
||||
authors => 'Stefan \'tommie\' Tomanek, Maff',
|
||||
contact => 'stefan@pico.ruhr.de, maff+irssi@maff.scot',
|
||||
authors => 'Stefan \'tommie\' Tomanek',
|
||||
contact => 'stefan@pico.ruhr.de',
|
||||
name => 'QueryResume',
|
||||
description => 'restores the last lines of a query on re-creation',
|
||||
license => 'GPLv2',
|
||||
modules => 'Date::Format',
|
||||
modules => 'Date::Format File::Glob',
|
||||
changed => $VERSION,
|
||||
);
|
||||
|
||||
use Irssi 20020324;
|
||||
use Date::Format;
|
||||
use File::Glob ':glob';
|
||||
|
||||
# Modified to remove unnecessary footer, replace actual "box" with greyed-out text
|
||||
sub draw_box ($$$) {
|
||||
my ($title, $text, $colour) = @_;
|
||||
my $box = '%K%U« '.$title.' »%U%n'."\n";
|
||||
my $box = '';
|
||||
$box .= '%K%U« '.$title.' »%U%n'."\n";
|
||||
foreach (split(/\n/, $text)) {
|
||||
$box .= '%K'.$_."%n\n";
|
||||
}
|
||||
|
@ -28,7 +29,6 @@ sub draw_box ($$$) {
|
|||
return $box;
|
||||
}
|
||||
|
||||
# Heavily modified. Stylistic changes, reordering, added some intelligence so it loads the last non-tiny log if possible
|
||||
sub sig_window_item_new ($$) {
|
||||
my ($win, $witem) = @_;
|
||||
return unless (ref $witem && $witem->{type} eq 'QUERY');
|
||||
|
@ -42,6 +42,7 @@ sub sig_window_item_new ($$) {
|
|||
$autolog =~ s/([\]\[])/\\$1/g;
|
||||
$autolog =~ s/\/[\{\}a-zA-Z0-9_\-\.]*$//;
|
||||
my @files = get_sorted_files($autolog);
|
||||
return unless scalar @files;
|
||||
my $filename;
|
||||
foreach(@files) {
|
||||
$filename=$_ and last if -s $_ >= 300;
|
||||
|
@ -60,10 +61,9 @@ sub sig_window_item_new ($$) {
|
|||
$witem->print(draw_box("Last $lines lines from log $filename", $text, 1), MSGLEVEL_CLIENTCRAP & MSGLEVEL_NEVER) if $text;
|
||||
}
|
||||
|
||||
# Added: sort a list of files in a directory by date.
|
||||
sub get_sorted_files ($) {
|
||||
my $path = shift; $path =~ s/~/$ENV{HOME}/;
|
||||
opendir my($dirh), $path or die "can't opendir $path: $!";
|
||||
opendir my($dirh), $path or return;
|
||||
my @flist = sort { -M $a <=> -M $b }
|
||||
map { "$path/$_" }
|
||||
grep { !/^\.{1,2}$/ }
|
||||
|
@ -74,3 +74,4 @@ sub get_sorted_files ($) {
|
|||
|
||||
Irssi::settings_add_int($IRSSI{name}, 'queryresume_lines', 10);
|
||||
Irssi::signal_add('window item new', 'sig_window_item_new');
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# spotify_uri.pl
|
||||
# Purpose: converts http:// spotify links to their URI equivalents, so linked tracks open directly in spotify rather than the browser.
|
||||
# Author: Matthew Connelly <maff@maff.me.uk> [maff@freenode,oftc,furnet]
|
||||
#
|
||||
# Version history:
|
||||
# 1.2: - Fixed bug that would've prevented rewriting in queries/possibly caused a crash
|
||||
# - Improved general stability
|
||||
# 1.1: - Fixed segfault which occurred when the user theirself sent a spotify link
|
||||
# - Refined regular expression and consolidated signal handlers into one sub
|
||||
# - Colourised spotify URIs to indicate this script dealt with them
|
||||
# 1.0: - Initial release
|
||||
#
|
||||
# Feature wishlist/TODO:
|
||||
# - Make the spotify regex a configuration option
|
||||
# - Enable configurable formatting
|
||||
# - Maybe add an option to retrieve track/album/artist info from the spotify web API?
|
||||
|
||||
use strict;
|
||||
use 5.6.1;
|
||||
use Irssi;
|
||||
|
||||
my $VERSION = "1.1";
|
||||
|
||||
my %IRSSI = (
|
||||
authors => "Matthew Connelly",
|
||||
contact => "maff\@maff.scot",
|
||||
name => "spotify_uri",
|
||||
description => "Rewrites Spotify URLs to URIs",
|
||||
license => "BSD3",
|
||||
url => "https://maff.scot/",
|
||||
changed => "Thu 26 Jun 2014 23:46:00",
|
||||
);
|
||||
|
||||
my $spotifyex = "(https?:\/\/)?(play|open)\.(spotify)\.com\/([a-z]+)\/([a-zA-Z0-9]+)";
|
||||
|
||||
sub msg_rewrite {
|
||||
my ($server, $msg, $nick, $address, $target) = @_;
|
||||
return if $nick eq $server->{nick};
|
||||
return if $msg !~ /$spotifyex/;
|
||||
$msg =~ s/$spotifyex/\x02\x0303$3:$4:$5\x0f/g;
|
||||
if(defined $target) { Irssi::signal_emit("message public",$server,$msg,$nick,$address,$target); }
|
||||
else { Irssi::signal_emit("message private",$server,$msg,$nick,$address); }
|
||||
Irssi::signal_stop();
|
||||
}
|
||||
|
||||
Irssi::signal_add('message public' => \&msg_rewrite);
|
||||
Irssi::signal_add('message private' => \&msg_rewrite);
|
|
@ -0,0 +1,44 @@
|
|||
use strict;
|
||||
|
||||
use Irssi;
|
||||
use Irssi::Irc;
|
||||
use DateTime;
|
||||
|
||||
use vars qw($VERSION %IRSSI);
|
||||
|
||||
$VERSION = "0.10";
|
||||
%IRSSI = (
|
||||
authors => 'Domen Puncer',
|
||||
contact => 'domen@cba.si',
|
||||
name => 'znc_timestamp',
|
||||
description => 'Replace znc timestamps with native irssi ones',
|
||||
license => 'GPLv2',
|
||||
);
|
||||
|
||||
my $tf = Irssi::settings_get_str('timestamp_format');
|
||||
my $prev_date = '';
|
||||
|
||||
sub msg {
|
||||
action(0,@_);
|
||||
}
|
||||
sub act {
|
||||
action(1,@_);
|
||||
}
|
||||
sub action {
|
||||
my ($action,$server, $text, $nick, $address, $target) = @_; my ($time,$date);
|
||||
$text =~ /^(?:\x01ACTION )?\[([0-9]{2}:[0-9]{2}):[0-9]{2}\] / and $time = $1 or return;
|
||||
Irssi::signal_stop();
|
||||
$text =~ s/\[[0-9:]{8}\] //;
|
||||
$date = DateTime->now->ymd;
|
||||
my $window = Irssi::window_find_item(defined $target? $target : $nick) or undef;
|
||||
$window->print("Day changed to $date", MSGLEVEL_NEVER) if defined $window and $date ne $prev_date;
|
||||
$prev_date = $date;
|
||||
Irssi::settings_set_str('timestamp_format', $time);Irssi::signal_emit('setup changed');
|
||||
if(defined $target) {Irssi::signal_emit(($action? 'message irc action' : 'message public'),$server,$text,$nick,$address,$target);}
|
||||
else {Irssi::signal_emit('message private',$server,$text,$nick,$address);}
|
||||
Irssi::settings_set_str('timestamp_format', $tf);Irssi::signal_emit('setup changed');
|
||||
}
|
||||
|
||||
Irssi::signal_add('message public','msg');
|
||||
Irssi::signal_add('message private','msg');
|
||||
Irssi::signal_add('message irc action','act');
|
154
pscrot
154
pscrot
|
@ -1,154 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
## Perl script for screenshot management
|
||||
|
||||
package Maff::Utils::PScrot;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# github:MaffC/maffpl.git provides the Maff:: namespace
|
||||
use Maff::Common::OSX qw/:all/;
|
||||
use Maff::Common::Net qw/scp_upload/;
|
||||
|
||||
use Date::Format qw/time2str/;
|
||||
use POE;
|
||||
use POE::Component::DirWatch;
|
||||
use POSIX;
|
||||
use Unix::PID;
|
||||
|
||||
my $ME = "pscrot";
|
||||
my $VERSION = "0.6.1";
|
||||
my $HOSTNAME = `hostname`; chomp $HOSTNAME;
|
||||
|
||||
# Load config file at ~/.pscrotrc.
|
||||
my $rcfile = $ENV{"HOME"}."/.pscrotrc";
|
||||
our %Conf;
|
||||
load_config($rcfile);
|
||||
|
||||
my $LOGFILE = "$Conf{home}/.$ME.log";
|
||||
my $ERRFILE = "$Conf{home}/.$ME.err";
|
||||
my $PIDFILE = "$Conf{home}/.$ME.pid";
|
||||
|
||||
my $retries = 0; # set to -1 to disable upload retrying
|
||||
my $running = 0;
|
||||
my $sighup = 0;
|
||||
|
||||
# Functions
|
||||
sub load_config {
|
||||
my $cfgfile = shift;
|
||||
unless(my $ret = do $cfgfile) {
|
||||
logger(9, "Couldn't parse config file $cfgfile!") if $@;
|
||||
logger(9, "Couldn't load config file $cfgfile!") unless defined $ret and $ret;
|
||||
}
|
||||
}
|
||||
sub mac_notify {
|
||||
return unless $Conf{features}{notify};
|
||||
macintalk_say text=>$_[($_[0] eq $ME)? 1 : 0] if $Conf{features}{speak};
|
||||
nc_notify @_;
|
||||
}
|
||||
sub sigtrap {
|
||||
my $sig = shift;
|
||||
logger(2, "Caught SIG$sig: Exiting..");
|
||||
$running = 0;
|
||||
}
|
||||
sub sighup {
|
||||
logger(2, "Caught SIGHUP: Restarting..");
|
||||
$running = 0;
|
||||
$sighup = 1;
|
||||
}
|
||||
sub logger {
|
||||
my $pri = shift;
|
||||
my $msg = shift;
|
||||
print time2str('%e %B %T', time)." $HOSTNAME $ME\[$$] ($pri): $msg\n";
|
||||
print STDERR time2str('%e %B %T', time)." $HOSTNAME $ME\[$$] ($pri): $msg\n" if $pri =~ /^[29]$/;
|
||||
mac_notify($ME,$msg) if $pri == 3;
|
||||
exit 0 if $pri == 8;
|
||||
exit 1 if $pri == 9;
|
||||
return $pri;
|
||||
}
|
||||
sub push_file {
|
||||
my $file = shift;
|
||||
while(1) {
|
||||
last if scp_upload(file=>$file,%{$Conf{server}}) or $retries++ =~ /^(-1|2)$/;
|
||||
if($retries==1) {
|
||||
logger(1, "Failed to upload $file (try $retries)");
|
||||
logger(3, $Maff::Common::Net::error);
|
||||
sleep 3; # wait a few seconds before retrying
|
||||
} else {
|
||||
logger(2, "max retry limit reached, bailing.");
|
||||
mac_notify("Upload Failed", "Connect retry limit reached; check the log for details.");
|
||||
}
|
||||
}
|
||||
$file = $file->basename; $file =~ s/ /%20/g;
|
||||
my $uri = "http://$Conf{server}{domain}/$file";
|
||||
clipb_copy $uri;
|
||||
mac_notify("File Uploaded", "$uri copied to clipboard.");
|
||||
}
|
||||
sub normalise_filename {
|
||||
my ($name,$dropped) = @_;
|
||||
return time2str($Conf{filenametpl},time).$1 if $dropped and ($name =~ /(\.[a-z0-9]+)$/i or 1);
|
||||
$name =~ $Conf{match}{screenshot} and return "$1 $2.png";
|
||||
return $name;
|
||||
}
|
||||
sub check_file {
|
||||
my $file = shift;
|
||||
return 1 if $file->is_dir;
|
||||
return 0 if $file->basename =~ /^\./;
|
||||
return 1 if $file =~ /^\Q$Conf{hotdir}\E/;
|
||||
foreach my $handled_type (keys %{$Conf{match}}) {
|
||||
return 1 if $file =~ $Conf{match}{$handled_type};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
sub found_file {
|
||||
my $file = shift;
|
||||
my $dropped = ($file =~ /^\Q$Conf{hotdir}\E/) ? 1 : 0;
|
||||
my $nf = normalise_filename($file->basename, $dropped);
|
||||
$file->move_to($Conf{tmp}.$nf);
|
||||
$retries=0 unless $retries==-1;
|
||||
mac_notify("Uploading File", "Uploading $nf...");
|
||||
push_file $file;
|
||||
$file->remove() if $Conf{features}{del} and $dropped;
|
||||
$file->move_to($Conf{storedir}.$nf) unless $dropped;
|
||||
}
|
||||
|
||||
# Main
|
||||
POE::Kernel->run();
|
||||
my $pid = Unix::PID->new()->is_pidfile_running($PIDFILE) || 0;
|
||||
kill 'HUP', $pid and logger(8, "$ME already running, restarting.") if $pid != $$ and $pid > 0;
|
||||
Unix::PID->new()->pid_file($PIDFILE) or logger(9, "Failed to write PID to $PIDFILE");
|
||||
open(STDOUT, ">>$LOGFILE");
|
||||
open(STDERR, ">>$ERRFILE");
|
||||
select((select(STDOUT), $|=1)[0]);
|
||||
logger(1,"Starting $ME..");
|
||||
|
||||
$running = 1;
|
||||
|
||||
$SIG{HUP} = \&sighup;
|
||||
$SIG{INT} = \&sigtrap;
|
||||
$SIG{QUIT} = \&sigtrap;
|
||||
$SIG{TERM} = \&sigtrap;
|
||||
|
||||
POE::Session->create(
|
||||
inline_states => {
|
||||
_start => sub {
|
||||
$_[HEAP]->{screengrabs} = POE::Component::DirWatch->new(
|
||||
alias => 'screengrabs',
|
||||
directory => $Conf{maindir},
|
||||
filter => \&check_file,
|
||||
file_callback => \&found_file,
|
||||
interval => 1,
|
||||
);
|
||||
$_[HEAP]->{dropbox} = POE::Component::DirWatch->new(
|
||||
alias => 'dropbox',
|
||||
directory => $Conf{hotdir},
|
||||
filter => \&check_file,
|
||||
file_callback => \&found_file,
|
||||
interval => 2, # decreased polling speed for the dropbox
|
||||
) if $Conf{features}{hotdir};
|
||||
}}
|
||||
);
|
||||
logger(1, "$ME version $VERSION started.");
|
||||
POE::Kernel->run_while(\$running);
|
||||
logger($sighup? 1 : 8,"Halting $ME..");
|
||||
exec $^X, $0, @ARGV;
|
33
pscrot.rc
33
pscrot.rc
|
@ -1,33 +0,0 @@
|
|||
# vim: set syntax=perl:
|
||||
#By default, $HOME is set to the home directory indicated in your environment variables.
|
||||
#If this doesn't exist or you wish to override it, set it below.
|
||||
my $HOME = $ENV{"HOME"};
|
||||
my %server = (
|
||||
host => "", # ssh hostname for destination server
|
||||
port => 22, # ssh port
|
||||
user => scalar getpwuid($<), # username. by default, pscrot will use your local username
|
||||
key => "$HOME/.ssh/id_rsa", # ssh key used for authentication. must not be password-protected
|
||||
path => "/usr/local/www/uploads/", # remote destination
|
||||
domain => "", # public domain where the uploaded file can be accessed
|
||||
);
|
||||
my %match = (
|
||||
screenshot => qr/(?:^|\/)Screen Shot ([0-9\-]+) at ([0-9\.]+)\.png$/, # regular expression matching OSX's screenshot format
|
||||
screencast => qr/wowsoscreencastmanygayplaceholders/, # regular expression matching recorded screencasts
|
||||
);
|
||||
my %features = (
|
||||
hotdir => 1, # enable monitoring the "hot" directory
|
||||
del => 1, # delete files from the hot directory after upload
|
||||
notify => 1, # notify of upload status via the OSX notification centre
|
||||
speak => 0, # off by default due to limited utility. speak upload status aloud using OSX MacInTalk
|
||||
);
|
||||
%Conf = (
|
||||
home => $HOME,
|
||||
tmp => "$HOME/.tmp/", # tmp is used to temporarily store files during upload
|
||||
maindir => "$HOME/Desktop/", # directory to monitor for screenshots. defaults to /Desktop for OSX users' convenience
|
||||
hotdir => "$HOME/outbox/", # this is a "hot" directory, any files inside will be automatically uploaded
|
||||
storedir => "$HOME/Dropbox/Camera Uploads/", # where files will be moved after upload. note that files uploaded from the hotdir will not be moved here.
|
||||
filenametpl => "%Y-%m-%d %H.%M.%S", # format for uploaded files, uses strftime(3) formatting.
|
||||
server => \%server,
|
||||
match => \%match,
|
||||
features => \%features,
|
||||
);
|
25
readme.md
25
readme.md
|
@ -1,25 +0,0 @@
|
|||
script-collection
|
||||
=================
|
||||
|
||||
Preface
|
||||
-------
|
||||
|
||||
I write scripts a lot. Partly as a hobby, partly to make my own work easier and partly for my job.
|
||||
I tend to choose whatever language is most appropriate for what I'm doing, although I usually prefer Bash.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Unless otherwise stated, all scripts and code in this repo are licensed under the 3-clause BSD license.
|
||||
|
||||
Scripts
|
||||
-------
|
||||
|
||||
This readme contains an up to date list of all scripts in the repo + their descriptions:
|
||||
- aslookup: Perl - Script to look up ASN information for a given IP or ASN
|
||||
- ifls: Perl - Script to collect all interfaces on the system and provide an easily-viewed list of their IPs
|
||||
- mailview: Perl - Script to parse HTML email and format it in a text-reader-friendly way.
|
||||
- nscheck: Bash - DNS diagnosis script
|
||||
- pscrot & pscrot.rc: Perl - OSX-oriented but likely easily ported daemon for uploading screenshots and such. pscrot.rc is the configuration file, and should be stored at ~/.pscrotrc
|
||||
- tnotify: Perl - Cron-based script to notify the user when there are tickets waiting on a WHMCS helpdesk
|
||||
- watchd & watchd.conf: Bash - Script designed to run as a cronjob, alerting the user to any events.
|
152
watchd
152
watchd
|
@ -1,152 +0,0 @@
|
|||
#!/bin/bash
|
||||
# watchd - Bash script to check the integrity/state of a given directory. Meant to be run continuously in cron.
|
||||
# Written 9th January 2013 by Matthew Connelly <maff@maff.me.uk>
|
||||
|
||||
#Internal variables
|
||||
HOSTNAME="$(hostname -f)"
|
||||
HOSTNAME_SHORT="$(hostname -s)"
|
||||
EGREP_BIN="/bin/egrep"
|
||||
FIND_BIN="/bin/find"
|
||||
LS_BIN="/bin/ls"
|
||||
LS_ARGS="-lAd"
|
||||
SENDMAIL_BIN="/usr/sbin/sendmail"
|
||||
STAT_BIN="/usr/bin/stat"
|
||||
STAT_ARGS="-c %a"
|
||||
|
||||
#This should be the full path to your config file
|
||||
CONF_LOCATION="/etc/watchd.conf"
|
||||
|
||||
#Main script
|
||||
source $CONF_LOCATION
|
||||
|
||||
#First we check that we're supposed to be running checks. If not, simply exit as everything that's done after here is check processing.
|
||||
if [ "$ENABLE_CHECKING" != "YES" ]; then
|
||||
exit 0
|
||||
fi
|
||||
#Output variables. OUTPUT is the internal variable which is sent to the state file. HR_OUTPUT is the data that's sent in emails.
|
||||
OUTPUT=""
|
||||
HR_OUTPUT=""
|
||||
#Counters
|
||||
CHANGE_COUNT=0
|
||||
DESTROY_COUNT=0
|
||||
CREATION_COUNT=0
|
||||
F_SKIPPED_COUNT=0
|
||||
PERMCHANGE_COUNT=0
|
||||
OWNERCHANGE_COUNT=0
|
||||
#Delimiters
|
||||
IFSB="$IFS"
|
||||
IFSN="
|
||||
"
|
||||
#First we get a listing of all files.
|
||||
LS_OUT="$($FIND_BIN $WATCH_DIR -type f -exec $LS_BIN $LS_ARGS {} +)"
|
||||
PREVOUT="$(cat $WATCH_STATE_FILE)"
|
||||
IFS="$IFSN"
|
||||
#Format of the state file is as follows: $MD5SUM $OCTAL_PERMISSIONS $OWNER $GROUP $FILENAME
|
||||
for file in $LS_OUT; do
|
||||
IFS="$IFSB"
|
||||
#| is used as a delimiter throughout this script due to the fact that it generally isn't used in filenames.
|
||||
#Get the filename, octal permissions and owner/group
|
||||
FILENAME="$(echo $file|sed "s|.* $WATCH_DIR|$WATCH_DIR|g")"
|
||||
GREP_FNAME="$(echo $FILENAME|sed "s|\^|\\\^|g")"
|
||||
PREV_STATE="$(echo "$PREVOUT"|$EGREP_BIN " $GREP_FNAME$")"
|
||||
#Variable initialisation
|
||||
RUN_CHECKS="YES"
|
||||
TOOUT=""
|
||||
CHECKOUT=""
|
||||
FPERMS="000"
|
||||
FOWNER="nobody nobody"
|
||||
FINTEGRITY="d41d8cd98f00b204e9800998ecf8427e"
|
||||
FILESTATE=""
|
||||
SKIPFILE_OUT="$(echo "$GREP_FNAME"|$EGREP_BIN "$FILES_TO_SKIP")"
|
||||
if [ $? -eq 0 -a ! -z "$SKIPFILE_OUT" ]; then
|
||||
#We're supposed to skip this file, so we do.
|
||||
RUN_CHECKS="NO"
|
||||
F_SKIPPED_COUNT=$(($F_SKIPPED_COUNT+1))
|
||||
else
|
||||
if [ "$CHECK_FILE_PERMS_OWNER_CHANGED" == "YES" ]; then
|
||||
FPERMS="$($STAT_BIN $STAT_ARGS "$FILENAME")"
|
||||
FOWNER="$(echo $file|awk '{print $3 " " $4}')"
|
||||
fi
|
||||
#Check integrity with md5sum
|
||||
if [ "$CHECK_FILES_CHANGED" == "YES" ]; then
|
||||
FINTEGRITY="$(md5sum "$FILENAME"|awk '{print $1}')"
|
||||
fi
|
||||
CHECKOUT="$FILENAME (Perm: $FPERMS, Owner/Group: $FOWNER) -- "
|
||||
fi
|
||||
TOOUT="$FINTEGRITY $FPERMS $FOWNER $FILENAME"
|
||||
if [ $? -ne 0 -o -z "$PREV_STATE" ] && [ "$RUN_CHECKS" == "YES" ]; then
|
||||
#File didn't exist previously
|
||||
CHECKOUT="$CHECKOUT$STR_FILECREATED"
|
||||
FILESTATE="EFILENEW"
|
||||
CREATION_COUNT=$(($CREATION_COUNT+1))
|
||||
else
|
||||
#File existed previously. First we check the md5sum
|
||||
PREV_INTEGRITY="$(echo $PREV_STATE|awk '{print $1}')"
|
||||
if [ "$PREV_INTEGRITY" != "$FINTEGRITY" ] && [ "$RUN_CHECKS" == "YES" ] && [ "$CHECK_FILES_CHANGED" == "YES" ]; then
|
||||
#Integrity check failed, file contents were modified
|
||||
CHECKOUT="$CHECKOUT$STR_FILECHANGED "
|
||||
FILESTATE="EFILECHANGED"
|
||||
CHANGE_COUNT=$(($CHANGE_COUNT+1))
|
||||
fi
|
||||
#Then we check permissions
|
||||
PREV_PERMS="$(echo $PREV_STATE|awk '{print $2}')"
|
||||
if [ "$PREV_PERMS" != "$FPERMS" ] && [ "$RUN_CHECKS" == "YES" ] && [ "$CHECK_FILE_PERMS_OWNER_CHANGED" == "YES" ]; then
|
||||
#Permissions check failed, permissions were modified
|
||||
CHECKOUT="$CHECKOUT$STR_PERMSCHANGED "
|
||||
FILESTATE="$FILESTATE EPERMSCHANGED"
|
||||
PERMCHANGE_COUNT=$(($PERMCHANGE_COUNT+1))
|
||||
fi
|
||||
#Then we check ownership
|
||||
PREV_OWNERGROUP="$(echo $PREV_STATE|awk '{print $3 " " $4}')"
|
||||
if [ "$PREV_OWNERGROUP" != "$FOWNER" ] && [ "$RUN_CHECKS" == "YES" ] && [ "$CHECK_FILE_PERMS_OWNER_CHANGED" == "YES" ]; then
|
||||
#Ownership check failed, owner or group has changed
|
||||
CHECKOUT="$CHECKOUT$STR_OWNCHANGED "
|
||||
FILESTATE="$FILESTATE EOWNERCHANGED"
|
||||
OWNERCHANGE_COUNT=$(($OWNERCHANGE_COUNT+1))
|
||||
fi
|
||||
fi
|
||||
if [ ! -z "$FILESTATE" ] && [ "$RUN_CHECKS" == "YES" ]; then
|
||||
HR_OUTPUT="$HR_OUTPUT$CHECKOUT$IFSN"
|
||||
fi
|
||||
OUTPUT="$OUTPUT$TOOUT$IFSN"
|
||||
IFS="$IFSN"
|
||||
done
|
||||
IFS="$IFSB"
|
||||
#At this point we've checked all files that currently exist. Let's now get a full list of all previous files and check if any are now deleted
|
||||
#The list of files to skip does not apply here.
|
||||
if [ "$CHECK_FILES_DESTROYED" == "YES" ]; then
|
||||
IFS="$IFSN"
|
||||
for file in $PREVOUT; do
|
||||
IFS="$IFSB"
|
||||
CHECKOUT=""
|
||||
FILENAME="$(echo $file|sed "s|.* $WATCH_DIR|$WATCH_DIR|g")"
|
||||
if [ ! -f "$FILENAME" ]; then
|
||||
CHECKOUT="File deleted: $FILENAME"
|
||||
DESTROY_COUNT=$(($DESTROY_COUNT+1))
|
||||
fi
|
||||
if [ ! -z "$CHECKOUT" ]; then
|
||||
HR_OUTPUT="$HR_OUTPUT$CHECKOUT$IFSN"
|
||||
fi
|
||||
IFS="$IFSN"
|
||||
done
|
||||
IFS="$IFSB"
|
||||
fi
|
||||
#We've now completed all checks. Check if there's anything to send out, and email.
|
||||
COUNT_OUT="$CREATION_COUNT new files, $CHANGE_COUNT modified files, $DESTROY_COUNT files were deleted, $PERMCHANGE_COUNT files with different permissions, $OWNERCHANGE_COUNT files with different ownership data. $F_SKIPPED_COUNT files were found, but skipped, and will not be included in the detailed log of events."
|
||||
if [ ! -z "$HR_OUTPUT" ]; then
|
||||
#We construct the email
|
||||
EMAILOUT="Subject: $EMAIL_SUBJ
|
||||
Date: $(date -u +"%a, %d %h %Y %T +0000")
|
||||
From: $HOSTNAME <$EMAIL_FROM>
|
||||
To: $EMAIL_TO <$EMAIL_ADDR>
|
||||
|
||||
$EMAIL_BODY_HEAD$IFSN$COUNT_OUT$IFSN$IFSN$EMAIL_BODY_DETAIL$IFSN$IFSN$HR_OUTPUT$IFSN$EMAIL_BODY_TAIL"
|
||||
#Send the email
|
||||
if [ "$NOTIFY_EMAIL" == "YES" ]; then
|
||||
echo "$EMAILOUT"|$SENDMAIL_BIN $EMAIL_FROM $EMAIL_ADDR
|
||||
fi
|
||||
#Make a backup of the old statefile and write a new one
|
||||
cp $WATCH_STATE_FILE $WATCH_STATE_FILE.previous
|
||||
echo "$OUTPUT" > $WATCH_STATE_FILE
|
||||
fi
|
||||
#And we're done.
|
51
watchd.conf
51
watchd.conf
|
@ -1,51 +0,0 @@
|
|||
#Configuration
|
||||
#Paths
|
||||
#WATCH_DIR: This is the full path to the directory that watchd should monitor. This should not end with a backslash (/).
|
||||
WATCH_DIR="/home/ipxcore/public_html/order"
|
||||
#WATCH_STATE_FILE: This should be the full path to the file watchd should use to store tracking data
|
||||
WATCH_STATE_FILE="/root/.watchd.prevstate"
|
||||
|
||||
#Disable/Enable check configuration.
|
||||
#ENABLE_CHECKING: Set this to 'YES' to enable watchd.
|
||||
ENABLE_CHECKING="YES"
|
||||
#CHECK_FILES_CHANGED: Set this to 'YES' to enable tracking of file changes.
|
||||
CHECK_FILES_CHANGED="YES"
|
||||
#CHECK_FILES_PERMS_OWNER_CHANGED: Set this to 'YES' to enable tracking of permissions or ownership changes.
|
||||
CHECK_FILE_PERMS_OWNER_CHANGED="YES"
|
||||
#CHECK_FILES_DESTROYED: Set this to 'YES' to enable tracking of file deletions
|
||||
CHECK_FILES_DESTROYED="YES"
|
||||
|
||||
#Notification configuration
|
||||
#NOTIFY_EMAIL: Set this to 'YES' to enable email notifications of alerts from watchd.
|
||||
NOTIFY_EMAIL="YES"
|
||||
#EMAIL_ADDR: This should be the email address notifications are sent to.
|
||||
EMAIL_ADDR="email@ipxcore.com"
|
||||
|
||||
#Check tracking configuration.
|
||||
#FILES_TO_SKIP: This is a list of all directories or files that watchd should not track.
|
||||
#Variables that can be used: $WATCH_DIR - The base path.
|
||||
#Make sure all paths are separated with the '|' character. Also make sure that this character is not present at the beginning or end of this value.
|
||||
#Simple regular expressions are supported, and directories can be specified using the format "/path/to/dir/.*", where the end of the directory has '/.*' appended.
|
||||
FILES_TO_SKIP="$WATCH_DIR/modules/servers/Comodo_Module/error_log|$WATCH_DIR/admin/error_log|$WATCH_DIR/templates_c/.*"
|
||||
|
||||
#String and template configuration.
|
||||
#Strings: These specify what should be stated in the event that various checks are triggered. Default values should be used here unless you need to make watchd say something else about a check.
|
||||
STR_FILECHANGED="Integrity mismatch, file has been altered."
|
||||
STR_FILEPERMSCHANGED="Permission mismatch, file permissions have been altered."
|
||||
STR_OWNCHANGED="Ownership mismatch, file ownership has been changed."
|
||||
STR_FILECREATED="File created."
|
||||
STR_FILEDESTROYED="File could not be found, and has been either deleted or moved."
|
||||
#Email template configuration.
|
||||
#Templates: These specify the base header and footer of the email that will be sent.
|
||||
#Variables that can be used: $HOSTNAME - The fully-qualified domain name of the server; $HOSTNAME-SHORT - The least-qualified name of the server
|
||||
EMAIL_SUBJ="[watchd] Alert"
|
||||
EMAIL_FROM="$HOSTNAME_SHORT@ipxcore.com"
|
||||
EMAIL_TO="IPXcore"
|
||||
EMAIL_BODY_HEAD="This is watchd on the machine $HOSTNAME.
|
||||
I have detected one or more anomalies in $WATCH_DIR.
|
||||
|
||||
A breakdown of all anomalies detected is as follows:"
|
||||
EMAIL_BODY_DETAIL="Full details of all detected anomalies:"
|
||||
EMAIL_BODY_TAIL="---
|
||||
You will only receive this email for these changes once.
|
||||
If you have recently upgraded software installed within this directory, added or removed modules or altered configuration, then it is safe to ignore this email."
|
Loading…
Reference in New Issue