473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Why is ClientCookie/urllib2 using https?

In the program shown below, all of the connections to the
servers are using port 443 and https (TLS protocol) -- both the
initial connection to login.postini.com and subsequent
connections to user-3.postini.com.

It works, and I don't mind that it's encrypting the sessions as
well as the login, but I'd like understand why the connections
to "http://user-3.postini.com/exec/MsgCtr" are being done using
TLS to port 443 instead of raw TCP to port 80 as is implied by
the http: in the URL.

FWIW, it's a program to delete quarantined viruse-laden
messages from the server run by the Postini mail-filtering
service. Viruses can only be deleted 10 at a time, and when
you've got 7000 of them, that's a hell of a lot of mouse
clicks. When they're coming in 200-300 an hour, automating the
deleting process was the only reasonable solution.

---------------------------------8<---------------------------------
import re,sys
import ClientCookie
import urllib,urllib2

postData = urllib.urlencode({
'remember':'1',
'action':'login',
'email':sys.argv[1],
'pword':sys.argv[2]})

req1 = urllib2.Request("https://login.postini.com/exec/login",data=postData)
rsp1 = ClientCookie.urlopen(req1)

req2 = urllib2.Request("http://user-3.postini.com/exec/MsgCtr")
rsp2 = ClientCookie.urlopen(req2)

while 1:
data = rsp2.read()

m = re.search('<form name=virus .*</form>',data,re.M|re.S)
if not m:
print "no virus form found"
sys.exit()
vdata = m.group()

m = re.search('Message 1 - [0-9]+ of [0-9]+',vdata,re.M|re.S)
if not m:
print "did not find message count"
sys.exit()
print m.group()

r = re.compile('<input type="checkbox" name="msgid" value="([^"]*)">',re.M|re.S)
m = r.findall(vdata)

if not m:
print "no virus msgids found"
sys.exit()

postData = urllib.urlencode({'submit':'Remove','disp':'M','ac tion':'change_Msgs'})
for msgid in m:
postData += "&msgid="+msgid

req2 = urllib2.Request("http://user-3.postini.com/exec/MsgCtr",postData)
rsp2 = ClientCookie.urlopen(req2)

---------------------------------8<---------------------------------

--
Grant Edwards grante Yow! He is the
at MELBA-BEING... the ANGEL
visi.com CAKE... XEROX him... XEROX
him --
Jul 18 '05 #1
0 1633

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

Similar topics

28
by: Mark Carter | last post by:
I am using Windows 98, python 2.3, ClientCookie 0.4.3a. When I do: import ClientCookie import os c = ClientCookie.MSIECookieJar(delayload=1) c.load_from_registry() I get the response:...
11
by: Michael Foord | last post by:
Has anyone used ClientCookie to store cookies ? I'm going to play around with 'pickling cookies' - but I wondered if anyone had any experience of this. (For session persistence in approx - my...
0
by: Richie Hindle | last post by:
Hi, I'm trying to write a test script to hammer an HTTP server over a persistent HTTP 1.1 connection. The server uses cookies, so I'm using a combination of ClientCookie 0.4.19 and urllib2 with...
5
by: Max M | last post by:
I am using ClientCookie for login on to servers and browsing them as authenticated users. I kept getting "HTTP Error 400: Bad Request" errors when submitting my forms. So I boiled it down to a...
1
by: Bloke | last post by:
I want to connect to a https server through an authenticating proxy like this: import urllib2 proxy_info = { 'user' : 'me', 'pass' : 'password', 'host' : 'mycompany.com.au', 'port' : 8008...
1
by: dmbkiwi | last post by:
I've been using urllib2 to try and automate logging into the google adsense page. I want to download the csv report files, so that I can do some analysis of them. However, I don't really know...
3
by: jnair | last post by:
Hi , I am using python2.4 "urllib2" and "cookelib". In line "5" below i provide my credentials to login into a web site.During the first attempt i "fail", judging from the output of line "6"....
1
by: jnair | last post by:
Hi , I am using python2.4 "urllib2" and "cookelib". In line "5" below i provide my credentials to login into a web site.During the first attempt i "fail", judging from the output of line "6"....
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.