Today is: 8 January, 2012
Check todays hot topics

Perl

Thursday, October 1, 2009 - 13:28
fukung, image, lwp, rape, scraper

This script will crawl fukung.net and grab every image it see's. We attempt to create an archive resembling media.fukung.net's directory structure.

The neat thing is it preserves image tags in the database. I figured, what good is it to have a fuck ton of images in a fuck ton of directories if they're not even sensibly organized. For every image we insert we keep track of it's class('sfw', 'nsfw') and it's tags (if any).

0


Sunday, September 13, 2009 - 06:26
fibonacci

Everyone seems to over-complicate this. Theres 23894728934723 different ways to do this but my way is simple.

#!/usr/bin/perl
 
use strict;
use warnings;
 
my $default = 100;
my @num = (0, 1);
$\ = "\n";
 
sub main {
        my $iterations = $ARGV[0] ? $ARGV[0] : $default;
        for(0..$iterations) {
                my $fib = ($num[0] + $num[1]);
                $num[0] = $num[1];
                print $num[1] = $fib;
        }
}
 
main();

Heres what it looks like:

$ ./fibonacci.pl
1
2
3
5
8
13
21
34
55
89

0


Thursday, September 10, 2009 - 15:56
GD, image, lwp, resize

Compile a txt file of image urls, download the images, resize them. Pretty simple, pretty ghetto. This is a proof for something much larger I will post a later date. This requires Image::Resize which requires GD.

#!/usr/bin/perl
 
use strict;
use warnings;
 
use Data::Dumper;
use Image::Resize;
use LWP::UserAgent;
use Getopt::Long;
 
my $x;
my $y;
my $url;
my $input;
my $outdir;
 
my $verbose = 1;
 
sub do_options {
        my $var = GetOptions( 'i|input=s' => \$input,
                                'u|url=s' => \$url,

0


Thursday, September 3, 2009 - 21:53

We wrote this to cheat on an internet poll. At first we were using the Proxy Spider to gather proxies and iterate through them with LWP::UserAgent. *THAN* we discovered ProxyHopper exists, and we set out on rigging internet polls across the land. My favorite internet polls are ones that use the GET method. This will require heavy modification to work anywhere other than it's intended target. It shouldn't be too hard.

0


Thursday, September 3, 2009 - 17:50
eth0, network, proc, stats

lol old. Who needs iptraf or any other horse shit to tell you whats going through your NIC. We got perl function calls older than you are!

#! /usr/bin/perl
 
for $i (0 .. 15 ) {
  $rx[$i] = 0 ;
  $ox[$i] = 0 ;
} ;
 
format STDOUT_TOP =
                        Network Statistics
 Received (eth0)                           Transmitted (eht0)
     Bytes       Packets errors  drops     Bytes      Packets   errors
Drops  Colls
 
------------------------------------------------------------------------------------
.
 
format STDOUT =

0


Thursday, September 3, 2009 - 15:27
Arp, ddos, flood, POC, Poison, syn, syn flood

This is a modified version of NWO's POC syn flooder. None of us ever had the need/guts/reason to test it outside a network lab. I've used this and something similar to stress test core routers, fiber loops, and firewalls in a datacenter. It's sorta neat. NWO comments have been left in. I gotta say I'm a little disappointed they're as clean and tame as they are, he's usually a comment loller.

0


Thursday, September 3, 2009 - 15:01
binary, executable, packer, par, Win32

Perl's PAR::Packer is a great way to write (albeit bloated) Win32 apps for clients in a short time. I find this useful for taking on jobs spec'd for Windows or a *nix project that you'd like obfuscated by virtue of distributing a binary.

PAR is actually neat for a lot of things. It creates a compressed archive of libraries for simple recall. The PAR that is generated is not all together too different then Java's notion of a JAR. PAR has surprisingly seamless integration with LWP::UserAgent, in that, you can include modules in a PAR from across the network by simply using it.

0


Friday, August 21, 2009 - 13:48
lol, rap

LOL RAP IS RAP WITH LOLS SPRINKLED IN!

#!/usr/bin/perl
#
use strict;
use warnings;
use Getopt::Long;
 
my $file;
my $verbose;
my @replacements = (qw(call time love loves fuck pussy quoted weakness flee shit la dadada ride));
 
sub do_options {
        my $vars = GetOptions( 'f|file=s' => \$file,
                               'v|verbose' => \$verbose);
        die("Please specify file with -f flag\n") unless(defined($file));
}
 
sub main {
        do_options();
        print "$file\n" if ($verbose);

0


Friday, August 14, 2009 - 00:50

This is my very first lame attempt at writing a poller for my nerdkit. For some reason I thought I would be able to pull once a second for a single reading, however, that is not the case. It turns out the device writes to the serial port REALLY quickly. On average I'm receiving about 13 lines a second.

What I've attempted to do is read once a second and push the results into an array that are split on \n marker. I'm attempting to sample the readings I'm getting and spit back one unified average per second. The average function is not working according to plan.

0


Wednesday, July 29, 2009 - 15:50
proxies, proxy spider

This is code that was given to me while building LIB::Spider. Judging by the way it's written, it's a little old. I don't really know or care if it works. I thought it was a semi-neat addition to the proxy spider. I used it as a guideline while building a perl module for testing proxies in parallel.

0