1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| if __name__ == "__main__": description = "获取腾讯企业邮箱通讯录" parser = argparse.ArgumentParser(description=description, usage=msg()) parser.add_argument( "-u", "--email", required=True, dest="email", help="邮箱名") parser.add_argument( "-p", "--password", required=True, dest="password", help="邮箱密码") parser.add_argument( "-f", "--ifile", required=True, dest="inputfile", help="输入文件,格式为scv逗号分隔,4列分别为:开始时间,结束时间,备忘事件,提醒时间") args = parser.parse_args() email = args.email password = args.password limit = args.limit emailfile = args.emailfile departfile = args.departfile inputfile = args.inputfile session = requests.Session() headers = {'Connection': 'keep-alive', 'Cache-Control': 'max-age=0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36', 'DNT': '1', 'Accept-Encoding': 'gzip, deflate, sdch', 'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4', } resp = session.get('https://exmail.qq.com/login', headers=headers) content = resp.content public_key = get_public_key(content) ts = get_ts(content) p = get_p(public_key, password, ts) uin = email.split('@')[0] domain = email.split('@')[1]
post_data = {} post_data['sid'] = '' post_data['firstlogin'] = False post_data['domain'] = domain post_data['aliastype'] = 'other' post_data['errtemplate'] = 'dm_loginpage' post_data['first_step'] = '' post_data['buy_amount'] = '' post_data['year'] = '' post_data['company_name'] = '' post_data['is_get_dp_coupon'] = '' post_data['starttime'] = int(time.time() * 1000) post_data['redirecturl'] = '' post_data['f'] = 'biz' post_data['uin'] = uin post_data['p'] = p post_data['delegate_url'] = '' post_data['ts'] = ts post_data['from'] = '' post_data['ppp'] = '' post_data['chg'] = 0 post_data['loginentry'] = 3 post_data['s'] = '' post_data['dmtype'] = 'bizmail' post_data['fun'] = '' post_data['inputuin'] = email post_data['verifycode'] = '' headers = {'Content-Type': 'application/x-www-form-urlencoded'} url = 'https://exmail.qq.com/cgi-bin/login' resp = session.post(url, headers=headers, data=post_data) regexp = r'sid=(.*?)"' cookies_dict = resp.cookies.get_dict() cookies = '' for i in cookies_dict.keys(): cookies += "%s=%s; " % (i, cookies_dict[i]) sid = re.findall(regexp, resp.content)[0] with open(inputfile,'r') as infile:
for line in infile: Reminder_thing = line.strip().strip("\n").split(",") Calender_reminder(cookies, sid, Reminder_thing)
|