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.c om 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.urlencod e({
'remember':'1',
'action':'login ',
'email':sys.arg v[1],
'pword':sys.arg v[2]})
req1 = urllib2.Request ("https://login.postini.c om/exec/login",data=pos tData)
rsp1 = ClientCookie.ur lopen(req1)
req2 = urllib2.Request ("http://user-3.postini.com/exec/MsgCtr")
rsp2 = ClientCookie.ur lopen(req2)
while 1:
data = rsp2.read()
m = re.search('<for m name=virus .*</form>',data,re. M|re.S)
if not m:
print "no virus form found"
sys.exit()
vdata = m.group()
m = re.search('Mess age 1 - [0-9]+ of [0-9]+',vdata,re.M|r e.S)
if not m:
print "did not find message count"
sys.exit()
print m.group()
r = re.compile('<in put 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.urlencod e({'submit':'Re move','disp':'M ','action':'cha nge_Msgs'})
for msgid in m:
postData += "&msgid="+m sgid
req2 = urllib2.Request ("http://user-3.postini.com/exec/MsgCtr",postDat a)
rsp2 = ClientCookie.ur lopen(req2)
---------------------------------8<---------------------------------
--
Grant Edwards grante Yow! He is the
at MELBA-BEING... the ANGEL
visi.com CAKE... XEROX him... XEROX
him --
servers are using port 443 and https (TLS protocol) -- both the
initial connection to login.postini.c om 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.urlencod e({
'remember':'1',
'action':'login ',
'email':sys.arg v[1],
'pword':sys.arg v[2]})
req1 = urllib2.Request ("https://login.postini.c om/exec/login",data=pos tData)
rsp1 = ClientCookie.ur lopen(req1)
req2 = urllib2.Request ("http://user-3.postini.com/exec/MsgCtr")
rsp2 = ClientCookie.ur lopen(req2)
while 1:
data = rsp2.read()
m = re.search('<for m name=virus .*</form>',data,re. M|re.S)
if not m:
print "no virus form found"
sys.exit()
vdata = m.group()
m = re.search('Mess age 1 - [0-9]+ of [0-9]+',vdata,re.M|r e.S)
if not m:
print "did not find message count"
sys.exit()
print m.group()
r = re.compile('<in put 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.urlencod e({'submit':'Re move','disp':'M ','action':'cha nge_Msgs'})
for msgid in m:
postData += "&msgid="+m sgid
req2 = urllib2.Request ("http://user-3.postini.com/exec/MsgCtr",postDat a)
rsp2 = ClientCookie.ur lopen(req2)
---------------------------------8<---------------------------------
--
Grant Edwards grante Yow! He is the
at MELBA-BEING... the ANGEL
visi.com CAKE... XEROX him... XEROX
him --