Join us at IRC!
Imagination is more valuable than knowledge - Albert Einstein
Thursday, May 24, 2012
Navigation
Members Online
Total Online: 22
Web Spiders: 14
Guests Online: 22
Members Online: 0

Registered Members: 70188
Newest Member: nuk3d
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

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

DeadlyWolf
Member

Posts: 5
Location:
Joined: 01.03.10
Rank:
Newbie
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.
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

DeadlyWolf
Member

Posts: 5
Location:
Joined: 01.03.10
Rank:
Newbie
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 DeadlyWolf on 01-03-10 01:57
Author

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

DeadlyWolf
Member

Posts: 5
Location:
Joined: 01.03.10
Rank:
Newbie
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

DeadlyWolf
Member

Posts: 5
Location:
Joined: 01.03.10
Rank:
Newbie
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

define
Member

Posts: 201
Location:
Joined: 13.12.08
Rank:
Moderate
Warn Level: 1
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 scblockedript 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 scblockedript from http://bbs.archlinux.org/viewtopic.php?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 scblockedript. :)


If you need to contact me, send me a PM. I will read and/or respond in time.
Author

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

ynori7
Future Emperor of Earth



Posts: 1481
Location: #valhalla
Joined: 08.10.07
Rank:
Diabolical
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 scblockedript. :)

Indeed.
http://www.hellboundhackers.org/forum/timed_1_in_python-69-12936_0.html






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

DeadlyWolf
Member

Posts: 5
Location:
Joined: 01.03.10
Rank:
Newbie
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

Posts: 9
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 scblockedript does, then you can move on to making
a scblockedript that will fill in forms for you.


#usr/bin/python
#Logon scblockedript
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
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.