Archive for the 'Perl' Category

Scanning for open recursive DNS resolvers

Friday, January 11th, 2013

A few days ago we unfortunately had some abuse reports regarding customers with DNS resolvers being abused in order to participate in a distributed denial of service attack. Amongst other issues, DNS servers which are misconfigured to allow arbitrary hosts to do recursive queries through them can be used by attackers to launch an amplified [...]

Converting an IPv6 address to its reverse zone in Perl

Thursday, November 29th, 2012

I’m needing to work out the IPv6 reverse zone for a given IPv6 CIDR prefix, that is a prefix with number of bits in the network on the end after a forward slash. e.g.: 2001:ba8:1f1:f004::/64 → 4.0.0.f.1.f.1.0.8.a.b.0.1.0.0.2.ip6.arpa 4:2::/32 → 2.0.0.0.4.0.0.0.ip6.arpa 2001:ba8:1f1:400::/56 → 0.0.4.0.1.f.1.0.8.a.b.0.1.0.0.2.ip6.arpa I had a quick look for a module that does it, but [...]

Adding watermarks to a PDF with Perl’s PDF::API2

Sunday, August 7th, 2011

For ages I’ve been trying to work out how to programmatically add a watermark to an existing PDF using the Perl PDF::API2 module. In case it’s useful for anyone else, here goes: use warnings; use strict; use PDF::API2; my $ifile = “/some/file.pdf”; my $ofile = “/some/newfile.pdf”; my $pdf = PDF::API2->open($ifile); my $fnt = $pdf->ttfont(‘verdana.ttf’, -encode [...]

Copying block devices between machines

Sunday, March 13th, 2011

Having a bunch of Linux servers that run Linux virtual machines I often find myself having to move a virtual machine from one server to another. The tricky thing is that I’m not in a position to be using shared storage, i.e., the virtual machines’ storage is local to the machine they are running on. [...]

Setting envelope sender when using Mail::Send

Wednesday, March 14th, 2007

I just thought I would blog this so that people can find it in a search, as I could not when I tried. I have a perl script on a machine that sends out transactional emails with the from address like billing@example.com. The machine it sends from is not example.com. Let’s call it admin.foobar.example.com. Since [...]