Category: perl

  • User input, by any other name

    A friend of mine posed me an interesting question: how is it possible that a CMS software, which displayed the IP addresses for comments made anonymously (instead of the username) showed a private IP (like 172.16.63.15)? Before I get to the actual explanation, here are some specific clarifications which should be made: IP addresses are…

  • Function references in Perl

    A friend asked me how to do the following: use strict; use warnings; use File::Copy ‘move’; my $op = $condition ? &move : &link; # … $op->($a, $b); So, I tried to get it working, but I kept getting the error: Undefined subroutine &main::link called at linkme.pl line 2. For move it worked fine. Finally,…

  • Updated VTUploader – renamed to OVScan

    I updated the the script I originally published for submitting files to VirusTotal and renamed it OVScan (Online Virus Scan). What has changed: Added support for multiple sites Added support for submitting via SSL (if the site supports it) Added support for a per-file timeout Get it while it’s fresh from the source-code repository (to…

  • A new Perl twitter account

    Now, besides the perl one-liner account we have CPANr: Reviewing CPAN modules 140 chars at a time Very cool! The latest (as of this posting) is Net::Pcap, a module to slicing and dicing packet capture files, something which I’m sure will come in handy someday. Image taken from ivanlanin’s photostream with permission.

  • Parse the camel

    A quick note about the  B::Deparse Perl module: use it to tame hairy (obfuscated) Perl code, even code like this. Use it like this: perl -MO=Deparse obfuscated.pl In the area of obfusctation, but more on the funny side there is Acme::Smirch and Acme::Bleach. Have fun! PS. You can exercise your skills on the perl one-liners.…

  • How to interpolate a string in Perl?

    Perl (and some other languages which came after it :-)) have a feature called interpolation, whereby the names of the variables in strings are replaced by their actual values. This is both useful and dangerous (it can easily result in problems like command injection / SQL injection / HTML injection (aka XSS) – as with…

  • Negative zero – what is it?

    Computers have two ways of representing numbers: One is called sign and magnitude – usually you have one bit specifying the sign (again, most of time you have 0 for positive and 1 for negative) and the rest of the bits specify the absolute value (“magnitude”) of the number. The other is ordering the numbers…

  • Everything old is new again – SMOG

    Warning! The site which the script uses to provide the service contains a malicious iframe. While most probably the site itself is not malicious, I don’t recommend using the script below until the issues have been cleared up. If you included it in your site, please disable it until the problems have been cleared up.…

  • No stress Perl

    What I like about Perl is that it is “turtles all the way down” (almost). You go in with the perl debugger (or something visual like ptkdb) and step through almost all the code and understand how it is done. See for example this post about “magically” turning on strict/warnings from a module. In the…

  • Ubuntu 8.10 comes with Perl 5.10!

    I just found this out: Ubuntu 8.10 (in its alpha version, which means that it probably will be true for the final version too) with Perl 5.10! W00t! I better read through the changedoc it seems :-).