Skip to content

Instantly share code, notes, and snippets.

@MrMugiwara
Forked from faidamine/best_router_for200.txt
Created September 17, 2017 23:21
Show Gist options
  • Save MrMugiwara/c74933a095b5e4ad414652dac7750f58 to your computer and use it in GitHub Desktop.
Save MrMugiwara/c74933a095b5e4ad414652dac7750f58 to your computer and use it in GitHub Desktop.

Revisions

  1. @faidamine faidamine created this gist Sep 17, 2017.
    56 changes: 56 additions & 0 deletions best_router_for200.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    Extracting Files (16 Go)
    Using FTK Imager and go to (var/www/)
    You will find login.pl & index.pl & username.txt & password.txt

    login ( admin : iforgotaboutthemathtest )
    flag : flag{but_I_f0rgot_my_my_math_test_and_pants}

    #!/usr/bin/perl

    if ($ENV{'REQUEST_METHOD'} eq "POST") {
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;
    }
    }

    open(FH,"username.txt") or &dienice("Can't open username.txt: $!");
    $username = <FH>;
    close(FH);

    open(FH,"password.txt") or &dienice("Can't open password.txt: $!");
    $password = <FH>;
    close(FH);

    open(FH,"flag.txt") or &dienice("Can't open flag.txt: $!");
    $flag = <FH>;
    close(FH);

    print "Content-type:text/html\r\n\r\n";

    if ($FORM{"username"} ne $username && $FORM{"password"} ne $password){
    print "<html>";
    print "<head>";
    print "<title>[ BEST ROUTER ]</title>";
    print "</head>";
    print "<body>";
    print "<center><p>Sorry, your credentials are wrong</p></center>";
    print "</body>";
    print "</html>";
    exit 0;
    } else {
    print "<html>";
    print "<head>";
    print "<title>[ BEST ROUTER ]</title>";
    print "</head>";
    print "<body>";
    print "<p>Authenticated</p>";
    print "<pre>$flag</pre>";
    print "</body>";
    print "</html>";
    }