Category: perl

  • shotgun scanning

    UDP scanning has always been slow. Slower than slow, slower than molasses, really fucking slow. So when I started being interested in scanning for IPMI out in the wild, which runs on UDP 623, I first fired up trusty ol’ nmap… but bless it’s heart, it’s a cautious, robust scanner that is outrun by crippled…

  • reading wtmp

    Have a wtmp file you need read? A nice perl one liner to do so: perl -we ‘@type=("Empty","Run Lvl","Boot","New Time","Old Time","Init","Login","Normal","Term","Account");$recs = ""; while (<>) {$recs .= $_};foreach (split(/(.{384})/s,$recs)) {next if length($_) == 0;my ($type,$pid,$line,$inittab,$user,$host,$t1,$t2,$t3,$t4,$t5) = $_ =~/(.{4})(.{4})(.{32})(.{4})(.{32})(.{256})(.{4})(.{4})(.{4})(.{4})(.{4})/s;if (defined $line && $line =~ /\w/) {$line =~ s/\x00+//g;$host =~ s/\x00+//g;$user =~ s/\x00+//g;printf("%s %-8s %-12s %10s %-45s\n",scalar(gmtime(unpack("I4",$t3))),$type[unpack("I4",$type)],$user,$line,$host)}}print"\n"’…

  • …losing a half day of my life… and I’m running out of half days.

    This line did it: $ENV{‘PERL_LWP_SSL_VERIFY_HOSTNAME’} = 0; Net::Nessus::XMLRPC, which calls LWP::UserAgent, didn’t emit any hints why something that had been working for many months suddenly doesn’t when I am forced to port to a new system… same OS, how could it go wrong? Turns out LWP changed the default behavior that had been around forever –…

  • restoring mysql tables….

    Note to self… use this perl program+backup…. http://blog.tsheets.com/2008/tips-tricks/extract-a-single-table-from-a-mysqldump-file.html And since things break over time… the program.  Not mine, use at your own peril, etc… just don’t ask why I needed it…. extract_sql Attachments extract_sql (ERROR)

  • and now… custom fields

    Useful little things.  Beat on that old perl script and added support… a few lines of code, a lot of beating my head against the wall, but I didn’t see any other perl solutions. [attachments] Attachments wordpress-upload-post (ERROR)

  • command line perl posting to WP

    After looking at about a zillion different options I ended up with Leo Charre’s WordPress CLI CPAN package for uploading posts… and after a bit of tinkering got it to work with 3.x WP.  However… it didn’t support tags, which I really needed for the project I’m working on.   This handy pointer to how to…