## page was renamed from MicroProj/2008-03-04 ##language:zh #pragma section-numbers on ::-- ZoomQuiet [<>] <> ## 默许导航,请保留 <> = 招商银行请愿机器人 = * '''[[http://www.zeuux.org/campaign/cmb-campaign.cn.html|<<致招商银行的公开信>>行动]]''' {{{#!python #!/usr/bin/python import httplib httplib.HTTPConnection.debuglevel = 1 httplib.HTTPSConnection.debuglevel = 1 import urllib import urllib2 import sys from time import * class SmartRedirectHandler(urllib2.HTTPRedirectHandler): def http_error_301(self, req, fp, code, msg, headers): result = urllib2.HTTPRedirectHandler.http_error_301( self, req, fp, code, msg, headers) result.status = code return result def http_error_302(self, req, fp, code, msg, headers): result = urllib2.HTTPRedirectHandler.http_error_302( self, req, fp, code, msg, headers) result.status = code return result if len(sys.argv)>=2: debug = sys.argv[1] else: debug = '' #print 'Start protest...' YOUR_CARD_NUMBER = '6225880151465146' YOUR_NAME = '\xC0\xEE\xC0\xEE' YOUR_WORDS = '\xD7\xF7\xCE\xAA\xD5\xD0\xC9\xCC\xD2\xF8\xD0\xD0\xB5\xC4\xD6\xD2\xCA\xB5\xD3\xC3\xBB\xA7\xA3\xAC\xCE\xD2\xD5\xE6\xB3\xCF\xB5\xD8\xCF\xA3\xCD\xFB\xD5\xD0\xC9\xCC\xD2\xF8\xD0\xD0\xC4\xDC\xB9\xBB\xB9\xD8\xD5\xD5\xD4\xBD\xC0\xB4\xD4\xBD\xB6\xE0\xB5\xC4\xB7\xC7\xCE\xA2\xC8\xEDWindows\x2FIE\xCF\xB5\xCD\xB3\xD3\xC3\xBB\xA7\xA3\xAC\xBE\xA1\xBF\xEC\xBF\xAA\xB7\xA2\xB3\xF6\xD6\xA7\xB3\xD6FireFox\xBA\xCD\x2F\xBB\xF2Linux\x2FMac+OS+X\x2FUNIX\xCF\xB5\xCD\xB3\xB5\xC4\xD5\xD0\xC9\xCC\xD2\xF8\xD0\xD0\xB4\xF3\xD6\xDA\xB0\xE6\xBA\xCD\xBB\xF2\xD7\xA8\xD2\xB5\xB0\xE6\xA1\xA3\x0D\x0A\xD4\xDA\xB4\xCB\xCF\xD7\xC9\xCF\xCE\xD2\xD7\xEE\xB3\xCF\xD6\xBF\xB5\xC4\xD0\xBB\xD2\xE2\xA3\xA1' c_First = 'https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/Login.aspx?logintype=C' c_UA = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322)' protestDict = {'__VIEWSTATE':'',\ 'ddlServiceType':'D',\ 'txtEmail':'',\ 'txtPhone0':'',\ 'txtPhone':'',\ 'rblSugType':'A',\ 'ddlIDType':'0',\ 'txtCardNo':YOUR_CARD_NUMBER,\ 'txtName':YOUR_NAME,\ 'ddlBsnType':'E',\ 'txtQuestion':YOUR_WORDS,\ #'btnSend':'\xB7\xA2+\xCB\xCD',\ 'hdOld':'',\ 'hdHelper':'close',\ 'hdIDType':'8',\ 'hdID':'',\ 'hdSwitch':'0',\ 'imageFile':''} # # First # cookie = '' req = urllib2.Request(url=c_First) req.add_header('User-Agent', c_UA) req.add_header('Connection','Keep-Alive') req.add_header('Accept-Language','en-us') req.add_header('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */*'); req.add_header('UA-CPU', 'x86') req.add_header('Accept-Encoding', 'gzip, deflate') first = urllib2.urlopen(req) #print first.info() #print first.headers.dict r_First = first.read() r_First = r_First[r_First.index('https://forum.cmbchina.com'):] r_First = r_First[0:r_First.index(' ')-1] #print #print r_First u_Second = r_First u_Second = u_Second.replace('&', '&') req = urllib2.Request(url=u_Second) req.add_header('User-Agent', c_UA) req.add_header('Connection','Keep-Alive') req.add_header('Accept-Language','en-us') req.add_header('Accept', '*/*'); req.add_header('UA-CPU', 'x86') req.add_header('Accept-Encoding', 'gzip, deflate') second = urllib2.urlopen(req) if 'set-cookie' in second.headers.dict: cookie = second.headers.dict['set-cookie'] else: cookie = '' #print second.info() #print second.headers.dict r_Second = second.read() #print #print r_Second sleep(1) okexit = 1 while (okexit) : r_Second = r_Second[r_Second.index('action=\"Service.'):] u_Third = r_Second[len('action=\"'):r_Second.index(' ')-1] ppos = r_Second.index('name=\"__VIEWSTATE\" value=\"') r_Second = r_Second[ppos+len('name=\"__VIEWSTATE\" value=\"'):] p_Third = r_Second[0:r_Second.index(' ')-1] u_Third = u_Third.replace('&', '&') #print u_Third #print p_Third #print strftime("%H : %M : %S", gmtime()) sleep(1) #print strftime("%H : %M : %S", gmtime()) refer = u_Second req = urllib2.Request(url=u_Second) req.add_data(urllib.urlencode({'__VIEWSTATE': p_Third, 'hdContinute': '1',\ 'btnGo': 'go'})) req.add_header('User-Agent', c_UA) req.add_header('Connection','Keep-Alive') req.add_header('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */*'); req.add_header('UA-CPU', 'x86') req.add_header('Accept-Encoding', 'gzip, deflate') if len(cookie)>0: req.add_header('Cookie', cookie[0:cookie.find(';')]) opener = urllib2.build_opener(SmartRedirectHandler()) opener.addheaders = [] #print opener.addheaders third = opener.open(req) #print third.info() #print third.headers.dict if 'set-cookie' in third.headers.dict: cookie = third.headers.dict['set-cookie'] r_Third = third.read() #print r_Third if r_Third.find('marq')<0: okexit = okexit - 1 continue else: r_Second = r_Third if r_Third.find('')<0: break u_Forth = r_Third[r_Third.index('MyService.aspx?'):] u_Forth = u_Forth[0:u_Forth.index('\"')] u_Forth = u_Forth.replace('&','&') #print u_Forth vs = r_Third[r_Third.index('__VIEWSTATE'):] vs = vs[len('__VIEWSTATE\" value=\"'):] vs = vs[0:vs.index('\"')] protestDict['__VIEWSTATE'] = vs hdid = r_Third[r_Third.index('id=\"hdID\" type=\"hidden\" value=\"'):] hdid = hdid[len('id=\"hdID\" type=\"hidden\" value=\"'):] hdid = hdid[0:hdid.index('\"')] protestDict['hdID'] = hdid hdold = r_Third[r_Third.index('name=\"hdOld\" type=\"text\" value=\"'):] hdold = hdold[len('name=\"hdOld\" type=\"text\" value=\"'):] hdold = hdold[0:hdold.index('\"')] protestDict['hdOld'] = hdold req = urllib2.Request(url='https://forum.cmbchina.com/pcs/'+u_Forth) pd = urllib.urlencode(protestDict) pd = pd+'&btnSend=%B7%A2+%CB%CD' #print '\"\"\"\"\"\n\n' #print pd #print '\"\"\"\"\"\n\n' #print cookie #print '\"\"\"\"\"\n\n' req.add_data(pd) req.add_header('User-Agent', c_UA) req.add_header('Referer', 'https://forum.cmbchina.com/pcs/'+u_Forth) req.add_header('Connection','Keep-Alive') req.add_header('Cache-Control','no-cache') req.add_header('Content-Type', 'application/x-www-form-urlencoded') req.add_header('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */*'); req.add_header('UA-CPU', 'x86') req.add_header('Accept-Encoding', 'gzip, deflate') if len(cookie)>0: req.add_header('Cookie', cookie[0:cookie.find(';')]) sleep(20) opener = urllib2.build_opener(SmartRedirectHandler()) opener.addheaders = [] forth = opener.open(req) #print forth.info() #print forth.headers.dict r_Forth = forth.read() if len(debug)>0: of = open(debug+'/'+strftime("%d_%b_%Y_%H_%M_%S_FORTH.log", gmtime()), 'w') of.write(r_Forth) of.close() #print 'Protest FIN.' }}} ##= 反馈 =