473,657 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

logging into secure website with script

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!

Jan 25 '06 #1
2 4093
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.urlencod e
(an example is in the discussion).

James
Jan 25 '06 #2

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

Jan 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4736
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then using session vars to check time out ... Anyone has any ideas about doing that kind of script? Thank you! -- Yang
1
1922
by: Nobody | last post by:
I have a website that is built around a web-application that my company purchased. My company has full ownership and administrative rights to this software and its corresponding files. It uses HTTP Basic Authentication and that cannot be changed at all (it is compiled into the web-application itself). This is my problem: We have a secure subnet (a customer of ours) that regularly uses this website and they don't want to have to log...
2
3107
by: Tor Erik Sønvisen | last post by:
Hi Have the following code: import logging logging.basicConfig(level = logging.DEBUG, format = ' %(message)s', filename = 'rfs.log', filemode = 'w')
0
11552
by: Antwerp | last post by:
Hi, I'm trying to create a perl script that will log into a website (the login form uses POST), navigate to several pages, and append the (html) content parsed from those pages to a seperate log file. I'm not very familiar with this aspect of perl, and have been having some trouble in the POSTing of the form data, while using cookies to log in. Visting the site automatically redirects you to a login page. Once you fill out the login...
2
1668
by: Geoff Wickens | last post by:
I am amazed at how much help I have had in creating my first asp based website from this forum. There are obviously a significant number of real experts who are happy to take the time to help us novices. My site which now does what it aims to would not be working without this assistance and I am extremely grateful. Long may it continue!!!!! My next problem is as below: I have created a website where various categories of users can log...
1
1605
by: Maksim Kasimov | last post by:
hello in my modules, I'm using logging module, doing thus (there is a few modules): in module1.py: hdl = logging.StreamHandler() fmt = logging.Formatter("%(name)s:\t%(levelname)s:\t%(asctime)s:\t%(message)s") hdl.setFormatter(fmt) log = logging.getLogger('module1')
10
3295
by: Thomas Heller | last post by:
I'm about to add some logging calls to a library I have. How can I prevent that the script that uses the library prints 'No handlers could be found for logger "comtypes.client"' when the script runs? I would like to setup the logging so that there is no logging when nothing is configured, and no warning messages are printed. Thomas
1
1886
by: S_FOX | last post by:
I am learning VB .Net and Visual Studio .Net while trying to create a Help Desk application for our company's Intranet. Certain pages are available to the MIS Department only. Windows Integrated Security is being used. When a MIS Tech is at another employees pc, and they log into the secure section of the web site, how do I log them out? When they click the log out button, I want them to be brought back to the Main Welcome screen which...
0
1647
by: supern | last post by:
this is my perl script saved as login.pl #!c:/perl/bin/perl.exe $basedir="c:/program files/apache software foundation/apache2.2/cgi-bin"; $datafile="regstr.txt"; $name=$in{'login'}; $passwd=$in{'passwd'}; open(FH1,"+>>regstr.txt"); @input=<FH1>; print(@input); @input=($login,$password);
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.