Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
use lib( '/home/fbl/lib' ); # Or wherever you store your custom perl libs
use Email::ARF::Hotmail;
my $message = do { local $/; <>; };
# Extract the single part mime
my $report = Email::ARF::Hotmail->create_report($message);
print $report->as_string;
#!/usr/bin/perl -w
use strict;
use Fcntl qw(:DEFAULT :flock);
use constant LOCKFILE => '/tmp/default.lck';
use constant TIMEOUT => 10;
my $cmd = shift || die ("You must give a sub command to run\n");
my $timeout = shift || TIMEOUT;
my $filename = shift || LOCKFILE;
#!/bin/bash
function die
{
echo "$1"
exit 1
}
touch /tmp/default.lck || die "Could not touch /tmp/default.lck"
perl /usr/local/bin/lock-and-process.pl '/usr/local/bin/some_script.sh' || die 'Could not get lock for /usr/local/bin/some_script.sh'
@waffle2k
waffle2k / ip-convert.pl
Created January 7, 2011 18:45
A little script for taking in lists of IPs/cidrs, and outputting/formatting depending on the format type
#!/usr/bin/perl
# A little script to take in some kinds of formats, and output
# the converted IPs based on the type of rbl zone being used.
#
# This is specifically used for including exclusion lists into
# a rbldnsd zone file. This will take a generic list of IPs,
# and output them for the appropriate rbldnsd zone type.
#
# Author: pblair (at) tucows (dot) com
# Date: Fri Jan 7 13:44:20 EST 2011
#!/usr/bin/perl
#
# This script takes a series of ARF messages, and stores certain attributes
# about these messages, so that other applications can easily look into
# only the messages that they care about without having to go into lots
# and lots of files.
use strict;
use Time::ParseDate; # libtime-modules-perl
use lib( '/abuse/AUP/lib' );
use Email::ARF::Report;
#!/usr/bin/perl
#
# This script takes a series of ARF messages, and stores certain attributes
# about these messages, so that other applications can easily look into
# only the messages that they care about without having to go into lots
# and lots of files.
use strict;
use lib( qw( /abuse/AUP/lib /abuse/AUP/plugins ) );
use Email::ARF::Report;
use MLDBM;
function strip_filename
{
perl -lane 'print $1 if /filename:\[(\S+?)\]/' -
}
function epoch
{
perl -lane '$d=gmtime($1) if /epoch:\[(\d+)\]/; s/epoch:\[\d+\]/epoch:\[$d\]/ and print' -
}
#!/usr/bin/perl
use strict;
use JSON;
use Data::Dumper;
use Getopt::Long;
use constant MAX => 140;
use constant MAXGOBACK => 999999;
use constant MAXLOOKUP => 99;
#!/usr/bin/perl
use strict;
use POE::Component::DirWatch::Object;
our %seen;
sub extractContents {
my $filename = shift;
print "Opening: $filename\n";
@waffle2k
waffle2k / gist:852758
Created March 3, 2011 13:27
Use of "crappy_ptr" in postfix configuration
pblair@abuse1:/etc/postfix$ cat -n main.cf | grep crappy_ptr -B4 -A5
50 smtpd_client_restrictions =
51 #reject_unknown_client,
52 permit_mynetworks,
53 reject_unknown_reverse_client_hostname,
54 check_client_access regexp:/etc/postfix/crappy_ptr
55 hash:/etc/postfix/client_access,
56 sleep 5,
57 reject_unauth_pipelining