Follow us on Twitter!
You cannot teach a man anything; you can only help him find it within himself. - Galileo
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 22
Guests Online: 19
Members Online: 3

Registered Members: 82886
Newest Member: The Slummy
Latest Articles
View Thread

HellBound Hackers | Challenges | Timed Challenges

Author

Logging in with Perl

MaddinW
Member

Your avatar

Posts: 5
Location:
Joined: 05.11.11
Rank:
Guest
Posted on 05-01-12 15:30
Hello everyone,
I am trying to log in to hbh.com using a Perl script. But for some reason, I still cannot access the challenge page. Here is the code:
Code

    #!/usr/bin/perl -w
    use strict;
    use MIME::Base64::Perl;
    use WWW::Mechanize;
    use HTTP::Cookies;
     
    my $agent=WWW::Mechanize->new;
    $agent->cookie_jar(HTTP::Cookies->new);
    $agent->agent_alias('Linux Mozilla');
    $agent->get("http://www.hellboundhackers.com");
    $agent->form_number(1);#("loginform");
    $agent->set_fields(user_name=>'MaddinW',user_pass=>'not_my_password');
    $agent->tick('remember_me','y');
    $agent->click();
    $agent->get("http://www.hellboundhackers.org/challenges/timed/timed1/index.php"); 
    print $agent->content."\n";





Thank you in advance.
Author

RE: Logging in with Perl

Futility
Member



Posts: 725
Location: USA
Joined: 17.12.07
Rank:
God
Posted on 05-01-12 17:46
Let me preface this by saying I don't know perl, so everything of the proceeding text could be wholly incorrect and make me look like a dumbass. If you don't want to read it, feel free to scoff and skip over me. I will hold no grudges. With that out of the way...

It would appear as though you're trying to directly log in with your script, ya? That's what the user_name/pass set_field is for? Now I don't see why you couldn't tweak that method until it works, but there's (probably) an easier way. It looks like perl can make/edit cookies, yes? So why not take out all your logging in nonsense (that doesn't seem to work) and replace it with something that says you already have logged in? Maybe find the cookies vital to identifying you as you and give them to your program?


i252.photobucket.com/albums/hh11/zanimabean/Zim.png
Futility91@hotmail.com Futility91
Author

RE: Logging in with Perl

MaddinW
Member

Your avatar

Posts: 5
Location:
Joined: 05.11.11
Rank:
Guest
Posted on 05-01-12 18:18
WWW::Mechanize can set and read cookies automatically, so I dont see any reason to interfere with that. Editing or manually setting the cookies might do more harm than already has been done Wink
Author

RE: Logging in with Perl

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 05-01-12 18:32
There are a couple ways to submit forms. Your's, however, failed at all of them. Here's an example:

Code
#!/usr/bin/perl -w
    use strict;
    use MIME::Base64::Perl;
    use WWW::Mechanize;
    use HTTP::Cookies;
     
    my $agent=WWW::Mechanize->new;
    $agent->cookie_jar(HTTP::Cookies->new);
    $agent->get("http://www.hellboundhackers.com");
    $agent->form_name("loginform");
    $agent->set_field(user_name=>'MaddinW',
             user_pass=>'not_my_password');
    #$agent->tick('remember_me','y'); #you're setting cookies and user agent, so the timeout will be longer than you'll need to get the job done.
    $agent->submit();
    $agent->get("http://www.hellboundhackers.org/challenges/timed/timed1/index.php"); 
    print $agent->content;







mechanize is a beautiful beast. Look on perlmonks for more info into its methods. A good way of checking the validity of your post is to use HTML's 'issuccess' function. IE (if $agent->is_success) {etcetc}

http://search.cpa. . .Mechanize/




G'bye y'all! I was an asshole, So korg banned me.

Edited by Arabian on 05-01-12 18:41
Author

RE: Logging in with Perl

MaddinW
Member

Your avatar

Posts: 5
Location:
Joined: 05.11.11
Rank:
Guest
Posted on 05-01-12 19:14
I have setup the script in the way I have written them for hackquest and wechall, so I dont think my script is completely wrong. There is just something I overlook and I dont know what.
Author

RE: Logging in with Perl

just a panda
Member

Your avatar

Posts: 15
Location:
Joined: 22.07.09
Rank:
Newbie
Posted on 05-01-12 22:20
hey guys: its org ^_^
Author

RE: Logging in with Perl

Arabian
Banned



Posts: 332
Location: inside you.
Joined: 22.09.10
Rank:
Apprentice
Posted on 06-01-12 05:28
^WINNER.

If i had community points i'd give them to you.

I have setup the script in the way I have written them for hackquest and wechall, so I dont think my script is completely wrong. There is just something I overlook and I dont know what.


if this is true, then you need to take a remedial course in how not to add frivolous statements to your scripts. Also, take the time to learn how the modules you're using work.


G'bye y'all! I was an asshole, So korg banned me.

Edited by Arabian on 06-01-12 06:16
Author

RE: Logging in with Perl

MaddinW
Member

Your avatar

Posts: 5
Location:
Joined: 05.11.11
Rank:
Guest
Posted on 06-01-12 17:26
Thank you. It was a really stupid mistake that I made; but luckily the easiest one to correct I so far.