Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > logging into secure website with script

Reply
Thread Tools

logging into secure website with script

 
 
dpoehls
Guest
Posts: n/a
 
      01-25-2006
Hello there,

I am new to python, and shell scriping in general..I have done quite a
bit of php, but that it about it. Anyhow, I am wondering if it would be
possible to write a python script that would login to a password
enabled site (qmailadmin) and then be able to add a new account. I
imagine it could be done by accessing the website and then it would
send POSTs to the website? If this makes no sense, I apologize, just
wondering if anyone could point me in the right direction. Thanks ahead
of time!

 
Reply With Quote
 
 
 
 
James Stroud
Guest
Posts: n/a
 
      01-25-2006
dpoehls wrote:
> Hello there,
>
> I am new to python, and shell scriping in general..I have done quite a
> bit of php, but that it about it. Anyhow, I am wondering if it would be
> possible to write a python script that would login to a password
> enabled site (qmailadmin) and then be able to add a new account. I
> imagine it could be done by accessing the website and then it would
> send POSTs to the website? If this makes no sense, I apologize, just
> wondering if anyone could point me in the right direction. Thanks ahead
> of time!
>


Spend some time perusing this code:

http://aspn.activestate.com/ASPN/Coo.../Recipe/302930

It helped me with a similar problem. I'm not sure if it works for https.

If the form is using POST to "hide" the login, just suck the web page
and change POST to GET. Then use your sucked webpage and submit your
login from it. You will then see the fields (separated by "+"s and the
values, separated from the fields by "="s). Use the fields and values to
populate the "txdata" dictionary in the example using urllib.urlencode
(an example is in the discussion).

James
 
Reply With Quote
 
 
 
 
Fuzzyman
Guest
Posts: n/a
 
      01-25-2006

dpoehls wrote:
> Hello there,
>
> I am new to python, and shell scriping in general..I have done quite a
> bit of php, but that it about it. Anyhow, I am wondering if it would be
> possible to write a python script that would login to a password
> enabled site (qmailadmin) and then be able to add a new account. I
> imagine it could be done by accessing the website and then it would
> send POSTs to the website? If this makes no sense, I apologize, just
> wondering if anyone could point me in the right direction. Thanks ahead
> of time!


You should use urllib2 to fetch URLs. See :

http://www.voidspace.org.uk/python/a.../urllib2.shtml

urllib2 will also allow you to do POST.

How you handle the password depends on whether it is by a form, or by
basic authentication. For basic authentication see :

http://www.voidspace.org.uk/python/a...tication.shtml

If it is through a form, you can use ClientForm. Alternatively just
manually do the POST from urllib2. You may want to use
ClientCookie/cookielib for (automatic) cookie handling :

http://www.voidspace.org.uk/python/a...ookielib.shtml

All the best,

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Secure your digital information assets with Secure Auditor. SecureWindows with Secure Auditor alannis.albert@googlemail.com Cisco 0 04-14-2008 06:53 AM
Secure your digital information assets with Secure Auditor SecureWindows with Secure Auditor alannis.albert@googlemail.com Cisco 0 04-14-2008 06:52 AM
Website with TreeView works fine in development, but crashes in a 'secure' website on server. Mufasa ASP .Net 0 06-10-2007 10:17 PM
Logging into and parsing a website using Perl Antwerp Perl 0 02-15-2005 08:50 PM



Advertisments