Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Why is ClientCookie/urllib2 using https?

Reply
Thread Tools

Why is ClientCookie/urllib2 using https?

 
 
Grant Edwards
Guest
Posts: n/a
 
      09-24-2003
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 --
 
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
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Cisco 2611 and Cisco 1721 : Why , why , why ????? sam@nospam.org Cisco 10 05-01-2005 08:49 AM
Why, why, why??? =?Utf-8?B?VGltOjouLg==?= ASP .Net 6 01-27-2005 03:35 PM
Why Why Why You HAVE NO IDEA MCSE 31 04-24-2004 06:40 PM



Advertisments