Exemple #1
0
 def backup_app_lib(self):
     dr = self.driver
     dr.find_element_by_name("工具箱").click()
     time.sleep(1)
     WebDriverWait(
         dr, 5).until(lambda d: d.find_element_by_name("备份程序数据")).click()
     time.sleep(1)
     WebDriverWait(dr,
                   5).until(lambda d: d.find_element_by_name("备份")).click()
     time.sleep(5)
     #检测备份完成
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("备份"))
     #删除lib文件
     removefile("/sdcard/008backUp/*/*/lib")
     time.sleep(2)
     #移动备份文件
     copyfile("/sdcard/008backUp/*", "/sdcard/008backUp2/")
     time.sleep(5)
     removefile("/sdcard/008backUp/*")
     time.sleep(5)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.do_toolbox_task
 def recovery_app_lib(self):
     dr = self.driver
     try:
         #提取备份文件
         copyfile("/sdcard/008backUp2/*__%s" % self.imei,
                  "/sdcard/008backUp/")
         time.sleep(2)
         copyfile("/sdcard/lib", "/sdcard/008backUp/*/*/")
         time.sleep(2)
         removefile("/sdcard/008backUp2/*__%s" % self.imei)
         time.sleep(5)
         WebDriverWait(
             dr,
             5).until(lambda d: d.find_element_by_name("备份程序数据")).click()
         time.sleep(1)
         dr.find_element_by_name(self.imei).click()
         time.sleep(1)
         WebDriverWait(
             dr, 5).until(lambda d: d.find_element_by_name("还原")).click()
         time.sleep(5)
         #检测还原成功
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name(self.imei))
     except:
         dr.press_keycode(4)
         time.sleep(1)
     dr.press_keycode(4)  # keypress back
     time.sleep(1)
     return self.do_toolbox_task
Exemple #3
0
 def recovery_app(self):
     dr = self.driver
     dr.find_element_by_name("工具箱").click()
     time.sleep(1)
     try:
         #提取备份文件
         copyfile("/sdcard/008backUp2/*__%s" % self.imei,
                  "/sdcard/008backUp/")
         time.sleep(5)
         removefile("/sdcard/008backUp2/*__%s" % self.imei)
         time.sleep(5)
         WebDriverWait(
             dr,
             5).until(lambda d: d.find_element_by_name("备份程序数据")).click()
         time.sleep(1)
         WebDriverWait(
             dr,
             5).until(lambda d: d.find_element_by_name(self.imei)).click()
         time.sleep(1)
         WebDriverWait(
             dr, 5).until(lambda d: d.find_element_by_name("还原")).click()
         time.sleep(1)
         #检测还原成功
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name(self.imei))
     except TimeoutException:
         pass
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.do_toolbox_task
Exemple #4
0
 def begin(self):
     dr = self.driver
     dr.press_keycode(3)
     time.sleep(1)
     #注册率
     sign_rate = random.randint(1, 10000)
     if sign_rate <= 8500:
         removefile("/sdcard/2/*.jpg")
         removefile("/sdcard/*.jpg")
         time.sleep(1)
         copyfile(
             "/sdcard/1/\.1touxiang/PIC\ \(%s\).jpg" %
             random.randint(1, 1400), "/sdcard/")
         time.sleep(0.5)
         for _ in range(5):
             copyfile(
                 "/sdcard/1/\.1xiangce/PIC\ \(%s\).jpg" %
                 random.randint(1, 1400), "/sdcard/2/")
             time.sleep(0.5)
         WebDriverWait(
             dr,
             30).until(lambda d: d.find_element_by_name("文件管理")).click()
         time.sleep(1)
         try:
             WebDriverWait(
                 dr,
                 30).until(lambda d: d.find_element_by_name("手机")).click()
             time.sleep(1)
         except TimeoutException:
             dr.press_keycode(4)
             time.sleep(1)
             dr.press_keycode(4)
             time.sleep(1)
             dr.press_keycode(4)
             time.sleep(1)
             return self.begin
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name("2")).click()
         time.sleep(1)
         dr.swipe(600, 400, 590, 400, 50)
         time.sleep(1)
         try:
             WebDriverWait(
                 dr,
                 5).until(lambda d: d.find_element_by_name("剪切")).click()
             time.sleep(1)
         except TimeoutException:
             WebDriverWait(
                 dr,
                 30).until(lambda d: d.find_element_by_name("更多")).click()
             time.sleep(2)
             WebDriverWait(
                 dr,
                 30).until(lambda d: d.find_element_by_name("剪切")).click()
             time.sleep(1)
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name("粘贴")).click()
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         WebDriverWait(
             dr,
             30).until(lambda d: d.find_element_by_name("文件管理")).click()
         time.sleep(1)
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name("图片")).click()
         time.sleep(5)
         dr.press_keycode(4)
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         #加速器
         WebDriverWait(dr, 10).until(
             lambda d: d.find_element_by_name("GMD Speed Time")).click()
         time.sleep(1)
         try:
             WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                 "com.gmd.speedtime:id/buttonStop")).click()
             time.sleep(1)
             WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                 "com.gmd.speedtime:id/buttonStart")).click()
             time.sleep(1)
         except TimeoutException:
             WebDriverWait(dr, 5).until(
                 lambda d: d.find_element_by_name("No, thanks")).click()
             time.sleep(1)
             WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                 "com.gmd.speedtime:id/buttonStop")).click()
             time.sleep(1)
             WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                 "com.gmd.speedtime:id/buttonStart")).click()
             time.sleep(1)
         dr.press_keycode(3)
         time.sleep(1)
         WebDriverWait(dr, 30).until(
             lambda d: d.find_element_by_name(self.appname)).click()
         time.sleep(5)
         #检测已进入app
         WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
             "com.tujiaapp.tujia:id/btn_register"))
         self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                           time.localtime().tm_min,
                                           time.localtime().tm_sec)
         time.sleep(1)
         return self.login_code_platform
     #加速器
     WebDriverWait(dr, 10).until(
         lambda d: d.find_element_by_name("GMD Speed Time")).click()
     time.sleep(1)
     WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
         "com.gmd.speedtime:id/buttonStop")).click()
     time.sleep(1)
     WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
         "com.gmd.speedtime:id/buttonStart")).click()
     time.sleep(1)
     dr.press_keycode(3)
     time.sleep(1)
     WebDriverWait(
         dr,
         30).until(lambda d: d.find_element_by_name(self.appname)).click()
     time.sleep(5)
     #检测已进入app
     WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
         "com.tujiaapp.tujia:id/btn_register"))
     self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                       time.localtime().tm_min,
                                       time.localtime().tm_sec)
     time.sleep(random.randint(30, 60))
     return self.ends
Exemple #5
0
 def main_loop(self):
     dr = self.driver
     m008 = self.machine008
     m1 = self.machine1
     m2 = self.machine2
     self.is_send = False
     # mlocation = self.machinelocation
     #切换脚本输入法
     dr.press_keycode(63)
     time.sleep(1)
     dr.find_element_by_name(
         "Appium Android Input Manager for Unicode").click()
     time.sleep(1)
     while True:
         try:
             dr.press_keycode(3)
             time.sleep(1)
             dr.press_keycode(3)
             time.sleep(1)
             dr.press_keycode(66)
             time.sleep(1)
             dr.press_keycode(66)
             time.sleep(1)
             #清后台
             # dr.press_keycode(82)
             # time.sleep(1)
             # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click()
             # time.sleep(1)
             #上传记录文件
             # if time.localtime().tm_hour == 8 and time.localtime().tm_min >= 30:
             #     self.upload_file()
             #周末控制效率
             # if m008.frist_day and (time.localtime().tm_wday == 5 or time.localtime().tm_wday == 6):
             #     print("周末激活暂停1800s....")
             #     time.sleep(1800)
             #发邮件
             # if time.localtime().tm_hour == 8 and not self.is_send:
             #     self.sms()
             #     self.is_send = True
             # if time.localtime().tm_hour == 11:
             #     self.is_send = False
             #计数器清0
             if time.localtime().tm_hour == 0 and self.runnum > 12:
                 self.runnum = 0
             MachineVPN(dr).run()
             #留存率设置
             m008.remain_rate = [
                 50,
                 45,
                 40,
                 35,
                 30,
                 25,
                 20,
                 15,
                 10,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
                 5,
             ]
             m008.frist_day = self.st[time.localtime().tm_hour - 1]
             #留存做完是否跳转做激活   True/False
             m008.change = False
             #添加留存从什么时候开始
             # m008.begin_time_month = 9
             # m008.begin_time_day = 29
             #备份还原
             m008.task_schedule = ["do_all_one_key", "modify_data"]
             m008.run()
             #定位
             # mlocation.latnum = random.randint(35, 37)+random.randint(50000, 450000)/1000000
             # mlocation.lotnum = random.randint(116, 118)+random.randint(300000, 350000)/1000000
             # mlocation.run()
             if m008.frist_day == 1:
                 print("激活")
                 m1.imei = m008.imei
                 m1.runnum = self.runnum
                 m1.run()
                 self.runnum += 1
                 #备份还原
                 m008.task_schedule = ["backup_app_lib"]
                 m008.run()
                 #控制激活量
                 # self.ctrl_new("", 100, 1800)      #filename, num, sleep_time
             elif m008.frist_day == 2:
                 print("留存已完成暂停30分钟")
                 time.sleep(1800)
             else:
                 print("留存")
                 m2.imei = m008.imei
                 #备份还原
                 m008.task_schedule = ["recovery_app_lib"]
                 m008.run()
                 m2.run()
                 #备份还原
                 m008.task_schedule = ["backup_app_lib"]
                 m008.run()
             #删除文件
             removefile("/sdcard/008backUp2/*/*/code_cache")
         except Exception as e:
             print("somting wrong")
             print(e)
         finally:
             pass
         print("Again\n")
     return self.exit