Follow us on Twitter!
It is the path of least resistance that makes rivers and men crooked. - Bj Palmer
Sunday, April 20, 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: 27
Guests Online: 25
Members Online: 2

Registered Members: 82844
Newest Member: Jimmy Zhang
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 01:37
Im trying to make it log in to a website and so far it not going in to the website. I tried it here because the site says who's online and he doesnt say up.
heres the code.
Code
import urllib2, cookielib, re
import ClientForm

password = *****
username = *****

class SecondLife:
    def __init__(self, usernames, password):
        self.username, self.lastname = usernames.split(' ')      # split First_Name and Last_Name
   self.url = 'http:\\www.hellboundhackers.org'
   self.password = password
   self.username = username
      

        cookiejar = cookielib.LWPCookieJar()
        cookiejar = urllib2.HTTPCookieProcessor(cookiejar)
        # debugger = urllib2.HTTPHandler(debuglevel=1)

        opener = urllib2.build_opener(cookiejar)
        urllib2.install_opener(opener)

    def login(self):
        response = urllib2.urlopen(self.url)
        forms = ClientForm.ParseResponse(response, backwards_compat=False)

        # forms[0] is 'GET', forms[1] is 'POST'
        form = forms[0]

        try:
            form['form[username]'] = self.username
            form['form[lastname]'] = self.lastname
            form['form[password]'] = self.password
        except Exception, e:
            print 'The following error occured: \n"%s"' % e
            print
            print 'A good idea is to open a browser and see if you can log in from there.'
            print 'URL:', self.url
            raw_input()
            exit()

        self.page = urllib2.urlopen(form.click('submit')).read()

    def friends_online(self):
        self.login()

        pattern = re.compile('.*-color:.*;">(.*)</li>')
        friends_online = pattern.findall(self.page)

        for friend in friends_online:
            print friend


SL = SecondLife('First_Name Last_Name', 'Password')
#SL.friends_online()

raw_input()




change the *'s to what u want.
plz help
Author

RE: Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 01:56
well thats the thing its not printing anything and when it is ran it shows nothing. trying to make it login and if it can go to a diff place and keep refresh the page and copying it to somewhere


Edited by on 01-03-10 01:57
Author

RE: Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 02:04
any ideas how i can make it say that it is logged in or something
Author

RE: Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 02:08
well i dont know that much about Except Error so i willl google it and figure it out thanks.
Author

RE: Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 02:14
DeadlyWolf wrote:
well i dont know that much about Except Error so i willl google it and figure it out thanks.

While we're on the subject, how much do you know about Python? Do you understand what the script is doing? Can you see where you need to place output for it to be seen on success/error? We don't mind helping, but it's good to know that you didn't just pull a script from http://bbs.archli. . .p?id=61276 and post here hoping that someone would fix it.

... That being said, there are a lot of threads here that address using Python on timed challenges. The concept is the same: Using Python to log in to HBH. Specifically, those threads address the specific cookie-related issues that will probably prevent successful logins. Also, those threads probably have a better starting script. Smile


Author

RE: Hello im trying to make a script with python to login to a website

ynori7
Member



Posts: 1486
Location: #valhalla
Joined: 08.10.07
Rank:
God
Posted on 01-03-10 02:29
define wrote:
... That being said, there are a lot of threads here that address using Python on timed challenges. The concept is the same: Using Python to log in to HBH. Specifically, those threads address the specific cookie-related issues that will probably prevent successful logins. Also, those threads probably have a better starting script. Smile

Indeed.
http://www.hellbo. . .936_0.html


halls-of-valhalla.org/images/affiliateLogo.png voodoorage.halls-of-valhalla.org/images/smallLogo.png
i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg


Edited by ynori7 on 01-03-10 02:30
ynori7 http://halls-of-valhalla.org
Author

RE: Hello im trying to make a script with python to login to a website


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-10 04:06
i did get it from http://bbs.archlinux.org/viewtopic.php?id=61276 but was trying to edit it to work with the website. I need a template to base the new one im going to make and i am still learning python i have done small things and my friend asked if i can log into a website with python and thanks for the quick replies.
Author

RE: Hello im trying to make a script with python to login to a website

ArgonQ
Member

Your avatar

Posts: 17
Location:
Joined: 20.11.09
Rank:
God
Posted on 04-03-10 00:09
Try this, to get you started.
It will print out the source of the page in the URL variable.

If you want to access a mission or some other registered page,
you must login manually to get your cookie,then paste it below.
and remove the hash from in front of PHPSESSID.

Understand what this script does, then you can move on to making
a script that will fill in forms for you.

Code

#usr/bin/python
#Logon script
import urllib
import urllib2
begin=raw_input("start")
url = 'http://www.hellboundhackers.org/forum/index.php'
#login and get your cookie then copy cookie to  here
strSession ='#PHPSESSID=cookie goes here'
httpHeaders = {'COOKIE': strSession, 'Referer': 'http:\\www.hellboundhackers.org'}
req = urllib2.Request(url, None, httpHeaders)
response = urllib2.urlopen(req)
print"Using URL",url
the_page = response.read()
print the_page
response.close()





Edited by ArgonQ on 04-03-10 00:25
lead to