def main(): #sectets字段录入 sckey, success, failure, result, phone, password = [], [], [], [], [], [] #多人循环录入 while True: try: users = input() info = users.split(',') phone.append(info[0]) password.append(info[1]) sckey.append(info[2]) except: break #提交打卡 for index,value in enumerate(phone): print("开始获取用户%s信息"%(value[-4:])) try: campus = CampusCard(phone[index], password[index]) loginJson = campus.get_main_info() token = campus.user_info["sessionId"] driver.get('https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180'%token) #time.sleep(10) response = check_in(token) strTime = GetNowTime() if response.json()["msg"] == '成功': success.append(value[-4:]) msg = value[-4:]+"打卡成功-" + strTime result=response else: failure.append(value[-4:]) msg = value[-4:] + "打卡异常-" + strTime time.sleep(15) print(response.text) except Exception as err: print(err) msg = "出现错误" failure.append(value[-4:]) break print(msg) print("-----------------------") fail = sorted(set(failure),key=failure.index) strTime = GetNowTime() title = "成功: %s 人,失败: %s 人"%(len(success),len(fail)) try: if len(sckey[0])>2: print('主用户开始微信推送...') WechatPush(title,'https://sc.ftqq.com/'+sckey[0]+'.send',success,fail,result) except Exception as err: print("微信推送出错!%s"%(err))
def main(): #sectets字段录入 phone = input() password = input() phone2 = input() name = input() areaStr = input() sckey = input() #提交打卡 campus = CampusCard(phone, password) token = campus.user_info["sessionId"] userInfo = getUserInfo(token) response = checkIn(areaStr, userInfo, token, phone, phone2, name) strTime = getNowTime() if response.json()["msg"] == '成功': msg = strTime + "打卡成功" else: msg = strTime + "打卡异常" print(msg) print(response.json()) print("-----------------------") ff = str(response.json()["data"]) title = userInfo['username'] + msg + ff try: print('主用户开始微信推送...') wechatPush(title, sckey) except: print("微信推送出错!")
def main(): #定义变量 success, failure = [], [] #sectets字段录入 phone, password, sckey = [], [], [] #多人循环录入 while True: try: users = input() info = users.split(',') phone.append(info[0]) password.append(info[1]) sckey.append(info[2]) except: break #提交打卡 for index, value in enumerate(phone): print("开始尝试为用户%s打卡" % (value[-4:])) count = 0 while (count <= 3): try: campus = CampusCard(phone[index], password[index]) token = campus.user_info["sessionId"] userInfo = getUserInfo(token) response = checkIn(userInfo, token) strTime = getNowTime() if response.json()["msg"] == '成功': success.append(userInfo['username']) print(response.text) msg = strTime + userInfo['username'] + "打卡成功" if index == 0: result = response break else: failure.append(userInfo['username']) print(response.text) msg = strTime + userInfo['username'] + "打卡异常" count = count + 1 if index == 0: result = response if count <= 3: print('%s打卡失败,开始第%d次重试...' % (userInfo['username'], count)) time.sleep(5) except Exception as e: print(e.__class__) msg = "出现错误" failure.append(userInfo['username']) break print(msg) print("-----------------------") fail = sorted(set(failure), key=failure.index) title = "成功: %s 人,失败: %s 人" % (len(success), len(fail)) try: print('主用户开始微信推送...') wechatPush(title, sckey[0], success, fail, result) except: print("微信推送出错!")
def main(): # sectets字段录入 sckey, success, failure, result, phone, password, mail, key = [], [], [], [], [], [], [], [] # 多人循环录入 while True: try: users = input() info = users.split(',') phone.append(info[0]) password.append(info[1]) mail.append(info[2]) key.append(info[3]) sckey.append(info[4]) except BaseException: break # 提交打卡 print("-----------------------") for index, value in enumerate(phone): i, count, msg, isSmail = 0, 0, "", 1 print("开始获取用户%s信息" % (value[-4:])) while count < 1: try: campus = CampusCard(phone[index], password[index]) token = campus.user_info["sessionId"] res = check_in(token).json() strTime = GetNowTime() if res['code'] == '10000': success.append(value[-4:]) msg = value[-4:] + "-打卡成功-" + strTime isSmail = 2 result = res break else: failure.append(value[-4:]) msg = value[-4:] + "-失败-" + strTime print('%s打卡失败,开始第%d次重试...' % (value[-4:], count)) result = campus count += 1 time.sleep(10) except Exception as err: print(err) msg = '出现错误' isSmail = False count += 1 failure.append(value[-4:]) print(msg) if isSmail: try: Semail = sendEmail(mail[index], key[0], isSmail) print(Semail) except Exception: print('邮箱异常') print("-----------------------") fail = sorted(set(failure), key=failure.index) title = "成功: %s 人,失败: %s 人" % (len(success), len(fail)) for _ in range(1): try: if not (sckey is None): print('开始Wechat推送...') WechatPush(title, sckey[0], success, fail, result) break except: print("WeChat推送出错!")
def main(): # sectets字段录入 sckey, success, failure, result, phone, password, guardianPhone, egcP, sckey = [ ], [], [], [], [], [], [], [], [] # 多人循环录入 while True: try: users = input() info = users.split(',') phone.append(info[0]) password.append(info[1]) egcP.append(info[2]) guardianPhone.append(info[3]) sckey.append(info[4]) except BaseException: break # 提交打卡 for index, value in enumerate(phone): print("开始获取用户%s信息" % (value[-4:])) count = 0 while (count < 3): try: campus = CampusCard(phone[index], password[index]) loginJson = campus.get_main_info() token = campus.user_info["sessionId"] driver.get( 'https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180' % token) # time.sleep(10) response = check_in(loginJson["classId"], loginJson["classDescription"], loginJson["stuNo"], loginJson["username"], phone[index], egcP[index], guardianPhone[index], loginJson["userId"], loginJson["customerId"], token) if response.json()["msg"] == '成功' and index == 0: strTime = GetNowTime() success.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡成功-" + strTime result = response break elif response.json()["msg"] == '业务异常' and index == 0: strTime = GetNowTime() failure.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡失败-" + strTime result = response count = count + 1 elif response.json()["msg"] == '成功': strTime = GetNowTime() success.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡成功-" + strTime break else: strTime = GetNowTime() failure.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡异常-" + strTime count = count + 1 print('%s打卡失败,开始第%d次重试...' % (value[-6:], count)) time.sleep(15) except Exception as err: print(err) msg = "出现错误" failure.append(value[-4:]) break print(msg) print("-----------------------") fail = sorted(set(failure), key=failure.index) strTime = GetNowTime() title = "成功: %s 人,失败: %s 人" % (len(success), len(fail)) try: if len(sckey[0]) > 2: print('主用户开始微信推送...') WechatPush(title, 'https://sc.ftqq.com/' + sckey[0] + '.send', success, fail, result) except BaseException: print("微信推送出错!")
def get_token(phone, password, device_seed): stuobj = CampusCard(phone, password, device_seed).user_info if stuobj['login']: return stuobj["sessionId"] return None
def main(): #sectets字段录入 text, sckey, success, failure, result, phone, password = [], [], [], [], [], [], [] #多人循环录入 while True: try: users = input() info = users.split(',') phone.append(info[0]) password.append(info[1]) text.append(info[2]) sckey.append(info[3]) except: break templateid = "clockSign2" RuleId = 147 #提交打卡 for index, value in enumerate(phone): print("开始获取用户%sDeptId" % (value[-4:])) count = 0 while (count < 3): try: campus = CampusCard(phone[index], password[index]) loginJson = campus.get_main_info() token = campus.user_info["sessionId"] stuNum = loginJson["outid"] userName = loginJson["name"] driver.get( 'https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180' % token) #time.sleep(10) response = check_in(text[index], stuNum, userName, RuleId, templateid, token) if response.json()["msg"] == '成功' and index == 0: strTime = GetNowTime() success.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡成功-" + strTime result = response break elif response.json()["msg"] == '业务异常' and index == 0: strTime = GetNowTime() failure.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡失败-" + strTime result = response count = count + 1 elif response.json()["msg"] == '成功': strTime = GetNowTime() success.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡成功-" + strTime break else: strTime = GetNowTime() failure.append(value[-4:]) print(response.text) msg = value[-4:] + "打卡异常-" + strTime count = count + 1 print('%s打卡失败,开始第%d次重试...' % (value[-6:], count)) time.sleep(15) except: msg = "出现错误" failure.append(value[-4:]) break print(msg) print("-----------------------") fail = sorted(set(failure), key=failure.index) strTime = GetNowTime() title = "成功: %s 人,失败: %s 人" % (len(success), len(fail)) try: if len(sckey[0]) > 2: print('主用户开始微信推送...') WechatPush(title, sckey[0], success, fail, result) except: print("微信推送出错!")
def main(): #sectets字段录入 phone,ownphone,password, sckey ,username,text,stuno,userid,areastr,customerid,deptid,mergencypeoplephone,emergencycontact= [], [], [], [], [], [], [], [], [], [], [], [], [] while True: try: users = input() info = users.split(',') phone.append(info[0]) ownphone.append(info[0]) password.append(info[1]) sckey.append(info[2]) username.append(info[3]) text.append(info[4]) stuno.append(info[5]) userid.append(info[6]) areastr.append(info[7]) customerid.append(info[8]) deptid.append(info[9]) mergencypeoplephone.append(info[10]) emergencycontact.append(info[11]) except: break #提交打卡 for index,value in enumerate(phone): print("开始尝试为用户%s打卡"%(value[-4:])) count = 0 while (count <= 3): try: count +=1 #campus = CampusCard(phone[index], password[index]) campus = CampusCard(phone[0], password[0]) print(campus) token = campus.user_info["sessionId"] userInfo=getUserInfo(token) response = checkIn(userInfo,token) strTime = getNowTime() if response.json()["msg"] == '成功': success.append(value[-4:]) print(response.text) msg = strTime + value[-4:]+"打卡成功" if index == 0: result=response break else: failure.append(value[-4:]) print(response.text) msg = strTime + value[-4:] + "打卡异常" count = count + 1 if index == 0: result=response if count<=3: print('%s打卡失败,开始第%d次重试...'%(value[-4:],count)) time.sleep(5) except AttributeError: print('%s获取信息失败,请检查密码!'%value[-4:]) break except Exception as e: print(e.__class__) msg = "出现错误" failure.append(value[-4:]) break print(msg) print("-----------------------") fail = sorted(set(failure),key=failure.index) title = "成功: %s 人,失败: %s 人"%(len(success),len(fail))
def main(): #调试模式 debug = False #校内校外开关 mark = 1 #定义变量 success, failure = [], [] #sectets字段录入 phone, password, sckey = [], [], [] sckey.append(os.environ.get('sckey')) i = 1 #多人循环录入 while True: try: user = os.environ.get('user' + str(i)) if debug: print(user) if user is None: break phone.append(user.split(',')[0]) password.append(user.split(',')[1]) i += 1 except: break #提交打卡 for index, value in enumerate(phone): print("开始尝试为用户%s打卡" % (value[-4:])) count = 0 while (count <= 3): try: campus = CampusCard(phone[index], password[index]) token = campus.user_info["sessionId"] userInfo = getUserInfo(token) if mark == 0: response = checkIn(userInfo, token) if mark == 1: ownPhone = phone[index] response = check(ownPhone, userInfo, token) strTime = getNowTime() if response.json()["msg"] == '成功': success.append(value[-4:]) print(response.text) msg = strTime + value[-4:] + "打卡成功" if index == 0: result = response break else: failure.append(value[-4:]) print(response.text) msg = strTime + value[-4:] + "打卡异常" count = count + 1 if index == 0: result = response if count <= 3: print('%s打卡失败,开始第%d次重试...' % (value[-4:], count)) time.sleep(5) except Exception as e: print(e.__class__) failure.append(value[-4:]) strTime = getNowTime() msg = strTime + value[-4:] + "出现错误" count = count + 1 if index == 0: result = response if count <= 3: print('%s打卡出错,开始第%d次重试...' % (value[-4:], count)) time.sleep(1) print(msg) print("-----------------------") fail = sorted(set(failure), key=failure.index) title = "成功: %s 人,失败: %s 人" % (len(success), len(fail)) try: print('主用户开始微信推送...') wechatPush(title, sckey[0], success, fail, result) except: print("微信推送出错!")