├── json ├── device_id.json ├── json_platform_info.json ├── json_new_device_info.json ├── json_new_device_info_back.json ├── json_context_config.json ├── json_remain_device_info.json ├── build.prop ├── json_fixed_data.json └── json_resolution.json ├── doc ├── ds.jpg ├── ing.gif ├── main_lua.png └── ds_gaitubao_com_305x305.jpg ├── inter ├── TSLib.lua ├── main.lua ├── lua.tsproj ├── test.lua ├── net.lua ├── pg_net.lua ├── xsd.lua ├── juyou.lua ├── yichu.lua ├── json.lua └── common.lua ├── README.md └── main.lua /json/device_id.json: -------------------------------------------------------------------------------- 1 | {"deviceId":"turing","deviceToken":"turing"} -------------------------------------------------------------------------------- /doc/ds.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ta01st/luaForAd/HEAD/doc/ds.jpg -------------------------------------------------------------------------------- /doc/ing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ta01st/luaForAd/HEAD/doc/ing.gif -------------------------------------------------------------------------------- /doc/main_lua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ta01st/luaForAd/HEAD/doc/main_lua.png -------------------------------------------------------------------------------- /inter/TSLib.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ta01st/luaForAd/HEAD/inter/TSLib.lua -------------------------------------------------------------------------------- /doc/ds_gaitubao_com_305x305.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ta01st/luaForAd/HEAD/doc/ds_gaitubao_com_305x305.jpg -------------------------------------------------------------------------------- /inter/main.lua: -------------------------------------------------------------------------------- 1 | require "TSLib" 2 | json = require('json') 3 | test = require('test') 4 | 5 | 6 | function main() 7 | test.func3() 8 | end; 9 | main() 10 | 11 | -------------------------------------------------------------------------------- /inter/lua.tsproj: -------------------------------------------------------------------------------- 1 | [res] 2 | [lib] 3 | [file] 4 | test.lua 5 | yichu.lua 6 | xsd.lua 7 | TSLib.lua 8 | pg_net.lua 9 | net.lua 10 | juyou.lua 11 | json.lua 12 | common.lua 13 | aaa.lua 14 | main.lua 15 | -------------------------------------------------------------------------------- /inter/test.lua: -------------------------------------------------------------------------------- 1 | test = {} 2 | 3 | -- 定义一个常量 4 | test.constant = "这是一个常量" 5 | 6 | -- 定义一个函数 7 | function test.func2() 8 | toast("这是一个公有函数!\n") 9 | end 10 | 11 | local function func2() 12 | toast("这是一个私有函数!") 13 | end 14 | 15 | function test.func3() 16 | func2() 17 | test.func2() 18 | end 19 | 20 | return test -------------------------------------------------------------------------------- /json/json_platform_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 3, 3 | "userId": 1, 4 | "platformId": 0, 5 | "appKey": "0983542e92f34b3681304bf547348d22", 6 | "channel": "360|baidu|xiaomayi|fengyun|jili|yingyongbao|letao|youba|hexi", 7 | "name": "九段", 8 | "packageName": "org.pangu.turing.jiuduan", 9 | "apkPath": "jiuduan.apk", 10 | "token": "0983542e92f34b3681304bf547348d22", 11 | "isCanRun": 1, 12 | "isClose": 0, 13 | "createDate": 1484539633000, 14 | "updateDate": 1484539633000 15 | } -------------------------------------------------------------------------------- /json/json_new_device_info.json: -------------------------------------------------------------------------------- 1 | {"accessToken":"","appId":0,"device":{"androidId":"x1t0ntd00bf8g8u0","androidSerial":"ggdxezf99wb3lw0t","androidVersion":"4.4W","blueTooth":"","board":"lkD8p4WV","bootloader":"unknown","brand":"Coolpad","bssid":"f5:de:68:6b:7c:41","carrier":"China Telecom","carrierCode":"46003","countryCode":"CN","cpuABI":"armeabi-v7a","device":"lkD8p4WV","display":"4.4W.072.P1.Coolpad.","height":"800","imei":"867639039549470","imsi":"460037195269613","ip":"","latitude":"","longitude":"","mac":"f5:de:68:6b:7c:41","manufacture":"Coolpad","model":"Coolpad 8670","osArch":"","osName":"","osVersion":"","phone":"13348380743","phoneStatus":"","product":"lkD8p4WV","sdk":"20","simSerial":"89860371234406594315","simStatus":"","ssid":"TPLINKi950","ua":"Dalvik/1.4.0(Linux; U; 4.4W; Coolpad Build/IV14M","width":"1280"},"device_type":0,"is_active":0,"is_remain":0} -------------------------------------------------------------------------------- /json/json_new_device_info_back.json: -------------------------------------------------------------------------------- 1 | {"accessToken":"","appId":0,"device":{"androidId":"x1t0ntd00bf8g8u0","androidSerial":"ggdxezf99wb3lw0t","androidVersion":"4.4W","blueTooth":"","board":"lkD8p4WV","bootloader":"unknown","brand":"Coolpad","bssid":"f5:de:68:6b:7c:41","carrier":"China Telecom","carrierCode":"46003","countryCode":"CN","cpuABI":"armeabi-v7a","device":"lkD8p4WV","display":"4.4W.072.P1.Coolpad.","height":"800","imei":"867639039549470","imsi":"460037195269613","ip":"","latitude":"","longitude":"","mac":"f5:de:68:6b:7c:41","manufacture":"Coolpad","model":"Coolpad 8670","osArch":"","osName":"","osVersion":"","phone":"13348380743","phoneStatus":"","product":"lkD8p4WV","sdk":"20","simSerial":"89860371234406594315","simStatus":"","ssid":"TPLINKi950","ua":"Dalvik/1.4.0(Linux; U; 4.4W; Coolpad Build/IV14M","width":"1280"},"device_type":0,"is_active":0,"is_remain":0} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # luaForAd 2 | 3 | 用触动精灵lua脚本刷各种广告,由后台下发个广告SDK任务,支持23种分辨率,支持水军,留存上报,留存可后台设置百分比,10多个平台广告同时刷,实时上报刷量数据 4 | 5 | 6 | 7 | 本脚本建议配合盘古后台系统,fakeapk hook 等工具使用。 8 | 9 | |工具名称| 下载链接|备注| 10 | |----|-----|---| 11 | |盘古后台系统|https://gitee.com/kuangyufei/pangu|盘古系统后台| 12 | |fakeapk|https://gitee.com/kuangyufei/fakeapk|比 008更强大的手机信息修改器| 13 | |盘古VPN系统|https://gitee.com/kuangyufei/pangu_vpn|vpn自动选择,切换工具| 14 | |盘古管理系统|https://gitee.com/kuangyufei/pangu_manage|实时查看各广告平台刷量数据,包括留存比例,水军量,转化率等等| 15 | 16 | 17 | ![image](https://gitee.com/kuangyufei/luaForAd/raw/master/doc/main_lua.png) 18 | 19 | ### 同时运行3个模拟器刷机效果 20 | 21 | ![image](https://gitee.com/kuangyufei/luaForAd/raw/master/doc/ing.gif) 22 | 23 | ### 联系作者 24 | 25 | QQ群 720098517 微信:15817321796 验证注明:luaforad 26 | 27 | ### 给点赏银 28 | 29 | ![image](https://gitee.com/kuangyufei/luaForAd/raw/master/doc/ds_gaitubao_com_305x305.jpg) 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /json/json_context_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": "2.0", 4 | "author": "turing", 5 | "data": "2017-2-16", 6 | "reportUrl": "http://pangu.u-app.cn/mobile/report.pangu", 7 | "luaPath":"/mnt/sdcard/TouchSprite/lua/", 8 | "apkPath": "/mnt/sdcard/TouchSprite/res/apk/", 9 | "jsonPath": "/mnt/sdcard/TouchSprite/lua/json/", 10 | "remainPath": "/mnt/sdcard/TouchSprite/lua/json/remain/", 11 | "ping": [ 12 | { 13 | "url": "http://api.ip138.com/query/?datatype=jsonp&token=38c2ffed72e199a01ce60f3231c79ebc" 14 | }, 15 | { 16 | "url":"http://pv.sohu.com/cityjson" 17 | } 18 | ], 19 | "resolutionJsonName": "json_resolution.json", 20 | "fixJsonName": "json_fixed_data.json", 21 | "newDeviceName":"json_new_device_info.json", 22 | "remainDeviceName":"json_remain_device_info.json", 23 | "appInfoName":"json_app_info.json", 24 | "screen_portait":"screen_portait.apk", 25 | "black_ip_count":5, 26 | "black_ip_list":[{"ip":"101.105.54.92"},{"ip":"14.103.227.150"},{"ip":"101.105.54.92"},{"ip":"182.34.185.65"},{"ip":"59.40.75.153"}] 27 | } 28 | } -------------------------------------------------------------------------------- /json/json_remain_device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "androidId": "C7258VMG10U4RSLL", 3 | "androidSerial": "AK08B3NOGNZFGTTH", 4 | "blueTooth": "", 5 | "bssid": "d3:cb:e1:53:33:f0", 6 | "buildInfo": { 7 | "androidVersion": "4.4", 8 | "board": "VIE-AL10_JYX7", 9 | "bootloader": "unknown", 10 | "brand": "HUAWEI", 11 | "cpu_abi": "Kirin 920", 12 | "cpu_abi2": "", 13 | "device": "EMUI OS", 14 | "display": "EMUI OS", 15 | "fingerPrint": "HUAWEI/VIE-AL10/VIE-AL10.EMUI OS.Wed Nov 04 00:00:00 CST 2015/XYZ98T/77856:user/release-keys", 16 | "hardWare": "Kirin 920", 17 | "host": "3RYB6", 18 | "id": "JDQ39E", 19 | "increment": "VIE-AL10.EMUI OS.Wed Nov 04 00:00:00 CST 2015", 20 | "manufacture": "VIE-AL10", 21 | "model": "VIE-AL10", 22 | "osArch": "Kirin 920", 23 | "osName": "Linux", 24 | "osVersion": "3.6.1 gcym0ima", 25 | "product": "AL10", 26 | "radioVersion": "", 27 | "sdk": "19", 28 | "serial": "", 29 | "tags": "", 30 | "time": "", 31 | "type": "", 32 | "user": "" 33 | }, 34 | "carrier": "China Mobile", 35 | "carrierCode": "46000", 36 | "countryCode": "CN", 37 | "height": "1920", 38 | "imei": "466186033932447", 39 | "imsi": "460073038933414", 40 | "ip": "123.186.158.233", 41 | "latitude": 41.325836181641, 42 | "longitude": 123.77806091309, 43 | "mac": "d3:cb:e1:53:33:f0", 44 | "networkSubType": 13, 45 | "networkSubTypeName": "TD-LTE", 46 | "networkType": 0, 47 | "networkTypeName": "MOBILE", 48 | "phone": "13742484218", 49 | "phoneStatus": "1", 50 | "simSerial": "89860239543210703858", 51 | "simStatus": "5", 52 | "ssid": "MARGERY", 53 | "ua": "Dalvik/1.4.0(Linux; U; 4.3; HUAWEI Build/UT0HE", 54 | "width": "1080" 55 | } -------------------------------------------------------------------------------- /json/build.prop: -------------------------------------------------------------------------------- 1 | # begin build properties 2 | # autogenerated by buildinfo.sh 3 | ro.build.id=JDQ39E 4 | ro.build.display.id=Droid-WIN 4.2.2 JDQ39E eng.work.20160926.162000 test-keys 5 | ro.build.version.incremental=eng.work.20160926.162000 6 | ro.build.version.sdk=17 7 | ro.build.version.codename=REL 8 | ro.build.version.release=4.2.2 9 | ro.build.date=Mon Sep 26 16:20:53 HKT 2016 10 | ro.build.date.utc=1474878053 11 | ro.build.type=eng 12 | ro.build.user=work 13 | ro.build.host=Droid4x-BuildStation 14 | ro.build.tags=test-keys 15 | 16 | ro.product.brand=Android 17 | ro.product.name=Droid4X 18 | ro.product.device=Droid4X 19 | ro.product.board= 20 | ro.product.cpu.abi=x86 21 | 22 | ro.product.locale.language=en 23 | ro.product.locale.region=US 24 | ro.wifi.channels= 25 | ro.board.platform= 26 | # ro.build.product is obsolete; use ro.product.device 27 | ro.build.product=Droid4X 28 | # Do not try to parse ro.build.description or .fingerprint 29 | ro.build.description=Droid4X-WIN 4.2.2 JDQ39E eng.work.20160926.162000 test-keys 30 | ro.build.fingerprint=Android/vbox86p/vbox86p:4.2.2/JDQ39E/eng.work.20160926.162000:eng/test-keys 31 | ro.build.characteristics=default 32 | # end build properties 33 | # 34 | # system.prop 35 | # 36 | 37 | rild.libpath=/system/lib/libreference-ril.so 38 | rild.libargs=-d /dev/ttyS0 39 | dalvik.vm.heapsize=256m 40 | persist.service.adb.enable=1 41 | ro.secure=0 42 | ro.opengles.version=131072 43 | 44 | # 45 | # Capabilities 46 | # 47 | 48 | ro.droid4x.caps.bat=on 49 | ro.droid4x.caps.gps=on 50 | ro.droid4x.caps.acc=on 51 | ro.droid4x.caps.cam=on 52 | ro.droid4x.caps.scr=on 53 | ro.droid4x.caps.rmt=on 54 | 55 | # 56 | # ADDITIONAL_BUILD_PROPERTIES 57 | # 58 | keyguard.no_require_sim=true 59 | ro.com.android.dataroaming=true 60 | ro.com.android.dateformat=MM-dd-yyyy 61 | ro.config.ringtone=Ring_Synth_04.ogg 62 | ro.config.notification_sound=pixiedust.ogg 63 | ro.carrier=unknown 64 | ro.config.alarm_alert=Alarm_Classic.ogg 65 | ro.build.date=Mon Sep 26 16:20:53 HKT 2016 66 | persist.sys.language=en 67 | persist.sys.country=US 68 | ro.ril.hsxpa=1 69 | ro.ril.gprsclass=10 70 | wifi.interface=eth1 71 | ro.product.cpu.abi2=armeabi-v7a 72 | ro.product.cpu.upgradeabi=armeabi 73 | ro.kernel.android.checkjni=0 74 | net.bt.name=Android 75 | dalvik.vm.stack-trace-file=/data/anr/traces.txt 76 | ro.product.model=HUAWEI 77 | -------------------------------------------------------------------------------- /main.lua: -------------------------------------------------------------------------------- 1 | 2 | require "./inter/TSLib" 3 | json = require('./inter/json') 4 | common = require('./inter/common') 5 | pg_net = require('./inter/pg_net') 6 | xsd = require('./inter/xsd') 7 | yichu = require('./inter/yichu') 8 | juyou = require('./inter/juyou') 9 | 10 | gTaskIP = "88.88.88.88"; 11 | gImei = "8888888888"; -- 初始IEMI 12 | isRunRemain = 0; -- 是否是运行留存的lua 13 | isRunShuiJun = 0; -- 是否跑水军 14 | function startTask() 15 | local flag = 0; 16 | local stockPath = "/mnt/sdcard/TouchSprite/lua/json/json_remain_device_info.json" 17 | local platformPath = "/mnt/sdcard/TouchSprite/lua/json/json_platform_info.json" 18 | local newDevicePath = "/mnt/sdcard/TouchSprite/lua/json/json_new_device_info.json" 19 | local newDevicePathBack = "/mnt/sdcard/TouchSprite/lua/json/json_new_device_info_back.json" 20 | common.delAllLog(); 21 | common.kyInitPortarit(); 22 | local loopTime = 10; 23 | if(1==pg_net.netPhoneLogin())then 24 | log("runMyApp-- -1","debug"); 25 | common.kyToast("登录后台失败",3); 26 | lua_restart(); 27 | end; 28 | if(1==pg_net.netGetBlackIpList())then 29 | log("runMyApp--0","debug"); 30 | common.kyToast("请求Ip黑名单网络异常",3); 31 | lua_restart(); 32 | end; 33 | 34 | repeat 35 | -- 1.取任务 36 | log("runMyApp--1","debug"); 37 | if(0 == pg_net.netGetOneTask() )then 38 | loopTime = gGetTaskTable["loopTime"]; 39 | if(gGetTaskTable["isHaveTask"] == 1)then -- 有任务 40 | common.kyToast("获得一个任务,将执行"); 41 | log("runMyApp--2","debug"); 42 | gTaskIP = gGetTaskTable["taskIp"]; 43 | -- 44 | -- 2.执行任务 45 | --操作类型 0:增量赚钱 1:增量水军 2:存量赚钱 3:存量水军 46 | if(gGetTaskTable["task"]["operType"] == 0 or gGetTaskTable["task"]["operType"] == 1 )then 47 | isRunRemain = 0; -- 是否存量 48 | else 49 | isRunRemain = 1; 50 | end; 51 | -- file 先文件拷贝下 52 | if(true == isFileExist(newDevicePath) and true == isFileExist(newDevicePathBack) )then 53 | local backContent = readFileString(newDevicePathBack) 54 | writeFileString(newDevicePath,backContent); 55 | else 56 | common.kyToast("拷贝文件失败,请检查,退出!"); 57 | return; 58 | end; 59 | -- 保存增量或存量信息 60 | if(true == isFileExist(stockPath))then 61 | local deviceJson = json.encode(gGetTaskTable["task"]["changeDeviceInfo"]); -- 转json 62 | writeFileString(stockPath,deviceJson); 63 | end; 64 | -- 保存平台信息 65 | if(true == isFileExist(platformPath))then 66 | local platformJson = json.encode(gGetTaskTable["task"]["app"]); -- 67 | log("runMyApp-"..platformJson,"debug"); 68 | writeFileString(platformPath,platformJson); 69 | end; 70 | log("runMyApp--3","debug"); 71 | if(gGetTaskTable["task"]["operType"] == 0 or gGetTaskTable["task"]["operType"] == 2 )then 72 | isRunShuiJun = 0; -- 是否水军 73 | else 74 | isRunShuiJun = 1; 75 | end; 76 | 77 | log("runMyApp--4|","debug"); 78 | if(gGetTaskTable["task"]["app"]["platformId"] == 1)then 79 | flag = xsd.runMyApp(isRunShuiJun); 80 | elseif(gGetTaskTable["task"]["app"]["platformId"] == 2)then 81 | flag = yichu.runMyApp(isRunShuiJun); 82 | elseif(gGetTaskTable["task"]["app"]["platformId"] == 3)then 83 | flag = juyou.runMyApp(isRunShuiJun); 84 | else 85 | 86 | end; 87 | 88 | -- 完成任务 89 | if(flag == 0 )then 90 | pg_net.netTaskFinished(1);-- 任务是否完成 1:完成 0:没有完成 91 | common.kyToast("完成任务,将获取下一个任务") 92 | else 93 | pg_net.netTaskFinished(0); 94 | common.kyToast("任务没有完成,应该是广告没有弹出,将获取下一个任务") 95 | end; 96 | log("runMyApp--5"..flag,"debug"); 97 | else -- 没有任务 98 | common.kyToast("没有任务或已执行过任务"); 99 | log("runMyApp--6","debug"); 100 | end; 101 | end; 102 | common.kyToast("等待任务中...|loopTime:"..loopTime); 103 | common.kySleep(loopTime); 104 | until(1==0) 105 | end; 106 | function main() 107 | startTask(); 108 | end; 109 | main() -------------------------------------------------------------------------------- /inter/net.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | -- turing 2017/1/19 create 3 | ------------------------------------------------------------------------------- 4 | --net = {} 5 | require "TSLib" 6 | json = require('json') 7 | 8 | host = "http://127.0.0.1:8080/pc/"; 9 | phoneJson = ""; 10 | local function initPhoneInfo() 11 | local filePhone = "/mnt/sdcard/TouchSprite/lua/json/json_new_device_info.json"; 12 | if(true == isFileExist(filePhone))then 13 | phoneJson = readFileString(filePhone); --固定数据文件 14 | phoneTable = json.decode(phoneJson); --json转table 15 | 16 | phoneTable["appId"] = 1; 17 | 18 | phoneJson = json.encode(phoneTable); 19 | toast(phoneJson); 20 | writeFileString(filePhone,phoneJson); 21 | else 22 | toast("缺少配置文件,请检查...."); 23 | lua_exit(); -- 退出脚本 24 | end; 25 | end; 26 | local function remainInfo() 27 | local filePhone = "/mnt/sdcard/TouchSprite/lua/json/remain/2017-01-21_1_org.kyf.xsd.wzq.json"; 28 | local filePhone1 = "/mnt/sdcard/TouchSprite/lua/json/json_remain_device_info.json"; 29 | if(true == isFileExist(filePhone))then 30 | phoneJson = readFileString(filePhone); --固定数据文件phoneTable 31 | phoneTable = json.decode(phoneJson); --json转table 32 | temIp = "204:108:252:218"; --204:108:252:218 33 | imei = "iuirwejoipofjqp"; -- y7102M07QAkwI51u 34 | 35 | for key, value in ipairs(phoneTable["deviceList"]) do 36 | if (gIp == value["ip"]) then 37 | remainJson = json.encode(value); 38 | toast("恭喜你,发现一个留存IP,已保存信息"); 39 | isRemainIP = true; 40 | writeFileString(gFileRemainDevice,remainJson); 41 | end; 42 | end 43 | toast("木有发现"); 44 | value = phoneTable["deviceList"][20]; 45 | remainJson = json.encode(value); 46 | toast(remainJson); 47 | writeFileString(filePhone1,remainJson); 48 | --[[ 49 | for key, value in ipairs(phoneTable[1]) do 50 | --if temIp == value["ip"] then 51 | remainJson = json.encode(value); 52 | toast(remainJson); 53 | writeFileString(filePhone1,remainJson); 54 | break; 55 | --end; 56 | end; 57 | --]] 58 | else 59 | toast("缺少配置文件,请检查...."); 60 | lua_exit(); -- 退出脚本 61 | end; 62 | end; 63 | local function report() 64 | local filePhone = "/mnt/sdcard/TouchSprite/lua/json/json_new_device_info.json"; 65 | log("report -- 0","jsonReq"); 66 | if(true == isFileExist(filePhone))then 67 | phoneJson = readFileString(filePhone); --固定数据文件 68 | phoneTable = json.decode(phoneJson); --json转table 69 | 70 | log("report -- 0","jsonReq"); 71 | phoneTable["appId"] = 1; 72 | 73 | log("report -- 1","jsonReq"); 74 | phoneJson = json.encode(phoneTable); 75 | 76 | log("report -- 2","jsonReq"); 77 | host = "http://pangu.u-app.cn/mobile/report.pangu"; 78 | 79 | --url = host .. "?report="..phoneJson; 80 | log(host,"jsonReq"); 81 | 82 | log("report -- 3","jsonReq"); 83 | toast(host); 84 | log("report -- 4","jsonReq"); 85 | --str = httpGet(url); 86 | str = httpPost(host,phoneJson); 87 | if(str ~= nil)then 88 | log("report -- 999","jsonReq"); 89 | toast(str); 90 | end 91 | 92 | log("report -- 5","jsonReq"); 93 | --toast(phoneJson); 94 | --writeFileString(filePhone,phoneJson); 95 | else 96 | toast("缺少配置文件,请检查...."); 97 | lua_exit(); -- 退出脚本 98 | end; 99 | end; 100 | function getAppInfo() 101 | report(); 102 | --req = {userId="",Token=""}; 103 | --jsonReq = json.encode(req); --tableתjson 104 | --log(jsonReq,"net"); 105 | --url = host .. "getAppList.pangu"; 106 | --str = httpGet("http://www.baidu.com"); 107 | --str = httpPost(url,phoneJson); 108 | 109 | --str = httpGet("http://127.0.0.1:8080/pc/index.pangu"); 110 | --str = httpGet("http://api.ip138.com/query/?datatype=jsonp&token=38c2ffed72e199a01ce60f3231c79ebc"); 111 | --toast(str); 112 | --str=httpPost(url,phoneJson); 113 | --dialog(str); 114 | end; 115 | getAppInfo(); -------------------------------------------------------------------------------- /inter/pg_net.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | -- 3 | ------------------------------------------------------------------------------- 4 | pg_net = {} 5 | function pg_net.netPhoneLogin() 6 | local deviceIdPath = "/mnt/sdcard/TouchSprite/lua/json/device_id.json" 7 | local deviceLoginUrl = "http://pangu.u-app.cn/mobile/deviceLogin.pangu" 8 | if(true == isFileExist(deviceIdPath))then 9 | local jsonStr = readFileString(deviceIdPath);--读取分辨率配置文件 10 | gDeviceTable = json.decode(jsonStr); --json转table 11 | toast("更换设备ID",5); 12 | else 13 | toast("缺少配置文件,请检查....",5); 14 | lua_exit();-- 退出脚本 15 | end; 16 | local deviceReq = {} 17 | deviceReq["deviceId"] = gDeviceTable["deviceId"]; 18 | local postJson = json.encode(deviceReq); -- 转json 19 | local jsonStr = httpPost(deviceLoginUrl,postJson); 20 | if(false == jsonStr)then 21 | log("netPhoneLogin--1","debug"); 22 | return 1; 23 | else 24 | log("netPhoneLogin--2","debug"); 25 | writeFileString(deviceIdPath,jsonStr); 26 | gDeviceTable = json.decode(jsonStr); --json转table 27 | end; 28 | log("netPhoneLogin--3","debug"); 29 | return 0; 30 | end; 31 | function pg_net.netGetAppInfo(appId) 32 | local getAppInfoUrl = "http://pangu.u-app.cn/mobile/getAppInfo.pangu" 33 | local getAppInfoReq = {} 34 | log("netGetAppInfo--0","debug"); 35 | getAppInfoReq["appId"] = appId; 36 | local postJson = json.encode(getAppInfoReq); -- 转json 37 | local jsonStr = httpPost(getAppInfoUrl,postJson); 38 | if(false == jsonStr)then 39 | log("netGetAppInfo--false","debug"); 40 | return 1; 41 | else 42 | getAppInfoTable = json.decode(jsonStr); --json转table 43 | log("netGetAppInfo--2","debug"); 44 | end; 45 | log("netGetAppInfo--3","debug"); 46 | return 0; 47 | end; 48 | function pg_net.netGetOneTask() 49 | local getTaskUrl = "http://pangu.u-app.cn/mobile/getTask.pangu" 50 | local getTaskReq = {} 51 | log("netGetOneTask--0"..gDeviceTable["deviceToken"],"debug"); 52 | getTaskReq["deviceId"] = gDeviceTable["deviceToken"]; 53 | getTaskReq["accessToken"] = gDeviceTable["deviceToken"]; 54 | toast("deviceId:"..getTaskReq["deviceId"]); 55 | local postJson = json.encode(getTaskReq); -- 转json 56 | local jsonStr = httpPost(getTaskUrl,postJson); 57 | if(false == jsonStr)then 58 | log("netGetOneTask--false","debug"); 59 | return 1; 60 | else 61 | log(jsonStr,"debug"); 62 | log("netGetOneTask--2","debug"); 63 | gGetTaskTable = json.decode(jsonStr); --json转table 64 | end; 65 | return 0; 66 | end; 67 | function pg_net.netTaskFinished(isFinished) 68 | local taskFinishUrl = "http://pangu.u-app.cn/mobile/taskFinish.pangu" 69 | local taskFinishReq = {} 70 | log("netTaskFinished--0","debug"); 71 | taskFinishReq["isFinished"] = isFinished; 72 | taskFinishReq["vpnToken"] = gGetTaskTable["task"]["vpnToken"]; 73 | taskFinishReq["taskId"] = gGetTaskTable["task"]["taskId"]; 74 | local postJson = json.encode(taskFinishReq); -- 转json 75 | local jsonStr = httpPost(taskFinishUrl,postJson); 76 | if(false == jsonStr)then 77 | log("netTaskFinished--false","debug"); 78 | return 1; 79 | end; 80 | return 0; 81 | end; 82 | -- 验证留存IP 83 | function pg_net.netCheckRemainIp(localIp,remainIp) 84 | return true; 85 | end; 86 | function pg_net.netGetBlackIpList() 87 | local postUrl = "http://pangu.u-app.cn/mobile/getBlackIpList.pangu" 88 | local getBlackIpListReq = {} 89 | getBlackIpListReq["platformId"] = 1; 90 | local postJson = json.encode(getBlackIpListReq); -- 转json 91 | local jsonStr = httpPost(postUrl,postJson); 92 | if(false == jsonStr)then 93 | toast("获取黑名单IP失败",5); 94 | log("netGetBlackIpList--false","debug"); 95 | return 1; 96 | else 97 | toast("IP黑名单:"..jsonStr,5); 98 | gBlackIpTable = json.decode(jsonStr); --json转table 99 | end; 100 | log("netGetBlackIpList--1","debug"); 101 | return 0; 102 | end; 103 | function pg_net.netIpcheck() 104 | local getUrl = "http://pangu.u-app.cn/pc/remoteIp.pangu" 105 | local jsonStr = httpGet(getUrl); 106 | local remoteIpTable = {} 107 | log("netIpcheck--0","debug"); 108 | if(false == jsonStr)then 109 | return nil; 110 | else 111 | remoteIpTable = json.decode(jsonStr); --json转table 112 | log("netIpcheck--1"..remoteIpTable["data"],"debug"); 113 | return remoteIpTable["data"]; 114 | end; 115 | end; 116 | return pg_net; -------------------------------------------------------------------------------- /json/json_fixed_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "home": [ 3 | { 4 | "x": 200, 5 | "y": 660, 6 | "color": 16777215 7 | }, 8 | { 9 | "x": 360, 10 | "y": 640, 11 | "color": 16777215 12 | }, 13 | { 14 | "x": 362, 15 | "y": 742, 16 | "color": 16777215 17 | } 18 | ], 19 | "appStopRun": [ 20 | { 21 | "x": 140, 22 | "y": 601, 23 | "color": 15987699 24 | }, 25 | { 26 | "x": 174, 27 | "y": 616, 28 | "color": 15987699 29 | }, 30 | { 31 | "x": 351, 32 | "y": 728, 33 | "color": 15987699 34 | } 35 | ], 36 | "parsePackError": [ 37 | { 38 | "x": 91, 39 | "y": 653, 40 | "color": 15987699 41 | }, 42 | { 43 | "x": 316, 44 | "y": 657, 45 | "color": 15987699 46 | }, 47 | { 48 | "x": 352, 49 | "y": 791, 50 | "color": 15987699 51 | } 52 | ], 53 | "sorryInstallStop": [ 54 | { 55 | "x": 499, 56 | "y": 598, 57 | "color": 15987699 58 | }, 59 | { 60 | "x": 351, 61 | "y": 732, 62 | "color": 15987699 63 | } 64 | ], 65 | "applyNotInstall": [ 66 | { 67 | "x": 201, 68 | "y": 260, 69 | "color": 15987699 70 | }, 71 | { 72 | "x": 165, 73 | "y": 1235, 74 | "color": 15987699 75 | } 76 | ], 77 | "nextStep":[ 78 | { 79 | "x":19, 80 | "y":125, 81 | "color":263429 82 | }, 83 | { 84 | "x": 544, 85 | "y": 1232, 86 | "color":15000805 87 | }, 88 | { 89 | "x": 202, 90 | "y": 1225, 91 | "color":15987699 92 | } 93 | ], 94 | "installStep":[ 95 | { 96 | "x":19, 97 | "y":125, 98 | "color":263429 99 | }, 100 | { 101 | "x": 522, 102 | "y": 1218, 103 | "color":15987699 104 | }, 105 | { 106 | "x": 170, 107 | "y": 1238, 108 | "color":15987699 109 | } 110 | ], 111 | "openStep":[ 112 | { 113 | "x":19, 114 | "y":125, 115 | "color":263429 116 | }, 117 | { 118 | "x": 512, 119 | "y": 1223, 120 | "color":15987699 121 | }, 122 | { 123 | "x": 206, 124 | "y": 1236, 125 | "color":15987699 126 | } 127 | ], 128 | "home008":[ 129 | { 130 | "x":120, 131 | "y":251, 132 | "color":592395 133 | }, 134 | { 135 | "x": 491, 136 | "y": 385, 137 | "color":790032 138 | } 139 | ], 140 | "sorryInstallUnkown":[ 141 | { 142 | "x":169, 143 | "y":703, 144 | "color":2631720 145 | }, 146 | { 147 | "x": 111, 148 | "y": 584, 149 | "color":15987699 150 | }, 151 | { 152 | "x": 588, 153 | "y": 601, 154 | "color":15987699 155 | } 156 | ], 157 | "installAllApp":[ 158 | { 159 | "x":334, 160 | "y":872 161 | } 162 | ], 163 | "closeAllApp":[ 164 | { 165 | "x":610, 166 | "y":382 167 | } 168 | ], 169 | "popNeedInstallApp": [ 170 | { 171 | "x": 482, 172 | "y": 400, 173 | "color": 2337347 174 | }, 175 | { 176 | "x": 547, 177 | "y": 453, 178 | "color": 2337347 179 | }, 180 | { 181 | "x": 560, 182 | "y": 395, 183 | "color": 2337347 184 | } 185 | ] 186 | } -------------------------------------------------------------------------------- /json/json_resolution.json: -------------------------------------------------------------------------------- 1 | { 2 | "supportCount":"14", 3 | "supportResolution_1": [ 4 | { 5 | "resolution":"R720X1280", 6 | "closeInterstitial":{ "x": 610, 7 | "y": 415} 8 | }, 9 | { 10 | "resolution":"R540X960", 11 | "closeInterstitial":{ "x": 542, 12 | "y": 480} 13 | }, 14 | { 15 | "resolution":"R480X800", 16 | "closeInterstitial":{ "x": 520, 17 | "y": 508} 18 | }, 19 | { 20 | "resolution":"R320X480", 21 | "closeInterstitial":{ "x": 578, 22 | "y": 445} 23 | }, 24 | { 25 | "resolution":"R1080X1920", 26 | "closeInterstitial":{ "x": 700, 27 | "y": 280} 28 | }, 29 | { 30 | "resolution":"R1200X1920", 31 | "closeInterstitial":{ "x": 700, 32 | "y": 235} 33 | }, 34 | { 35 | "resolution":"R1280X800", 36 | "closeInterstitial":{ "x": 640, 37 | "y": 388} 38 | }, 39 | { 40 | "resolution":"R480X854", 41 | "closeInterstitial":{ "x": 518, 42 | "y": 505} 43 | }, 44 | { 45 | "resolution":"R480X960", 46 | "closeInterstitial":{ "x": 518, 47 | "y": 505} 48 | }, 49 | { 50 | "resolution":"R256X320", 51 | "closeInterstitial":{ "x": 531, 52 | "y": 492} 53 | }, 54 | { 55 | "resolution":"R544X960", 56 | "closeInterstitial":{ "x": 543, 57 | "y": 480} 58 | }, 59 | { 60 | "resolution":"R600X1024", 61 | "closeInterstitial":{ "x": 565, 62 | "y": 460} 63 | }, 64 | { 65 | "resolution":"R768X1024", 66 | "closeInterstitial":{ "x": 627, 67 | "y": 396} 68 | }, 69 | { 70 | "resolution":"R800X1280", 71 | "closeInterstitial":{ "x": 640, 72 | "y": 385} 73 | }, 74 | { 75 | "resolution":"R800X1280", 76 | "closeInterstitial":{ "x": 640, 77 | "y": 385} 78 | } 79 | ], 80 | "supportResolution_2": [ 81 | { 82 | "resolution":"R720X1280", 83 | "closeInterstitial":{ "x": 102, 84 | "y": 370} 85 | }, 86 | { 87 | "resolution":"R540X960", 88 | "closeInterstitial":{ "x": 191, 89 | "y": 456} 90 | }, 91 | { 92 | "resolution":"R480X800", 93 | "closeInterstitial":{ "x": 222, 94 | "y": 467} 95 | }, 96 | { 97 | "resolution":"R320X480", 98 | "closeInterstitial":{ "x": 302, 99 | "y": 511} 100 | }, 101 | { 102 | "resolution":"R1080X1920", 103 | "closeInterstitial":{ "x": 43, 104 | "y": 195} 105 | }, 106 | { 107 | "resolution":"R1200X1920", 108 | "closeInterstitial":{ "x": 43, 109 | "y": 134} 110 | }, 111 | { 112 | "resolution":"R1280X800", 113 | "closeInterstitial":{ "x": 63, 114 | "y": 330} 115 | }, 116 | { 117 | "resolution":"R480X854", 118 | "closeInterstitial":{ "x": 222, 119 | "y": 468} 120 | }, 121 | { 122 | "resolution":"R480X960", 123 | "closeInterstitial":{ "x": 222, 124 | "y": 466} 125 | }, 126 | { 127 | "resolution":"R256X320", 128 | "closeInterstitial":{ "x": 335, 129 | "y": 540} 130 | }, 131 | { 132 | "resolution":"R544X960", 133 | "closeInterstitial":{ "x": 190, 134 | "y": 453} 135 | }, 136 | { 137 | "resolution":"R600X1024", 138 | "closeInterstitial":{ "x": 160, 139 | "y": 452} 140 | }, 141 | { 142 | "resolution":"R768X1024", 143 | "closeInterstitial":{ "x": 80, 144 | "y": 346} 145 | }, 146 | { 147 | "resolution":"R800X1280", 148 | "closeInterstitial":{ "x": 62, 149 | "y": 330} 150 | }, 151 | { 152 | "resolution":"R800X1280", 153 | "closeInterstitial":{ "x": 62, 154 | "y": 330} 155 | } 156 | ], 157 | "supportResolution_3": [ 158 | { 159 | "resolution":"R720X1280", 160 | "closeInterstitial":{ "x": 102, 161 | "y": 370} 162 | }, 163 | { 164 | "resolution":"R540X960", 165 | "closeInterstitial":{ "x": 191, 166 | "y": 456} 167 | }, 168 | { 169 | "resolution":"R480X800", 170 | "closeInterstitial":{ "x": 222, 171 | "y": 467} 172 | }, 173 | { 174 | "resolution":"R320X480", 175 | "closeInterstitial":{ "x": 302, 176 | "y": 511} 177 | }, 178 | { 179 | "resolution":"R1080X1920", 180 | "closeInterstitial":{ "x": 43, 181 | "y": 195} 182 | }, 183 | { 184 | "resolution":"R1200X1920", 185 | "closeInterstitial":{ "x": 43, 186 | "y": 134} 187 | }, 188 | { 189 | "resolution":"R1280X800", 190 | "closeInterstitial":{ "x": 63, 191 | "y": 330} 192 | }, 193 | { 194 | "resolution":"R480X854", 195 | "closeInterstitial":{ "x": 222, 196 | "y": 468} 197 | }, 198 | { 199 | "resolution":"R480X960", 200 | "closeInterstitial":{ "x": 222, 201 | "y": 466} 202 | }, 203 | { 204 | "resolution":"R256X320", 205 | "closeInterstitial":{ "x": 335, 206 | "y": 540} 207 | }, 208 | { 209 | "resolution":"R544X960", 210 | "closeInterstitial":{ "x": 190, 211 | "y": 453} 212 | }, 213 | { 214 | "resolution":"R600X1024", 215 | "closeInterstitial":{ "x": 160, 216 | "y": 452} 217 | }, 218 | { 219 | "resolution":"R768X1024", 220 | "closeInterstitial":{ "x": 80, 221 | "y": 346} 222 | }, 223 | { 224 | "resolution":"R800X1280", 225 | "closeInterstitial":{ "x": 62, 226 | "y": 330} 227 | }, 228 | { 229 | "resolution":"R800X1280", 230 | "closeInterstitial":{ "x": 62, 231 | "y": 330} 232 | } 233 | ] 234 | } -------------------------------------------------------------------------------- /inter/xsd.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------------- 2 | --------------------------------------------------------------------------------------------- 3 | xsd = {} 4 | ---------------------------------------------------------------------------- 5 | -- 取消安装 6 | local function AppProcessNotInstall() 7 | common.kyLog("AppProcessNotInstall--0") 8 | common.kyProcessException(); 9 | -- 下一步 10 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 11 | common.kyLog("AppProcessNotInstall--1"); 12 | common.kyProcessScreen(); -- 拉回竖屏 13 | repeat 14 | common.kyClick(170,1230); -- 点击取消 15 | common.kySleep(2); 16 | until(false == common.isNextStep()) 17 | end; 18 | -- 安装 19 | if(true == common.isInstallStep()) then-- 检测是否为安装 20 | common.kyLog("AppProcessNotInstall--2"); 21 | --common.kyProcessScreen(); -- 拉回竖屏 22 | repeat 23 | common.kyClick(170,1230); -- 点击取消 24 | common.kySleep(2); 25 | until(false == common.isInstallStep()) 26 | -- 在这里保存 27 | end; 28 | -- 打开 29 | if(true == common.isOpenStep()) then 30 | common.kyLog("AppProcessNotInstall--3"); 31 | --common.kyProcessScreen(); -- 拉回竖屏 32 | repeat 33 | common.kyProcessException(); 34 | common.kyClick(170,1230); -- 点击完成 35 | common.kySleep(2); 36 | until(false == common.isOpenStep()) 37 | end; 38 | common.kyProcessException(); 39 | common.kyLog("AppProcessNotInstall--5"); 40 | end; 41 | 42 | -- 正常处理安装 43 | local function AppProcessInstall() 44 | common.kyLog("AppProcessInstall--0"); 45 | common.kyProcessException(); 46 | -- 下一步 47 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 48 | common.kyProcessScreen(); -- 拉回竖屏 49 | repeat 50 | common.kyLog("AppProcessInstall--2"); 51 | -- 移动至安装 52 | for i=1,3 do -- 53 | common.kyMove(400,1084,400,500); 54 | end; 55 | common.kySleep(1); 56 | until(false == common.isNextStep() or true == common.isInstallStep()) 57 | end; 58 | -- 安装 59 | if(true == common.isInstallStep()) then-- 检测是否为安装 60 | repeat 61 | common.kyLog("AppProcessInstall--3"); 62 | common.ipCheck(); 63 | common.kyReportDeviceData(1); -- 在此处上报数据 64 | gDirtyAppCount = gDirtyAppCount + 1; 65 | common.kyClick(540, 1233); -- 点击安装 66 | common.kySleep(2); 67 | until(false == common.isInstallStep()) 68 | -- 在这里保存 69 | end; 70 | -- 打开 71 | if(true == common.isOpenStep()) then 72 | repeat 73 | common.kyLog("AppProcessInstall--4"); 74 | common.kyProcessException(); 75 | common.kyClick(170,1230); 76 | common.kySleep(2); 77 | until(false == common.isOpenStep()) 78 | end; 79 | common.kyProcessException(); 80 | common.kyLog("AppProcessInstall--6"); 81 | end; 82 | ---------------------------------------------------------------------------- 83 | ---------------------------------------- 84 | -- 马甲处理赚钱应用 85 | -- 0:出现了广告 1:没有出现广告 86 | local function AppProcessMoneyByMajia() 87 | common.kyLog("AppProcessMoneyByMajia--0"); 88 | common.kyProcessException(); 89 | common.ipCheck(); -- 进行IP检查 90 | common.kyOpenApp(gYourAppPackage); -- 启动应用 91 | common.kyHint(); 92 | local index = 0; 93 | common.kyToast("等待广告15秒...",60); 94 | local adState = false; 95 | local loopCount = 0; 96 | local openCount = 0; 97 | repeat 98 | common.kyLog("AppProcessMoneyByMajia--1"); 99 | common.kySleep(5); 100 | if(true == common.isPopInterstitial()) then 101 | adState = true; 102 | else 103 | if(loopCount == 3)then 104 | openCount = openCount + 1; 105 | common.kyCloseAndOpenApp(); -- 重新打开 106 | loopCount = 0; 107 | end; 108 | if(openCount > 2)then 109 | common.kyToast("很遗憾,没等到广告,退出!",5); 110 | common.kyLog("AppProcessMoneyByMajia--no ad"); 111 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 112 | return 1; 113 | end; 114 | loopCount = loopCount + 1; 115 | end; 116 | common.kyToast("广告等待中-"..openCount,5); 117 | until( true == adState) 118 | ------------------------------- 119 | common.kySleep(2); 120 | common.kyToast("发现广告"); 121 | common.kyReportDeviceData(0); -- 上报水军 122 | math.randomseed(getRndNum()) -- 随机种子初始化真随机数 123 | local index = math.random(1,10) 124 | common.kyLog("AppProcessMoneyByMajia--2"..index); 125 | if(index % 3 == 0)then 126 | common.ipCheck(); -- 进行IP检查 127 | common.kyToast("点击广告"); 128 | common.kyClick(330,895); -- 点击广告,就点一个。 129 | common.kySleep(2); 130 | else 131 | common.kyToast("马甲完成任务"); 132 | common.kyLog("AppProcessMoneyByMajia--3"); 133 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 134 | return 0; 135 | end; 136 | common.kySleep(1); 137 | index = math.random(1,10) 138 | common.kyLog("AppProcessMoneyByMajia--4"..index); 139 | if(index > 3)then 140 | common.kyToast("马甲完成任务"); 141 | common.kyLog("AppProcessMoneyByMajia--5"); 142 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 143 | return 0; 144 | else 145 | index = 40; 146 | repeat --只能死等 147 | common.kyLog("AppProcessMoneyByMajia--6"); 148 | common.kyToast("广告下载中,请耐心等待..."..index,10); 149 | common.kySleep(3); 150 | index = index - 1; 151 | if(index == 20)then 152 | common.kyLog("AppProcessMoneyByMajia--7"); 153 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 154 | end; 155 | if(index == 0)then -- 等待三分钟退出 156 | common.kyToast("2分钟已到,任务未完成,退出!",30); 157 | common.kyLog("AppProcessMoneyByMajia--8"); 158 | pg_net.netTaskFinished(0); --上报任务未完成 159 | common.kyLuaRestart(); 160 | end; 161 | until( true == common.isGotoInstallPackage()) 162 | common.kyLog("AppProcessMoneyByMajia--9"); 163 | AppProcessNotInstall() -- 取消安装 164 | end; 165 | common.kyToast("马甲完成任务"); 166 | common.kyLog("AppProcessMoneyByMajia--10"); 167 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 168 | return 0; -- 169 | end; 170 | -- 处理赚钱应用 171 | -- 0:点击了广告 1:没有点到广告 172 | local function AppProcessMoney() 173 | common.kyLog("AppProcessMoney--0"); 174 | common.ipCheck(); -- 进行IP检查 175 | common.kyOpenApp(gYourAppPackage); -- 启动应用 176 | common.kyHint(); 177 | local index = 0; 178 | common.kyToast("等待广告15秒...",3); 179 | local adState = false; 180 | local loopCount = 0; 181 | local openCount = 0; 182 | repeat 183 | common.kyLog("AppProcessMoney--1"); 184 | common.kySleep(5); 185 | if(true == common.isPopInterstitial()) then 186 | adState = true; 187 | else 188 | if(loopCount == 3)then 189 | openCount = openCount + 1; 190 | common.kyCloseAndOpenApp(); -- 重新打开 191 | loopCount = 0; 192 | end; 193 | if(openCount > 2)then 194 | common.kyToast("很遗憾,没等到广告,退出!",5); 195 | common.kyLog("AppProcessMoney--no ad"); 196 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 197 | return 1; 198 | end; 199 | loopCount = loopCount + 1; 200 | end; 201 | common.kyToast("广告等待中-"..openCount,5); 202 | until( true == adState) 203 | ------------------------------- 204 | if(adState == true)then 205 | common.ipCheck(); -- 进行IP检查 206 | end; 207 | common.kyToast("点击广告"); 208 | common.kyClick(330,895); -- 点击广告,就点一个。 209 | common.kySleep(2); 210 | -------------------------------- 211 | common.kyLog("AppProcessMoney--2"); 212 | local index = 40; 213 | repeat --只能死等 214 | common.kyLog("AppProcessMoney--4"); 215 | common.kyToast("广告下载中,请耐心等待..."..index,10); 216 | common.kySleep(3); 217 | index = index - 1; 218 | if(index == 20)then 219 | common.kyLog("AppProcessMoney--5"); 220 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 221 | end; 222 | if(index == 0)then -- 等待三分钟退出 223 | common.kyToast("2分钟已到,任务未完成,退出!",30); 224 | common.kyReportDeviceData(0); -- 上报水军 225 | pg_net.netTaskFinished(0); --上报任务未完成 226 | common.kyLuaRestart(); 227 | common.kyLog("AppProcessMoney--6"); 228 | end; 229 | until( true == common.isGotoInstallPackage()) 230 | common.kyLog("AppProcessMoney--7"); 231 | return 0; 232 | end; 233 | 234 | -- 马甲入口函数 235 | local function AppRunMajia() 236 | common.kyDataInit(); 237 | common.kyInitLog(); 238 | common.kyLog("AppRunMajia--0"); 239 | common.kyProcessException();-- 处理各种异常 240 | common.initMobile(); 241 | local flag = 1; 242 | --[[ 243 | repeat -- 循环消灭之前的安装 244 | AppProcessNotInstall() 245 | until(true ~= common.isGotoInstallPackage()) 246 | --]] 247 | flag = AppProcessMoneyByMajia(); 248 | common.exitMobile(); 249 | common.kyLog("AppRunMajia--5"); 250 | return flag; 251 | end; 252 | 253 | -- 赚钱入口函数 254 | -- 0: 任务完成 1: 任务未完成 255 | local function AppRunActive() 256 | common.kyDataInit(); 257 | common.kyInitLog(); 258 | common.kyLog("AppRunActive--0"); 259 | common.kyProcessException();-- 处理各种异常 260 | common.initMobile(); 261 | local flag = 0; 262 | repeat 263 | common.kyToast("正式执行任务"); 264 | if( true == common.isGotoInstallPackage()) then 265 | common.kyLog("AppRunActive--2"); 266 | repeat -- 循环安装 267 | common.kyLog("AppRunActive--3"); 268 | common.kySleep(1); 269 | AppProcessInstall(); 270 | common.kySleep(1); 271 | common.kyProcessException(); 272 | common.kyCloseDirtyApp(); 273 | until(gDirtyAppCount > 0 or true ~= common.isGotoInstallPackage()) 274 | common.kyLog("AppRunActive--4"); 275 | else 276 | common.kyLog("AppRunActive--6"); 277 | flag = AppProcessMoney(); 278 | end; 279 | common.kyLog("AppRunActive--7"); 280 | common.kyProcessException(); 281 | until(gDirtyAppCount > 0 or flag == 1) -- 没有等到广告也退出 282 | common.exitMobile(); 283 | common.kyLog("AppRunActive--13"); 284 | if(gDirtyAppCount > 0)then 285 | return 0; 286 | else 287 | return 1; 288 | end; 289 | end; 290 | 291 | function xsd.runMyApp(isShuijun) 292 | local flag = 0; 293 | if(isShuijun == 0)then 294 | flag = AppRunActive(); 295 | else 296 | flag = AppRunMajia(); 297 | end; 298 | return flag; 299 | end; 300 | return xsd; 301 | -------------------------------------------------------------------------------- /inter/juyou.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------------- 2 | --------------------------------------------------------------------------------------------- 3 | juyou = {} 4 | ---------------------------------------------------------------------------- 5 | -- 取消安装 6 | local function AppProcessNotInstall() 7 | common.kyLog("AppProcessNotInstall--0") 8 | common.kyProcessException(); 9 | -- 下一步 10 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 11 | common.kyLog("AppProcessNotInstall--1"); 12 | common.kyProcessScreen(); -- 拉回竖屏 13 | repeat 14 | common.kyClick(170,1230); -- 点击取消 15 | common.kySleep(2); 16 | until(false == common.isNextStep()) 17 | end; 18 | -- 安装 19 | if(true == common.isInstallStep()) then-- 检测是否为安装 20 | common.kyLog("AppProcessNotInstall--2"); 21 | --common.kyProcessScreen(); -- 拉回竖屏 22 | repeat 23 | common.kyClick(170,1230); -- 点击取消 24 | common.kySleep(2); 25 | until(false == common.isInstallStep()) 26 | -- 在这里保存 27 | end; 28 | -- 打开 29 | if(true == common.isOpenStep()) then 30 | common.kyLog("AppProcessNotInstall--3"); 31 | --common.kyProcessScreen(); -- 拉回竖屏 32 | repeat 33 | common.kyProcessException(); 34 | common.kyClick(170,1230); -- 点击完成 35 | common.kySleep(2); 36 | until(false == common.isOpenStep()) 37 | end; 38 | common.kyProcessException(); 39 | common.kyLog("AppProcessNotInstall--5"); 40 | end; 41 | 42 | -- 正常处理安装 43 | local function AppProcessInstall() 44 | common.kyLog("AppProcessInstall--0"); 45 | common.kyProcessException(); 46 | -- 下一步 47 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 48 | --common.kyProcessScreen(); -- 拉回竖屏 49 | repeat 50 | common.kyLog("AppProcessInstall--2"); 51 | -- 移动至安装 52 | for i=1,3 do -- 53 | common.kyMove(400,1084,400,500); 54 | end; 55 | common.kySleep(1); 56 | until(false == common.isNextStep() or true == common.isInstallStep()) 57 | end; 58 | -- 安装 59 | if(true == common.isInstallStep()) then-- 检测是否为安装 60 | repeat 61 | common.kyLog("AppProcessInstall--3"); 62 | common.ipCheck(); 63 | common.kyReportDeviceData(1); -- 在此处上报数据 64 | gDirtyAppCount = gDirtyAppCount + 1; 65 | common.kyClick(540, 1233); -- 点击安装 66 | common.kySleep(2); 67 | until(false == common.isInstallStep()) 68 | -- 在这里保存 69 | end; 70 | -- 打开 71 | if(true == common.isOpenStep()) then 72 | repeat 73 | common.kyLog("AppProcessInstall--4"); 74 | common.kyProcessException(); 75 | common.kyClick(170,1230); 76 | common.kySleep(2); 77 | until(false == common.isOpenStep()) 78 | end; 79 | common.kyProcessException(); 80 | common.kyLog("AppProcessInstall--6"); 81 | end; 82 | ---------------------------------------------------------------------------- 83 | ---------------------------------------- 84 | -- 马甲处理赚钱应用 85 | -- 0:出现了广告 1:没有出现广告 86 | local function AppProcessMoneyByMajia() 87 | common.kyLog("AppProcessMoneyByMajia--0"); 88 | common.kyProcessException(); 89 | common.ipCheck(); -- 进行IP检查 90 | common.kyOpenApp(gYourAppPackage); -- 启动应用 91 | common.kyHint(); 92 | local index = 0; 93 | common.kyToast("等待广告15秒...",60); 94 | local adState = false; 95 | local loopCount = 0; 96 | local openCount = 0; 97 | repeat 98 | common.kyLog("AppProcessMoneyByMajia--1"); 99 | common.kySleep(5); 100 | if(true == common.isPopInterstitial()) then 101 | adState = true; 102 | else 103 | if(loopCount == 3)then 104 | openCount = openCount + 1; 105 | common.kyCloseAndOpenApp(); -- 重新打开 106 | loopCount = 0; 107 | end; 108 | if(openCount > 2)then 109 | common.kyToast("很遗憾,没等到广告,退出!",5); 110 | common.kyLog("AppProcessMoneyByMajia--no ad"); 111 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 112 | return 1; 113 | end; 114 | loopCount = loopCount + 1; 115 | end; 116 | common.kyToast("广告等待中-"..openCount,5); 117 | until( true == adState) 118 | ------------------------------- 119 | common.kySleep(2); 120 | common.kyToast("发现广告"); 121 | common.kyReportDeviceData(0); -- 上报水军 122 | math.randomseed(getRndNum()) -- 随机种子初始化真随机数 123 | local index = math.random(1,10) 124 | common.kyLog("AppProcessMoneyByMajia--2"..index); 125 | if(index % 3 == 0)then 126 | common.ipCheck(); -- 进行IP检查 127 | common.kyToast("点击广告"); 128 | common.kyClick(330,895); -- 点击广告,就点一个。 129 | common.kySleep(2); 130 | else 131 | common.kyToast("马甲完成任务"); 132 | common.kyLog("AppProcessMoneyByMajia--3"); 133 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 134 | return 0; 135 | end; 136 | common.kySleep(1); 137 | index = math.random(1,10) 138 | common.kyLog("AppProcessMoneyByMajia--4"..index); 139 | if(index > 3)then 140 | common.kyToast("马甲完成任务"); 141 | common.kyLog("AppProcessMoneyByMajia--5"); 142 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 143 | return 0; 144 | else 145 | index = 40; 146 | repeat --只能死等 147 | common.kyLog("AppProcessMoneyByMajia--6"); 148 | common.kyToast("广告下载中,请耐心等待..."..index,10); 149 | common.kySleep(3); 150 | index = index - 1; 151 | if(index == 20)then 152 | common.kyLog("AppProcessMoneyByMajia--7"); 153 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 154 | end; 155 | if(index == 0)then -- 等待三分钟退出 156 | common.kyToast("2分钟已到,任务未完成,退出!",30); 157 | common.kyLog("AppProcessMoneyByMajia--8"); 158 | pg_net.netTaskFinished(0); --上报任务未完成 159 | common.kyLuaRestart(); 160 | end; 161 | until( true == common.isGotoInstallPackage()) 162 | common.kyLog("AppProcessMoneyByMajia--9"); 163 | AppProcessNotInstall() -- 取消安装 164 | end; 165 | common.kyToast("马甲完成任务"); 166 | common.kyLog("AppProcessMoneyByMajia--10"); 167 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 168 | return 0; -- 169 | end; 170 | -- 处理赚钱应用 171 | -- 0:点击了广告 1:没有点到广告 172 | local function AppProcessMoney() 173 | common.kyLog("AppProcessMoney--0"); 174 | common.ipCheck(); -- 进行IP检查 175 | common.kyOpenApp(gYourAppPackage); -- 启动应用 176 | common.kyHint(); 177 | local index = 0; 178 | common.kyToast("等待广告15秒...",3); 179 | local adState = false; 180 | local loopCount = 0; 181 | local openCount = 0; 182 | repeat 183 | common.kyLog("AppProcessMoney--1"); 184 | common.kySleep(5); 185 | if(true == common.isPopInterstitial()) then 186 | adState = true; 187 | else 188 | if(loopCount == 3)then 189 | openCount = openCount + 1; 190 | common.kyCloseAndOpenApp(); -- 重新打开 191 | loopCount = 0; 192 | end; 193 | if(openCount > 2)then 194 | common.kyToast("很遗憾,没等到广告,退出!",5); 195 | common.kyLog("AppProcessMoney--no ad"); 196 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 197 | return 1; 198 | end; 199 | loopCount = loopCount + 1; 200 | end; 201 | common.kyToast("广告等待中-"..openCount,5); 202 | until( true == adState) 203 | ------------------------------- 204 | if(adState == true)then 205 | common.ipCheck(); -- 进行IP检查 206 | end; 207 | common.kyToast("点击广告"); 208 | common.kyClick(330,895); -- 点击广告,就点一个。 209 | common.kySleep(2); 210 | -------------------------------- 211 | common.kyLog("AppProcessMoney--2"); 212 | local index = 40; 213 | repeat --只能死等 214 | common.kyLog("AppProcessMoney--4"); 215 | common.kyToast("广告下载中,请耐心等待..."..index,10); 216 | common.kySleep(3); 217 | index = index - 1; 218 | if(index == 20)then 219 | common.kyLog("AppProcessMoney--5"); 220 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 221 | end; 222 | if(index == 0)then -- 等待三分钟退出 223 | common.kyToast("2分钟已到,任务未完成,退出!",30); 224 | common.kyReportDeviceData(0); -- 上报水军 225 | pg_net.netTaskFinished(0); --上报任务未完成 226 | common.kyLuaRestart(); 227 | common.kyLog("AppProcessMoney--6"); 228 | end; 229 | until( true == common.isGotoInstallPackage()) 230 | common.kyLog("AppProcessMoney--7"); 231 | return 0; 232 | end; 233 | 234 | -- 马甲入口函数 235 | local function AppRunMajia() 236 | common.kyDataInit(); 237 | common.kyInitLog(); 238 | common.kyLog("AppRunMajia--0"); 239 | common.kyProcessException();-- 处理各种异常 240 | common.initMobile(); 241 | local flag = 1; 242 | --[[ 243 | repeat -- 循环消灭之前的安装 244 | AppProcessNotInstall() 245 | until(true ~= common.isGotoInstallPackage()) 246 | --]] 247 | flag = AppProcessMoneyByMajia(); 248 | common.exitMobile(); 249 | common.kyLog("AppRunMajia--5"); 250 | return flag; 251 | end; 252 | 253 | -- 赚钱入口函数 254 | -- 0: 任务完成 1: 任务未完成 255 | local function AppRunActive() 256 | common.kyDataInit(); 257 | common.kyInitLog(); 258 | common.kyLog("AppRunActive--0"); 259 | common.kyProcessException();-- 处理各种异常 260 | common.initMobile(); 261 | local flag = 0; 262 | repeat 263 | common.kyToast("正式执行任务"); 264 | if( true == common.isGotoInstallPackage()) then 265 | common.kyLog("AppRunActive--2"); 266 | repeat -- 循环安装 267 | common.kyLog("AppRunActive--3"); 268 | common.kySleep(1); 269 | AppProcessInstall(); 270 | common.kySleep(1); 271 | common.kyProcessException(); 272 | common.kyCloseDirtyApp(); 273 | until(gDirtyAppCount > 0 or true ~= common.isGotoInstallPackage()) 274 | common.kyLog("AppRunActive--4"); 275 | else 276 | common.kyLog("AppRunActive--6"); 277 | flag = AppProcessMoney(); 278 | end; 279 | common.kyLog("AppRunActive--7"); 280 | common.kyProcessException(); 281 | until(gDirtyAppCount > 0 or flag == 1) -- 没有等到广告也退出 282 | common.exitMobile(); 283 | common.kyLog("AppRunActive--13"); 284 | if(gDirtyAppCount > 0)then 285 | return 0; 286 | else 287 | return 1; 288 | end; 289 | end; 290 | 291 | function juyou.runMyApp(isShuijun) 292 | local flag = 0; 293 | if(isShuijun == 0)then 294 | flag = AppRunActive(); 295 | else 296 | flag = AppRunMajia(); 297 | end; 298 | return flag; 299 | end; 300 | return juyou; 301 | -------------------------------------------------------------------------------- /inter/yichu.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------------- 2 | --------------------------------------------------------------------------------------------- 3 | yichu = {} 4 | ---------------------------------------------------------------------------- 5 | -- 取消安装 6 | local function AppProcessNotInstall() 7 | common.kyLog("AppProcessNotInstall--0") 8 | common.kyProcessException(); 9 | -- 下一步 10 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 11 | common.kyLog("AppProcessNotInstall--1"); 12 | common.kyProcessScreen(); -- 拉回竖屏 13 | repeat 14 | common.kyClick(170,1230); -- 点击取消 15 | common.kySleep(2); 16 | until(false == common.isNextStep()) 17 | end; 18 | -- 安装 19 | if(true == common.isInstallStep()) then-- 检测是否为安装 20 | common.kyLog("AppProcessNotInstall--2"); 21 | --common.kyProcessScreen(); -- 拉回竖屏 22 | repeat 23 | common.kyClick(170,1230); -- 点击取消 24 | common.kySleep(2); 25 | until(false == common.isInstallStep()) 26 | -- 在这里保存 27 | end; 28 | -- 打开 29 | if(true == common.isOpenStep()) then 30 | common.kyLog("AppProcessNotInstall--3"); 31 | --common.kyProcessScreen(); -- 拉回竖屏 32 | repeat 33 | common.kyProcessException(); 34 | common.kyClick(170,1230); -- 点击完成 35 | common.kySleep(2); 36 | until(false == common.isOpenStep()) 37 | end; 38 | common.kyProcessException(); 39 | common.kyLog("AppProcessNotInstall--5"); 40 | end; 41 | 42 | -- 正常处理安装 43 | local function AppProcessInstall() 44 | common.kyLog("AppProcessInstall--0"); 45 | common.kyProcessException(); 46 | -- 下一步 47 | if(true == common.isNextStep()) then-- 检测是否为下一步安装 48 | --common.kyProcessScreen(); -- 拉回竖屏 49 | repeat 50 | common.kyLog("AppProcessInstall--2"); 51 | -- 移动至安装 52 | for i=1,3 do -- 53 | common.kyMove(400,1084,400,500); 54 | end; 55 | common.kySleep(1); 56 | until(false == common.isNextStep() or true == common.isInstallStep()) 57 | end; 58 | -- 安装 59 | if(true == common.isInstallStep()) then-- 检测是否为安装 60 | repeat 61 | common.kyLog("AppProcessInstall--3"); 62 | common.ipCheck(); 63 | common.kyReportDeviceData(1); -- 在此处上报数据 64 | gDirtyAppCount = gDirtyAppCount + 1; 65 | common.kyClick(540, 1233); -- 点击安装 66 | common.kySleep(2); 67 | until(false == common.isInstallStep()) 68 | -- 在这里保存 69 | end; 70 | -- 打开 71 | if(true == common.isOpenStep()) then 72 | repeat 73 | common.kyLog("AppProcessInstall--4"); 74 | common.kyProcessException(); 75 | common.kyClick(170,1230); 76 | common.kySleep(2); 77 | until(false == common.isOpenStep()) 78 | end; 79 | common.kyProcessException(); 80 | common.kyLog("AppProcessInstall--6"); 81 | end; 82 | ---------------------------------------------------------------------------- 83 | ---------------------------------------- 84 | -- 马甲处理赚钱应用 85 | -- 0:出现了广告 1:没有出现广告 86 | local function AppProcessMoneyByMajia() 87 | common.kyLog("AppProcessMoneyByMajia--0"); 88 | common.kyProcessException(); 89 | common.ipCheck(); -- 进行IP检查 90 | common.kyOpenApp(gYourAppPackage); -- 启动应用 91 | common.kyHint(); 92 | local index = 0; 93 | common.kyToast("等待广告15秒...",60); 94 | local adState = false; 95 | local loopCount = 0; 96 | local openCount = 0; 97 | repeat 98 | common.kyLog("AppProcessMoneyByMajia--1"); 99 | common.kySleep(5); 100 | if(true == common.isPopInterstitial()) then 101 | adState = true; 102 | else 103 | if(loopCount == 3)then 104 | openCount = openCount + 1; 105 | common.kyCloseAndOpenApp(); -- 重新打开 106 | loopCount = 0; 107 | end; 108 | if(openCount > 2)then 109 | common.kyToast("很遗憾,没等到广告,退出!",5); 110 | common.kyLog("AppProcessMoneyByMajia--no ad"); 111 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 112 | return 1; 113 | end; 114 | loopCount = loopCount + 1; 115 | end; 116 | common.kyToast("广告等待中-"..openCount,5); 117 | until( true == adState) 118 | ------------------------------- 119 | common.kySleep(2); 120 | common.kyToast("发现广告"); 121 | common.kyReportDeviceData(0); -- 上报水军 122 | math.randomseed(getRndNum()) -- 随机种子初始化真随机数 123 | local index = math.random(1,10) 124 | common.kyLog("AppProcessMoneyByMajia--2"..index); 125 | if(index % 3 == 0)then 126 | common.ipCheck(); -- 进行IP检查 127 | common.kyToast("点击广告"); 128 | common.kyClick(330,895); -- 点击广告,就点一个。 129 | common.kySleep(2); 130 | else 131 | common.kyToast("马甲完成任务"); 132 | common.kyLog("AppProcessMoneyByMajia--3"); 133 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 134 | return 0; 135 | end; 136 | common.kySleep(1); 137 | index = math.random(1,10) 138 | common.kyLog("AppProcessMoneyByMajia--4"..index); 139 | if(index > 3)then 140 | common.kyToast("马甲完成任务"); 141 | common.kyLog("AppProcessMoneyByMajia--5"); 142 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 143 | return 0; 144 | else 145 | index = 40; 146 | repeat --只能死等 147 | common.kyLog("AppProcessMoneyByMajia--6"); 148 | common.kyToast("广告下载中,请耐心等待..."..index,10); 149 | common.kySleep(3); 150 | index = index - 1; 151 | if(index == 20)then 152 | common.kyLog("AppProcessMoneyByMajia--7"); 153 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 154 | end; 155 | if(index == 0)then -- 等待三分钟退出 156 | common.kyToast("2分钟已到,任务未完成,退出!",30); 157 | common.kyLog("AppProcessMoneyByMajia--8"); 158 | pg_net.netTaskFinished(0); --上报任务未完成 159 | common.kyLuaRestart(); 160 | end; 161 | until( true == common.isGotoInstallPackage()) 162 | common.kyLog("AppProcessMoneyByMajia--9"); 163 | AppProcessNotInstall() -- 取消安装 164 | end; 165 | common.kyToast("马甲完成任务"); 166 | common.kyLog("AppProcessMoneyByMajia--10"); 167 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 168 | return 0; -- 169 | end; 170 | -- 处理赚钱应用 171 | -- 0:点击了广告 1:没有点到广告 172 | local function AppProcessMoney() 173 | common.kyLog("AppProcessMoney--0"); 174 | common.ipCheck(); -- 进行IP检查 175 | common.kyOpenApp(gYourAppPackage); -- 启动应用 176 | common.kyHint(); 177 | local index = 0; 178 | common.kyToast("等待广告15秒...",3); 179 | local adState = false; 180 | local loopCount = 0; 181 | local openCount = 0; 182 | repeat 183 | common.kyLog("AppProcessMoney--1"); 184 | common.kySleep(5); 185 | if(true == common.isPopInterstitial()) then 186 | adState = true; 187 | else 188 | if(loopCount == 3)then 189 | openCount = openCount + 1; 190 | common.kyCloseAndOpenApp(); -- 重新打开 191 | loopCount = 0; 192 | end; 193 | if(openCount > 2)then 194 | common.kyToast("很遗憾,没等到广告,退出!",5); 195 | common.kyLog("AppProcessMoney--no ad"); 196 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 197 | return 1; 198 | end; 199 | loopCount = loopCount + 1; 200 | end; 201 | common.kyToast("广告等待中-"..openCount,5); 202 | until( true == adState) 203 | ------------------------------- 204 | if(adState == true)then 205 | common.ipCheck(); -- 进行IP检查 206 | end; 207 | common.kyToast("点击广告"); 208 | common.kyClick(330,895); -- 点击广告,就点一个。 209 | common.kySleep(2); 210 | -------------------------------- 211 | common.kyLog("AppProcessMoney--2"); 212 | local index = 40; 213 | repeat --只能死等 214 | common.kyLog("AppProcessMoney--4"); 215 | common.kyToast("广告下载中,请耐心等待..."..index,10); 216 | common.kySleep(3); 217 | index = index - 1; 218 | if(index == 20)then 219 | common.kyLog("AppProcessMoney--5"); 220 | common.kyToast("1分钟了,网速太慢,建议切换VPN",30); 221 | end; 222 | if(index == 0)then -- 等待三分钟退出 223 | common.kyToast("2分钟已到,任务未完成,退出!",30); 224 | common.kyReportDeviceData(0); -- 上报水军 225 | pg_net.netTaskFinished(0); --上报任务未完成 226 | common.kyLuaRestart(); 227 | common.kyLog("AppProcessMoney--6"); 228 | end; 229 | until( true == common.isGotoInstallPackage()) 230 | common.kyLog("AppProcessMoney--7"); 231 | return 0; 232 | end; 233 | 234 | -- 马甲入口函数 235 | local function AppRunMajia() 236 | common.kyDataInit(); 237 | common.kyInitLog(); 238 | common.kyLog("AppRunMajia--0"); 239 | common.kyProcessException();-- 处理各种异常 240 | common.initMobile(); 241 | local flag = 1; 242 | --[[ 243 | repeat -- 循环消灭之前的安装 244 | AppProcessNotInstall() 245 | until(true ~= common.isGotoInstallPackage()) 246 | --]] 247 | flag = AppProcessMoneyByMajia(); 248 | common.exitMobile(); 249 | common.kyLog("AppRunMajia--5"); 250 | return flag; 251 | end; 252 | 253 | -- 赚钱入口函数 254 | -- 0: 任务完成 1: 任务未完成 255 | local function AppRunActive() 256 | common.kyDataInit(); 257 | common.kyInitLog(); 258 | common.kyLog("AppRunActive--0"); 259 | common.kyProcessException();-- 处理各种异常 260 | common.initMobile(); 261 | local flag = 0; 262 | repeat 263 | common.kyToast("正式执行任务"); 264 | if( true == common.isGotoInstallPackage()) then 265 | common.kyLog("AppRunActive--2"); 266 | repeat -- 循环安装 267 | common.kyLog("AppRunActive--3"); 268 | common.kySleep(1); 269 | AppProcessInstall(); 270 | common.kySleep(1); 271 | common.kyProcessException(); 272 | common.kyCloseDirtyApp(); 273 | until(gDirtyAppCount > 0 or true ~= common.isGotoInstallPackage()) 274 | common.kyLog("AppRunActive--4"); 275 | else 276 | common.kyLog("AppRunActive--6"); 277 | flag = AppProcessMoney(); 278 | end; 279 | common.kyLog("AppRunActive--7"); 280 | common.kyProcessException(); 281 | until(gDirtyAppCount > 0 or flag == 1) -- 没有等到广告也退出 282 | common.exitMobile(); 283 | common.kyLog("AppRunActive--13"); 284 | if(gDirtyAppCount > 0)then 285 | return 0; 286 | else 287 | return 1; 288 | end; 289 | end; 290 | 291 | function yichu.runMyApp(isShuijun) 292 | local flag = 0; 293 | if(isShuijun == 0)then 294 | flag = AppRunActive(); 295 | else 296 | flag = AppRunMajia(); 297 | end; 298 | return flag; 299 | end; 300 | return yichu; 301 | -------------------------------------------------------------------------------- /inter/json.lua: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- JSON4Lua: JSON encoding / decoding support for the Lua language. 3 | -- json Module. 4 | -- Author: Craig Mason-Jones 5 | -- Homepage: http://github.com/craigmj/json4lua/ 6 | -- Version: 1.0.0 7 | -- This module is released under the MIT License (MIT). 8 | -- Please see LICENCE.txt for details. 9 | -- 10 | -- USAGE: 11 | -- This module exposes two functions: 12 | -- json.encode(o) 13 | -- Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string. 14 | -- json.decode(json_string) 15 | -- Returns a Lua object populated with the data encoded in the JSON string json_string. 16 | -- 17 | -- REQUIREMENTS: 18 | -- compat-5.1 if using Lua 5.0 19 | -- 20 | -- CHANGELOG 21 | -- 0.9.20 Introduction of local Lua functions for private functions (removed _ function prefix). 22 | -- Fixed Lua 5.1 compatibility issues. 23 | -- Introduced json.null to have null values in associative arrays. 24 | -- json.encode() performance improvement (more than 50%) through table.concat rather than .. 25 | -- Introduced decode ability to ignore /**/ comments in the JSON string. 26 | -- 0.9.10 Fix to array encoding / decoding to correctly manage nil/null values in arrays. 27 | ----------------------------------------------------------------------------- 28 | 29 | ----------------------------------------------------------------------------- 30 | -- Imports and dependencies 31 | ----------------------------------------------------------------------------- 32 | local math = require('math') 33 | local string = require("string") 34 | local table = require("table") 35 | 36 | ----------------------------------------------------------------------------- 37 | -- Module declaration 38 | ----------------------------------------------------------------------------- 39 | local json = {} -- Public namespace 40 | local json_private = {} -- Private namespace 41 | 42 | -- Public constants 43 | json.EMPTY_ARRAY={} 44 | json.EMPTY_OBJECT={} 45 | 46 | -- Public functions 47 | 48 | -- Private functions 49 | local decode_scanArray 50 | local decode_scanComment 51 | local decode_scanConstant 52 | local decode_scanNumber 53 | local decode_scanObject 54 | local decode_scanString 55 | local decode_scanWhitespace 56 | local encodeString 57 | local isArray 58 | local isEncodable 59 | 60 | ----------------------------------------------------------------------------- 61 | -- PUBLIC FUNCTIONS 62 | ----------------------------------------------------------------------------- 63 | --- Encodes an arbitrary Lua object / variable. 64 | -- @param v The Lua object / variable to be JSON encoded. 65 | -- @return String containing the JSON encoding in internal Lua string format (i.e. not unicode) 66 | function json.encode (v) 67 | -- Handle nil values 68 | if v==nil then 69 | return "null" 70 | end 71 | 72 | local vtype = type(v) 73 | 74 | -- Handle strings 75 | if vtype=='string' then 76 | return '"' .. json_private.encodeString(v) .. '"' -- Need to handle encoding in string 77 | end 78 | 79 | -- Handle booleans 80 | if vtype=='number' or vtype=='boolean' then 81 | return tostring(v) 82 | end 83 | 84 | -- Handle tables 85 | if vtype=='table' then 86 | local rval = {} 87 | -- Consider arrays separately 88 | local bArray, maxCount = isArray(v) 89 | if bArray then 90 | for i = 1,maxCount do 91 | table.insert(rval, json.encode(v[i])) 92 | end 93 | else -- An object, not an array 94 | for i,j in pairs(v) do 95 | if isEncodable(i) and isEncodable(j) then 96 | table.insert(rval, '"' .. json_private.encodeString(i) .. '":' .. json.encode(j)) 97 | end 98 | end 99 | end 100 | if bArray then 101 | return '[' .. table.concat(rval,',') ..']' 102 | else 103 | return '{' .. table.concat(rval,',') .. '}' 104 | end 105 | end 106 | 107 | -- Handle null values 108 | if vtype=='function' and v==json.null then 109 | return 'null' 110 | end 111 | 112 | assert(false,'encode attempt to encode unsupported type ' .. vtype .. ':' .. tostring(v)) 113 | end 114 | 115 | 116 | --- Decodes a JSON string and returns the decoded value as a Lua data structure / value. 117 | -- @param s The string to scan. 118 | -- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1. 119 | -- @param Lua object, number The object that was scanned, as a Lua table / string / number / boolean or nil, 120 | -- and the position of the first character after 121 | -- the scanned JSON object. 122 | function json.decode(s, startPos) 123 | startPos = startPos and startPos or 1 124 | startPos = decode_scanWhitespace(s,startPos) 125 | assert(startPos<=string.len(s), 'Unterminated JSON encoded object found at position in [' .. s .. ']') 126 | local curChar = string.sub(s,startPos,startPos) 127 | -- Object 128 | if curChar=='{' then 129 | return decode_scanObject(s,startPos) 130 | end 131 | -- Array 132 | if curChar=='[' then 133 | return decode_scanArray(s,startPos) 134 | end 135 | -- Number 136 | if string.find("+-0123456789.e", curChar, 1, true) then 137 | return decode_scanNumber(s,startPos) 138 | end 139 | -- String 140 | if curChar==[["]] or curChar==[[']] then 141 | return decode_scanString(s,startPos) 142 | end 143 | if string.sub(s,startPos,startPos+1)=='/*' then 144 | return json.decode(s, decode_scanComment(s,startPos)) 145 | end 146 | -- Otherwise, it must be a constant 147 | return decode_scanConstant(s,startPos) 148 | end 149 | 150 | --- The null function allows one to specify a null value in an associative array (which is otherwise 151 | -- discarded if you set the value with 'nil' in Lua. Simply set t = { first=json.null } 152 | function json.null() 153 | return json.null -- so json.null() will also return null ;-) 154 | end 155 | ----------------------------------------------------------------------------- 156 | -- Internal, PRIVATE functions. 157 | -- Following a Python-like convention, I have prefixed all these 'PRIVATE' 158 | -- functions with an underscore. 159 | ----------------------------------------------------------------------------- 160 | 161 | --- Scans an array from JSON into a Lua object 162 | -- startPos begins at the start of the array. 163 | -- Returns the array and the next starting position 164 | -- @param s The string being scanned. 165 | -- @param startPos The starting position for the scan. 166 | -- @return table, int The scanned array as a table, and the position of the next character to scan. 167 | function decode_scanArray(s,startPos) 168 | local array = {} -- The return value 169 | local stringLen = string.len(s) 170 | assert(string.sub(s,startPos,startPos)=='[','decode_scanArray called but array does not start at position ' .. startPos .. ' in string:\n'..s ) 171 | startPos = startPos + 1 172 | -- Infinite loop for array elements 173 | repeat 174 | startPos = decode_scanWhitespace(s,startPos) 175 | assert(startPos<=stringLen,'JSON String ended unexpectedly scanning array.') 176 | local curChar = string.sub(s,startPos,startPos) 177 | if (curChar==']') then 178 | return array, startPos+1 179 | end 180 | if (curChar==',') then 181 | startPos = decode_scanWhitespace(s,startPos+1) 182 | end 183 | assert(startPos<=stringLen, 'JSON String ended unexpectedly scanning array.') 184 | object, startPos = json.decode(s,startPos) 185 | table.insert(array,object) 186 | until false 187 | end 188 | 189 | --- Scans a comment and discards the comment. 190 | -- Returns the position of the next character following the comment. 191 | -- @param string s The JSON string to scan. 192 | -- @param int startPos The starting position of the comment 193 | function decode_scanComment(s, startPos) 194 | assert( string.sub(s,startPos,startPos+1)=='/*', "decode_scanComment called but comment does not start at position " .. startPos) 195 | local endPos = string.find(s,'*/',startPos+2) 196 | assert(endPos~=nil, "Unterminated comment in string at " .. startPos) 197 | return endPos+2 198 | end 199 | 200 | --- Scans for given constants: true, false or null 201 | -- Returns the appropriate Lua type, and the position of the next character to read. 202 | -- @param s The string being scanned. 203 | -- @param startPos The position in the string at which to start scanning. 204 | -- @return object, int The object (true, false or nil) and the position at which the next character should be 205 | -- scanned. 206 | function decode_scanConstant(s, startPos) 207 | local consts = { ["true"] = true, ["false"] = false, ["null"] = nil } 208 | local constNames = {"true","false","null"} 209 | 210 | for i,k in pairs(constNames) do 211 | if string.sub(s,startPos, startPos + string.len(k) -1 )==k then 212 | return consts[k], startPos + string.len(k) 213 | end 214 | end 215 | assert(nil, 'Failed to scan constant from string ' .. s .. ' at starting position ' .. startPos) 216 | end 217 | 218 | --- Scans a number from the JSON encoded string. 219 | -- (in fact, also is able to scan numeric +- eqns, which is not 220 | -- in the JSON spec.) 221 | -- Returns the number, and the position of the next character 222 | -- after the number. 223 | -- @param s The string being scanned. 224 | -- @param startPos The position at which to start scanning. 225 | -- @return number, int The extracted number and the position of the next character to scan. 226 | function decode_scanNumber(s,startPos) 227 | local endPos = startPos+1 228 | local stringLen = string.len(s) 229 | local acceptableChars = "+-0123456789.e" 230 | while (string.find(acceptableChars, string.sub(s,endPos,endPos), 1, true) 231 | and endPos<=stringLen 232 | ) do 233 | endPos = endPos + 1 234 | end 235 | local stringValue = 'return ' .. string.sub(s,startPos, endPos-1) 236 | local stringEval = loadstring(stringValue) 237 | assert(stringEval, 'Failed to scan number [ ' .. stringValue .. '] in JSON string at position ' .. startPos .. ' : ' .. endPos) 238 | return stringEval(), endPos 239 | end 240 | 241 | --- Scans a JSON object into a Lua object. 242 | -- startPos begins at the start of the object. 243 | -- Returns the object and the next starting position. 244 | -- @param s The string being scanned. 245 | -- @param startPos The starting position of the scan. 246 | -- @return table, int The scanned object as a table and the position of the next character to scan. 247 | function decode_scanObject(s,startPos) 248 | local object = {} 249 | local stringLen = string.len(s) 250 | local key, value 251 | assert(string.sub(s,startPos,startPos)=='{','decode_scanObject called but object does not start at position ' .. startPos .. ' in string:\n' .. s) 252 | startPos = startPos + 1 253 | repeat 254 | startPos = decode_scanWhitespace(s,startPos) 255 | assert(startPos<=stringLen, 'JSON string ended unexpectedly while scanning object.') 256 | local curChar = string.sub(s,startPos,startPos) 257 | if (curChar=='}') then 258 | return object,startPos+1 259 | end 260 | if (curChar==',') then 261 | startPos = decode_scanWhitespace(s,startPos+1) 262 | end 263 | assert(startPos<=stringLen, 'JSON string ended unexpectedly scanning object.') 264 | -- Scan the key 265 | key, startPos = json.decode(s,startPos) 266 | assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 267 | startPos = decode_scanWhitespace(s,startPos) 268 | assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 269 | assert(string.sub(s,startPos,startPos)==':','JSON object key-value assignment mal-formed at ' .. startPos) 270 | startPos = decode_scanWhitespace(s,startPos+1) 271 | assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key) 272 | value, startPos = json.decode(s,startPos) 273 | object[key]=value 274 | until false -- infinite loop while key-value pairs are found 275 | end 276 | 277 | -- START SoniEx2 278 | -- Initialize some things used by decode_scanString 279 | -- You know, for efficiency 280 | local escapeSequences = { 281 | ["\\t"] = "\t", 282 | ["\\f"] = "\f", 283 | ["\\r"] = "\r", 284 | ["\\n"] = "\n", 285 | ["\\b"] = "\b" 286 | } 287 | setmetatable(escapeSequences, {__index = function(t,k) 288 | -- skip "\" aka strip escape 289 | return string.sub(k,2) 290 | end}) 291 | -- END SoniEx2 292 | 293 | --- Scans a JSON string from the opening inverted comma or single quote to the 294 | -- end of the string. 295 | -- Returns the string extracted as a Lua string, 296 | -- and the position of the next non-string character 297 | -- (after the closing inverted comma or single quote). 298 | -- @param s The string being scanned. 299 | -- @param startPos The starting position of the scan. 300 | -- @return string, int The extracted string as a Lua string, and the next character to parse. 301 | function decode_scanString(s,startPos) 302 | assert(startPos, 'decode_scanString(..) called without start position') 303 | local startChar = string.sub(s,startPos,startPos) 304 | -- START SoniEx2 305 | -- PS: I don't think single quotes are valid JSON 306 | assert(startChar == [["]] or startChar == [[']],'decode_scanString called for a non-string') 307 | --assert(startPos, "String decoding failed: missing closing " .. startChar .. " for string at position " .. oldStart) 308 | local t = {} 309 | local i,j = startPos,startPos 310 | while string.find(s, startChar, j+1) ~= j+1 do 311 | local oldj = j 312 | i,j = string.find(s, "\\.", j+1) 313 | local x,y = string.find(s, startChar, oldj+1) 314 | if not i or x < i then 315 | i,j = x,y-1 316 | end 317 | table.insert(t, string.sub(s, oldj+1, i-1)) 318 | if string.sub(s, i, j) == "\\u" then 319 | local a = string.sub(s,j+1,j+4) 320 | j = j + 4 321 | local n = tonumber(a, 16) 322 | assert(n, "String decoding failed: bad Unicode escape " .. a .. " at position " .. i .. " : " .. j) 323 | -- math.floor(x/2^y) == lazy right shift 324 | -- a % 2^b == bitwise_and(a, (2^b)-1) 325 | -- 64 = 2^6 326 | -- 4096 = 2^12 (or 2^6 * 2^6) 327 | local x 328 | if n < 0x80 then 329 | x = string.char(n % 0x80) 330 | elseif n < 0x800 then 331 | -- [110x xxxx] [10xx xxxx] 332 | x = string.char(0xC0 + (math.floor(n/64) % 0x20), 0x80 + (n % 0x40)) 333 | else 334 | -- [1110 xxxx] [10xx xxxx] [10xx xxxx] 335 | x = string.char(0xE0 + (math.floor(n/4096) % 0x10), 0x80 + (math.floor(n/64) % 0x40), 0x80 + (n % 0x40)) 336 | end 337 | table.insert(t, x) 338 | else 339 | table.insert(t, escapeSequences[string.sub(s, i, j)]) 340 | end 341 | end 342 | table.insert(t,string.sub(j, j+1)) 343 | assert(string.find(s, startChar, j+1), "String decoding failed: missing closing " .. startChar .. " at position " .. j .. "(for string at position " .. startPos .. ")") 344 | return table.concat(t,""), j+2 345 | -- END SoniEx2 346 | end 347 | 348 | --- Scans a JSON string skipping all whitespace from the current start position. 349 | -- Returns the position of the first non-whitespace character, or nil if the whole end of string is reached. 350 | -- @param s The string being scanned 351 | -- @param startPos The starting position where we should begin removing whitespace. 352 | -- @return int The first position where non-whitespace was encountered, or string.len(s)+1 if the end of string 353 | -- was reached. 354 | function decode_scanWhitespace(s,startPos) 355 | local whitespace=" \n\r\t" 356 | local stringLen = string.len(s) 357 | while ( string.find(whitespace, string.sub(s,startPos,startPos), 1, true) and startPos <= stringLen) do 358 | startPos = startPos + 1 359 | end 360 | return startPos 361 | end 362 | 363 | --- Encodes a string to be JSON-compatible. 364 | -- This just involves back-quoting inverted commas, back-quotes and newlines, I think ;-) 365 | -- @param s The string to return as a JSON encoded (i.e. backquoted string) 366 | -- @return The string appropriately escaped. 367 | 368 | local escapeList = { 369 | ['"'] = '\\"', 370 | ['\\'] = '\\\\', 371 | ['/'] = '\\/', 372 | ['\b'] = '\\b', 373 | ['\f'] = '\\f', 374 | ['\n'] = '\\n', 375 | ['\r'] = '\\r', 376 | ['\t'] = '\\t' 377 | } 378 | 379 | function json_private.encodeString(s) 380 | local s = tostring(s) 381 | return s:gsub(".", function(c) return escapeList[c] end) -- SoniEx2: 5.0 compat 382 | end 383 | 384 | -- Determines whether the given Lua type is an array or a table / dictionary. 385 | -- We consider any table an array if it has indexes 1..n for its n items, and no 386 | -- other data in the table. 387 | -- I think this method is currently a little 'flaky', but can't think of a good way around it yet... 388 | -- @param t The table to evaluate as an array 389 | -- @return boolean, number True if the table can be represented as an array, false otherwise. If true, 390 | -- the second returned value is the maximum 391 | -- number of indexed elements in the array. 392 | function isArray(t) 393 | -- Next we count all the elements, ensuring that any non-indexed elements are not-encodable 394 | -- (with the possible exception of 'n') 395 | if (t == json.EMPTY_ARRAY) then return true, 0 end 396 | if (t == json.EMPTY_OBJECT) then return false end 397 | 398 | local maxIndex = 0 399 | for k,v in pairs(t) do 400 | if (type(k)=='number' and math.floor(k)==k and 1<=k) then -- k,v is an indexed pair 401 | if (not isEncodable(v)) then return false end -- All array elements must be encodable 402 | maxIndex = math.max(maxIndex,k) 403 | else 404 | if (k=='n') then 405 | if v ~= (t.n or #t) then return false end -- False if n does not hold the number of elements 406 | else -- Else of (k=='n') 407 | if isEncodable(v) then return false end 408 | end -- End of (k~='n') 409 | end -- End of k,v not an indexed pair 410 | end -- End of loop across all pairs 411 | return true, maxIndex 412 | end 413 | 414 | --- Determines whether the given Lua object / table / variable can be JSON encoded. The only 415 | -- types that are JSON encodable are: string, boolean, number, nil, table and json.null. 416 | -- In this implementation, all other types are ignored. 417 | -- @param o The object to examine. 418 | -- @return boolean True if the object should be JSON encoded, false if it should be ignored. 419 | function isEncodable(o) 420 | local t = type(o) 421 | return (t=='string' or t=='boolean' or t=='number' or t=='nil' or t=='table') or 422 | (t=='function' and o==json.null) 423 | end 424 | 425 | return json -------------------------------------------------------------------------------- /inter/common.lua: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------------- 2 | --------------------------------------------------------------------------------------------- 3 | common = {} 4 | -- 删除日志文件 5 | ----------------------- 6 | ----------------------- 7 | function common.delAllLog() 8 | delFile("/mnt/sdcard/TouchSprite/log/debug.log") 9 | end; 10 | 11 | function common.kyToast(str,time) 12 | toast(str,time); 13 | end; 14 | function common.kySleep(count) 15 | mSleep(count*1000); 16 | end; 17 | 18 | function common.kyLog(str) 19 | log(str,"app"); 20 | end; 21 | 22 | function common.kyWriteRemainDataInfo() 23 | filePhone = "/mnt/sdcard/TouchSprite/lua/json/json_Remain_Device_info.json"; 24 | if(true == isFileExist(filePhone))then 25 | -- 这里是找到留存IP,保存留存信息用 26 | else 27 | common.kyToast("缺少配置文件,请检查...."); 28 | lua_exit(); -- 退出脚本 29 | end; 30 | end; 31 | 32 | function common.kyFrontAppBid() 33 | repeat 34 | common.kySleep(1); 35 | bid,class = frontAppBid(); 36 | until(nil ~= bid ) 37 | return bid,class; 38 | end; 39 | 40 | function common.kyLuaExit() 41 | common.kyLog("kyLuaExit--0"); 42 | lua_exit(); 43 | end; 44 | function common.kyOpenApp(str) 45 | common.kyLog("kyOpenApp--0"..str); 46 | runApp(str); 47 | common.kySleep(1); 48 | common.kyLog("kyOpenApp--1"..str); 49 | end; 50 | -- 退出应用 51 | function common.kyCloseApp(str) 52 | common.kyLog("kyCloseApp--0"..str); 53 | closeApp(str); 54 | common.kySleep(1); 55 | common.kyLog("kyCloseApp--0"..str); 56 | end; 57 | 58 | function common.kyInitLog() 59 | logfile = "/mnt/sdcard/TouchSprite/log/"..gYourAppPackage..".log"; 60 | if(true == isFileExist(logfile))then 61 | delFile(logfile); 62 | end 63 | common.kyLog(gAppVersion); 64 | end; 65 | 66 | -- 移动 67 | function common.kyMove(startX,startY,endX,endY) 68 | touchDown(startX, startY); --在 (150, 550) 按下 69 | mSleep(30); 70 | touchMove(endX, endY); --移动到 (150, 600) 71 | mSleep(30); 72 | touchUp(endX, endY); --在 (150, 600) 抬起 73 | mSleep(300); 74 | end; 75 | -- 点击函数封装 76 | function common.kyClick(x, y) 77 | touchDown(x, y) 78 | mSleep(30); 79 | touchUp(x, y) 80 | end 81 | function common.kyDataInit() 82 | log("kyDataInit--0","debug"); 83 | common.kyToast("数据初始化 - 开始"); 84 | local configPath = "/mnt/sdcard/TouchSprite/lua/json/json_context_config.json"; 85 | if(true == isFileExist(configPath))then 86 | log("kyDataInit--1","debug"); 87 | local configJson = readFileString(configPath);--读取配置文件 88 | gConfigTable = json.decode(configJson); --json转table 89 | else 90 | log("kyDataInit--2","debug"); 91 | common.kyToast("缺少配置文件,请检查...."); 92 | lua_exit(); -- 退出脚本 93 | end; 94 | gFileNewDevice = gConfigTable["info"]["jsonPath"]..gConfigTable["info"]["newDeviceName"]; -- 新设备 95 | gFileRemainDevice = gConfigTable["info"]["jsonPath"]..gConfigTable["info"]["remainDeviceName"]; -- 留存设备 96 | gReportUrl = gConfigTable["info"]["reportUrl"]; 97 | 98 | local fileResolution = gConfigTable["info"]["jsonPath"]..gConfigTable["info"]["resolutionJsonName"]; -- 分辨率 99 | local fileFixData = gConfigTable["info"]["jsonPath"]..gConfigTable["info"]["fixJsonName"]; -- 固定数据 100 | local fileAppInfo = gConfigTable["info"]["jsonPath"]..gConfigTable["info"]["appInfoName"]; -- 应用列表 101 | 102 | if(true == isFileExist(fileResolution))then 103 | log("kyDataInit--3","debug"); 104 | resolustionJson = readFileString(fileResolution);--读取分辨率配置文件 105 | gResolustionTable = json.decode(resolustionJson); --json转table 106 | else 107 | log("kyDataInit--4","debug"); 108 | common.kyToast("缺少配置文件,请检查...."); 109 | lua_exit();-- 退出脚本 110 | end; 111 | 112 | if(true == isFileExist(fileFixData))then 113 | log("kyDataInit--5","debug"); 114 | fixedDataJson = readFileString(fileFixData); --固定数据文件 115 | gFixedDataTable = json.decode(fixedDataJson); --json转table 116 | else 117 | log("kyDataInit--5","debug"); 118 | common.kyToast("缺少配置文件,请检查...."); 119 | lua_exit(); -- 退出脚本 120 | end; 121 | 122 | if(true == isFileExist(gFileNewDevice))then 123 | log("kyDataInit--6","debug"); 124 | newDeviceJson = readFileString(gFileNewDevice); --固定数据文件 125 | gNewDeviceTable = json.decode(newDeviceJson); --json转table 126 | else 127 | log("kyDataInit--7","debug"); 128 | common.kyToast("缺少配置文件,请检查...."); 129 | lua_exit(); -- 退出脚本 130 | end; 131 | --[[ 132 | if(1 == netGetAppInfo(appId))then 133 | common.kyToast("网络获取App信息失败,请检查...."); 134 | return; 135 | end; 136 | --]] 137 | gYourAppPackagePath = gConfigTable["info"]["apkPath"]..gGetTaskTable["task"]["app"]["apkPath"]; 138 | gYourAppId = gGetTaskTable["task"]["app"]["id"]; 139 | gYourUserId = gGetTaskTable["task"]["app"]["userId"]; 140 | gYourPlatformId = gGetTaskTable["task"]["app"]["platformId"]; 141 | gResulotion = "supportResolution_"..gYourPlatformId; 142 | gYourAppName = gGetTaskTable["task"]["app"]["name"]; 143 | gYourAppPackage = gGetTaskTable["task"]["app"]["packageName"]; 144 | gYourAppToken = gGetTaskTable["task"]["app"]["token"]; 145 | gYourAppUserId = gGetTaskTable["task"]["app"]["userId"]; 146 | gYourAppPlatformId = gGetTaskTable["task"]["app"]["platformId"]; 147 | 148 | local appConfig = gGetTaskTable["task"]["app"]["configure"]; 149 | gYourAppConfig = json.decode(appConfig); -- 将app 的配置信息json转table 150 | gYourAppHomeInfo = gYourAppConfig["home"]; 151 | 152 | gAppVersion = gConfigTable["info"]["version"]; 153 | gAppshiqian = "org.tencent.android.kernel"; 154 | gAppinstall = "com.android.packageinstaller"; 155 | gAppTouchsprite = "com.touchsprite.android"; 156 | gAppLauncher = "com.android.launcher"; 157 | gWXH = "R720X1280"; -- 当前分辨率 158 | gDeviceType = getDeviceType(); -- 设备类型 0 == iPod Touch;1 == iPhone;2 == iPad;3 == 安卓设备;4 == 安卓模拟器 159 | gDirtyAppCount = 0; -- 安装了垃圾应用个数 160 | gAppList = {"com.android.browser", 161 | "com.cyanogenmod.filemanager", 162 | "com.android.gallery", 163 | "com.android.vending", 164 | "com.android.settings", 165 | "com.android.launcher", 166 | "com.google.android.gms", 167 | "com.android.providers.downloads.ui", 168 | "eu.chainfire.supersu", 169 | "me.haima.helpcenter", 170 | "me.haima.androidassist", 171 | "de.robv.android.xposed.installer", 172 | "com.touchsprite.android", 173 | "com.android.packageinstaller", 174 | gAppshiqian, 175 | gYourAppPackage, 176 | gAppPortarit 177 | } 178 | gFrozenScreenCount = 0; 179 | gCurrentBid = gYourAppPackage; 180 | common.kyToast("完成数据初始化"); 181 | delFile("/mnt/sdcard/TouchSprite/log/"..gYourAppPackage..".log"); 182 | end; 183 | 184 | 185 | function common.kyGetRemainDeviceInfo() 186 | if(true == isFileExist(gFileRemainDevice))then 187 | local remainDeviceJson = readFileString(gFileRemainDevice); --留存数据文件 188 | gRemainDataSingleTable = json.decode(remainDeviceJson); --json转table 189 | else 190 | common.kyToast("缺少配置文件,请检查...."); 191 | lua_exit(); -- 退出脚本 192 | end; 193 | end; 194 | function common.kyGetNewDeviceInfo() 195 | common.kyLog("kyGetNewDeviceInfo--0"); 196 | if(true == isFileExist(gFileNewDevice))then 197 | common.kyLog("kyGetNewDeviceInfo--1"); 198 | newDeviceJson = readFileString(gFileNewDevice); --新设备数据文件 199 | gNewDeviceTable = json.decode(newDeviceJson); --json转table 200 | else 201 | common.kyLog("kyGetNewDeviceInfo--2"); 202 | common.kyToast("缺少配置文件,请检查...."); 203 | lua_exit(); -- 退出脚本 204 | end; 205 | common.kyLog("kyGetNewDeviceInfo--3"); 206 | end; 207 | 208 | function common.kyHint() 209 | hint = gYourAppName; 210 | if( isRunRemain == 1 )then 211 | hint = hint .. "存量"; 212 | else 213 | hint = hint .. "增量"; 214 | end; 215 | if(isRunShuiJun == 1)then 216 | hint = hint .. "水军脚本"; 217 | else 218 | hint = hint .. "赚钱脚本"; 219 | end; 220 | common.kyToast("当前在跑"..hint); 221 | end; 222 | 223 | -- 卸载所有垃圾APP 224 | function common.kyUninstallDirtyAppByLua() 225 | common.kyLog("kyUninstallDirtyAppByLua--0"); 226 | closeApp(gYourAppPackage);--先把自己给关了 227 | uninstallApp(gYourAppPackage); 228 | pkns = getInstalledApps(); 229 | for key, value in ipairs(pkns) do 230 | flag = 0 231 | for defaultkey, defaultvalue in ipairs(gAppList) do 232 | if( value == defaultvalue ) then 233 | flag = 1; 234 | break; 235 | end; 236 | end; 237 | if flag == 0 then 238 | common.kyLog("kyUninstallDirtyAppByLua--1--"..value); 239 | closeApp(value); -- 先关闭再卸载 240 | uninstallApp(value); -- 卸载 241 | end; 242 | end 243 | common.kyLog("kyUninstallDirtyAppByLua--4"); 244 | end; 245 | function common.kyLuaRestart() 246 | common.kyLog("kyLuaRestart--0"); 247 | common.kyUninstallDirtyAppByLua(); 248 | closeApp(gYourAppPackage); 249 | uninstallApp(gYourAppPackage); 250 | lua_restart(); 251 | common.kyLog("kyLuaRestart--1"); 252 | end; 253 | -- 初始化自己的应用,先卸载,再安装,确保token干净之身 254 | function common.kyInitPortarit() 255 | appPortaritPath = "/mnt/sdcard/TouchSprite/res/apk/screen_portait.apk" 256 | gAppPortarit = "kuang.jun.qing"; 257 | uninstallApp(gAppPortarit); -- 卸载 258 | if(true == isFileExist(appPortaritPath))then 259 | install(appPortaritPath); -- 安装应用 260 | else 261 | common.kyToast("包不存在...."); 262 | lua_exit();; -- 退出脚本 263 | end; 264 | end; 265 | 266 | function common.kyInitMyApp() 267 | common.kyLog("kyInitMyApp--0--"..gYourAppPackage); 268 | common.kyLog("kyInitMyApp--1"); 269 | common.kyToast("正在卸载本应用"); 270 | uninstallApp(gYourAppPackage); -- 卸载 271 | common.kySleep(1); 272 | common.kyLog("kyInitMyApp--2"); 273 | if(true == isFileExist(gYourAppPackagePath))then 274 | common.kyLog("kyInitMyApp--3"); 275 | common.kyToast("正在安装本应用"); 276 | install(gYourAppPackagePath); -- 安装应用 277 | common.kySleep(1); 278 | else 279 | common.kyLog("kyInitMyApp--4"); 280 | common.kyToast("安装包不存在...."..gYourAppPackagePath); 281 | lua_exit();; -- 退出脚本 282 | end; 283 | common.kyLog("kyInitMyApp--5"); 284 | end; 285 | ------------------------------------------------------------------------------------------------- 286 | -- 判断类相关操作 287 | ----------------------------------------------------------------------------------------------- 288 | -- 获取当前分辨率信息 289 | function common.isSupportResolution() 290 | return true; 291 | --[[ 292 | common.kyLog("isSupportResolution--0"); 293 | local width = gNewDeviceTable["device"]["width"]; 294 | local height = gNewDeviceTable["device"]["height"]; 295 | gWXH = "R"..width.."X"..height; -- 全局变量 296 | local supportCount = 1; 297 | common.kyToast("当前分辨率"..gWXH,10); 298 | common.kyLog("isSupportResolution--1--"..gWXH); 299 | 300 | 301 | 302 | repeat 303 | local fenbianl = gResolustionTable[gResulotion][supportCount]["resolution"]; 304 | if(gWXH == fenbianl)then 305 | common.kyToast("支持该分辨率!"); 306 | common.kyLog("isSupportResolution--2--"..fenbianl); 307 | return true; 308 | end; 309 | common.kyLog("isSupportResolution--3--"..fenbianl); 310 | supportCount = supportCount + 1; 311 | until(supportCount == 15) 312 | common.kyLog("isSupportResolution--4"); 313 | return false; 314 | --]] 315 | end; 316 | -- 是否黑名单IP 317 | function common.isBlackIp(checkIp) 318 | blackCount = gBlackIpTable["count"]; 319 | repeat 320 | if(checkIp == gBlackIpTable["ipList"][blackCount])then 321 | common.kyLog("isBlackIp--0"); 322 | common.kyToast("ip在黑名单"..checkIp); 323 | return true; 324 | end; 325 | blackCount = blackCount -1; 326 | until(blackCount == 0) 327 | common.kyLog("isnotBlackIp--1"); 328 | common.kyToast("ip不在黑名单"..checkIp); 329 | return false; 330 | end; 331 | 332 | -- 小神灯是否弹出了未安装应用列表 333 | function common.isPopNoneinstall() 334 | common.kyLog("isPopNoneinstall--0"); 335 | ap = gFixedDataTable["popNeedInstallApp"][1]; 336 | bp = gFixedDataTable["popNeedInstallApp"][2]; 337 | cp = gFixedDataTable["popNeedInstallApp"][3]; 338 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 true,== true 可省略不写 339 | common.kyLog("isPopNoneinstall--1"); 340 | return true; 341 | end; 342 | common.kyLog("isPopNoneinstall--2"); 343 | return false; 344 | end; 345 | 346 | -- 是否有插屏广告 347 | function common.isPopInterstitial() 348 | common.kyLog("isPopInterstitial--0"); 349 | ap = gYourAppHomeInfo[1]; 350 | bp = gYourAppHomeInfo[2]; 351 | cp = gYourAppHomeInfo[3]; 352 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 353 | common.kyLog("isPopInterstitial--1"); 354 | return false; 355 | end 356 | common.kyLog("isPopInterstitial--2"); 357 | return true; 358 | end; 359 | 360 | -- 是否为008首页 361 | function common.is008Home() 362 | common.kyLog("is008Home--0"); 363 | ap = gFixedDataTable["home008"][1]; 364 | bp = gFixedDataTable["home008"][2]; 365 | common.kyToast( "is008Home ap "..ap["x"]); 366 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]}}) == true then--全部坐标点和颜色一致时返回 true,== true 可省略不写 367 | common.kyLog("is008Home--1"); 368 | return true; 369 | end; 370 | common.kyLog("is008Home--2"); 371 | return false; 372 | end; 373 | 374 | -- 是否进入安装完成打开界面 375 | function common.isOpenStep() 376 | common.kyLog("isOpenStep--0"); 377 | ap = gFixedDataTable["openStep"][1]; 378 | bp = gFixedDataTable["openStep"][2]; 379 | cp = gFixedDataTable["openStep"][3]; 380 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 381 | common.kyLog("isOpenStep--1"); 382 | return true; 383 | end 384 | common.kyLog("isOpenStep--2"); 385 | return false; 386 | end; 387 | -- 是否进入安装界面 388 | function common.isInstallStep() 389 | common.kyLog("isInstallStep--0"); 390 | ap = gFixedDataTable["installStep"][1]; 391 | bp = gFixedDataTable["installStep"][2]; 392 | cp = gFixedDataTable["installStep"][3]; 393 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 394 | common.kyLog("isInstallStep--1"); 395 | return true; 396 | end 397 | common.kyLog("isInstallStep--2"); 398 | return false; 399 | end; 400 | -- 是否进入解析包错误 401 | function common.isParsePackError() 402 | common.kyLog("isParsePackError--0"); 403 | ap = gFixedDataTable["parsePackError"][1]; 404 | bp = gFixedDataTable["parsePackError"][2]; 405 | cp = gFixedDataTable["parsePackError"][3]; 406 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 407 | common.kyLog("isParsePackError--1"); 408 | return true; 409 | end 410 | common.kyLog("isParsePackError--2"); 411 | return false; 412 | end; 413 | 414 | -- 是否安装失败界面 415 | function common.isInstallFail() 416 | common.kyLog("isInstallFail--0"); 417 | ap = gFixedDataTable["sorryInstallStop"][1]; 418 | bp = gFixedDataTable["sorryInstallStop"][2]; 419 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]}}) == true then--全部坐标点和颜色一致时返回 420 | common.kyLog("isInstallFail--1"); 421 | return true; 422 | end 423 | common.kyLog("isInstallFail--2"); 424 | return false; 425 | end; 426 | function common.isApplyNotInstall() 427 | common.kyLog("isApplyNotInstall--0"); 428 | ap = gFixedDataTable["applyNotInstall"][1]; 429 | bp = gFixedDataTable["applyNotInstall"][2]; 430 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]}}) == true then--全部坐标点和颜色一致时返回 431 | common.kyLog("isApplyNotInstall--1"); 432 | return true; 433 | end 434 | common.kyLog("isApplyNotInstall--2"); 435 | return false; 436 | end; 437 | function common.isAppStopRun() 438 | common.kyLog("isAppStopRun--0"); 439 | ap = gFixedDataTable["appStopRun"][1]; 440 | bp = gFixedDataTable["appStopRun"][2]; 441 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]}}) == true then--全部坐标点和颜色一致时返回 442 | common.kyLog("isAppStopRun--1"); 443 | return true; 444 | end 445 | common.kyLog("isAppStopRun--2"); 446 | return false; 447 | end; 448 | 449 | -- 是否进入了下一步界面 450 | function common.isNextStep() 451 | common.kyLog("isNextStep--0"); 452 | ap = gFixedDataTable["nextStep"][1]; 453 | bp = gFixedDataTable["nextStep"][2]; 454 | cp = gFixedDataTable["nextStep"][3]; 455 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 456 | common.kyLog("isNextStep--1"); 457 | return true; 458 | end 459 | common.kyLog("isNextStep--2"); 460 | return false; 461 | end; 462 | -- 检测是否是垃圾应用 463 | function common.isDirtyApp() 464 | common.kyLog("isDirtyApp-0"); 465 | bid,class = common.kyFrontAppBid(); -- 获取当前包 466 | for key, value in ipairs(gAppList) do 467 | if (bid == value) then 468 | common.kyLog("isDirtyApp--1"); 469 | return false; 470 | end; 471 | end 472 | common.kyLog("isDirtyApp--2"); 473 | return true; 474 | end; 475 | function common.isMyselfApp() 476 | common.kyLog("isMyselfApp--0"); 477 | bid,class = kyFrontAppBid(); -- 获取当前包 478 | if(bid == gYourAppPackage)then 479 | common.kyLog("isMyselfApp--1"); 480 | return true; 481 | end; 482 | common.kyLog("isMyselfApp--2"); 483 | return false; 484 | end; 485 | function common.isDeskerApp() 486 | common.kyLog("isDeskerApp--0"); 487 | bid,class = common.kyFrontAppBid(); -- 获取当前包 488 | if(bid == gAppLauncher)then 489 | common.kyLog("isDeskerApp--1"); 490 | return true; 491 | end; 492 | common.kyLog("isDeskerApp--2"); 493 | return false; 494 | end; 495 | -- 是否进入安装界面安装 496 | function common.isGotoInstallPackage() 497 | common.kyLog("isGotoInstallPackage--0"); 498 | if(true == common.isNextStep() or true == common.isInstallStep() or true == common.isOpenStep() or true == common.isInstallStep())then 499 | common.kyLog("isGotoInstallPackage--1"); 500 | return true; 501 | end; 502 | bid,class = common.kyFrontAppBid(); -- 获取当前包 503 | common.kyLog("isGotoInstallPackage--2--"..bid..class); 504 | if bid == gAppinstall then 505 | common.kyLog("isGotoInstallPackage--3"); 506 | return true; 507 | end 508 | common.kyLog("isGotoInstallPackage--4"); 509 | return false; 510 | end; 511 | 512 | function common.isImeiChange() 513 | common.kyLog("isImeiChange--0"); 514 | if( gImei == gNewDeviceTable["device"]["imei"])then 515 | common.kyToast("gImei 没有改变"); 516 | common.kyLog("isImeiChange--1"); 517 | return false; 518 | end; 519 | common.kyToast("imei已改变"); 520 | gImei = gNewDeviceTable["device"]["imei"]; 521 | common.kyLog("isImeiChange--2"); 522 | return true; 523 | end; 524 | 525 | --------------------关闭类,异常类相关操作-------------------------------------------------- 526 | -- 关闭插屏广告 527 | function common.closePopInterstitial() 528 | common.kyLog("closePopInterstitial--0"); 529 | if(true == common.isPopInterstitial())then 530 | common.kyLog("closePopInterstitial--1"); 531 | supportCount = 1; 532 | -- 重新获取分辨率 533 | width = gNewDeviceTable["device"]["width"]; 534 | height = gNewDeviceTable["device"]["height"]; 535 | gWXH = "R"..width.."X"..height; -- 全局变量 536 | repeat 537 | --common.kyToast("广告gWXH" .. gWXH .. "广告support"..gResolustionTable["supportResolution"][supportCount]["resolution"]); 538 | if( gWXH == gResolustionTable[gResulotion][supportCount]["resolution"])then 539 | common.kyLog("closePopInterstitial--2"); 540 | ap = gResolustionTable[gResulotion][supportCount]["closeInterstitial"]; 541 | common.kyToast("已消灭广告|gWXH"..gWXH.."X|Y"..ap["x"].."|"..ap["y"]); 542 | common.kyClick(ap["x"],ap["y"]); 543 | common.kySleep(2) 544 | common.kyClick(ap["x"],ap["y"]); 545 | end; 546 | common.kyLog("closePopInterstitial--3"); 547 | supportCount = supportCount + 1; 548 | until(supportCount == 15 or false == common.isPopInterstitial()) 549 | if(true == common.isPopInterstitial())then 550 | common.kyToast("发现广告但没有消灭广告,重新执行脚本"); 551 | common.kyReportDeviceData(0); -- 上报水军 552 | pg_net.netTaskFinished(0); --上报任务未完成 553 | common.kyLuaRestart(); 554 | else 555 | return true; 556 | end; 557 | end; 558 | common.kyLog("closePopInterstitial--4"); 559 | return false; 560 | end 561 | -- 很抱歉,安装包出现异常 562 | function common.closeSorryInstallUnkown() 563 | common.kyLog("closeSorryInstallUnkown--0"); 564 | ap = gFixedDataTable["sorryInstallUnkown"][1]; 565 | bp = gFixedDataTable["sorryInstallUnkown"][2]; 566 | cp = gFixedDataTable["sorryInstallUnkown"][3]; 567 | if multiColor({{ap["x"],ap["y"],ap["color"]},{bp["x"],bp["y"],bp["color"]},{cp["x"],cp["y"],cp["color"]}}) == true then--全部坐标点和颜色一致时返回 568 | common.kyToast("出现安装包异常"); 569 | common.kyClick(360,720); -- 提示不能安装,需要点掉。 570 | common.kyLog("closeSorryInstallUnkown--1"); 571 | return true; 572 | end 573 | common.kyLog("closeSorryInstallUnkown--2"); 574 | return false; 575 | end; 576 | -- 处理各种异常界面 577 | function common.kyProcessException() 578 | common.kyLog("kyProcessException--0"); 579 | local count = 0; 580 | repeat 581 | if(true == common.isPopNoneinstall())then -- 小神灯弹出未安装界面。 582 | common.kyLog("kyProcessException--1"); 583 | ap = gFixedDataTable["closeAllApp"][1]; 584 | common.kyClick(ap["x"],ap["y"]); 585 | common.kySleep(1); 586 | end; 587 | if(true == common.isApplyNotInstall())then -- 弹出应用未安装界面。 588 | common.kyClick(170,1230); -- 点击取消 589 | common.kySleep(1); 590 | end; 591 | if(true == common.isInstallFail())then -- 出现应该安装失败 592 | common.kyLog("kyProcessException--4"); 593 | common.kyClick(360,723); 594 | common.kySleep(1); 595 | end; 596 | if(true == common.isParsePackError())then -- 出现包解析出错 597 | common.kyLog("kyProcessException--4"); 598 | common.kyClick(350,800); 599 | common.kySleep(1); 600 | end; 601 | if(true == common.isAppStopRun())then -- 出现停止运行 602 | common.kyLog("kyProcessException--5"); 603 | common.kyClick(355,726); 604 | common.kySleep(1); 605 | end; 606 | count = count + 1; 607 | until(count == 2) 608 | common.kyLog("kyProcessException--10"); 609 | end; 610 | 611 | -- 处理竖屏 612 | function common.kyProcessScreen() 613 | common.kyLog("kyProcessScreen--0"); 614 | runApp(gAppPortarit); 615 | common.kyProcessException();-- 处理各种异常 616 | common.closePopInterstitial(); -- 在铁腕下消灭一切广告 617 | closeApp(gAppPortarit); 618 | common.kyLog("kyProcessScreen--2"); 619 | end; 620 | 621 | --------------------------------------------------------------------------------------- 622 | -- 使用留存数据 623 | function common.kyShiqianUseNetData() 624 | common.kyLog("kyShiqianUseNetData--0"); 625 | common.kyOpenApp(gAppshiqian); -- 启动 008 626 | common.kySleep(2); 627 | common.kyClick(490,965); -- 点掉授权 628 | common.kySleep(2); -- 发发启动需要足够时间 629 | common.kyClick(177,192)-- 使用点击两次留存 630 | common.kySleep(1); 631 | common.kyClick(177,192)-- 使用留存 632 | common.kySleep(1); 633 | common.kyCloseApp(gAppshiqian);--退出发发应用 634 | common.kyOpenApp(gAppshiqian);-- 打开发发 635 | common.kySleep(2); 636 | common.kyToast("取修改后的数据对比确定.."); 637 | common.kyGetRemainDeviceInfo(); -- 取留存的信息 比较 638 | common.kySleep(3); 639 | common.kyGetNewDeviceInfo(); -- 取最新手机信息,一定要这步 640 | common.kySleep(1); 641 | if( true == pg_net.netCheckRemainIp(gTaskIP,gRemainDataSingleTable["ip"]) and gNewDeviceTable["device"]["imei"] == gRemainDataSingleTable["imei"])then 642 | common.kyToast("已验证使用了留存数据 ip:" .. gNewDeviceTable["device"]["ip"] .." imei:".. gNewDeviceTable["device"]["imei"] ); 643 | common.kyLog("kyShiqianUseNetData--1"); 644 | else 645 | common.kyToast("异常,未使用留存数据,重来"); 646 | common.kyLog("kyShiqianUseNetData--2"); 647 | common.kyLuaRestart(); 648 | end; 649 | -- 650 | common.kyCloseApp(gAppshiqian); --退出008应用 651 | common.kyLog("kyShiqianUseNetData--3"); 652 | end; 653 | 654 | -- 上报有效数据到后台 655 | -- 是否为留存(1,0) isActive 是否为激活(1,0) 656 | function common.kyReportDeviceData(isActive) 657 | common.kyLog("kyReportDeviceData--0"); 658 | 659 | report = gYourAppName.." 上报数据"; 660 | if(isRunRemain == 1)then 661 | gNewDeviceTable["is_remain"] = 1; 662 | report = report .. "|留存"; 663 | else 664 | gNewDeviceTable["is_remain"] = 0; 665 | report = report .. "|增量"; 666 | end; 667 | 668 | if(isActive == 1)then 669 | report = report .. "|+1元"; 670 | else 671 | report = report .. "|水军"; 672 | end; 673 | 674 | gNewDeviceTable["is_active"] = isActive; 675 | gNewDeviceTable["appId"] = gYourAppId; 676 | gNewDeviceTable["accessToken"] = gYourAppToken; 677 | gNewDeviceTable["device"]["ip"] = gTaskIP; -- 取IP 678 | dev = getDeviceType(); 679 | if( dev == 4 ) then 680 | gNewDeviceTable["device_type"] = 0; 681 | else 682 | gNewDeviceTable["device_type"] = 1; 683 | end; 684 | deviceJson = json.encode(gNewDeviceTable); -- 转json 685 | common.kyLog("kyReportDeviceData--1--"); 686 | --writeFileString(gFileNewDevice,deviceJson); 687 | common.kyToast(report); 688 | str = httpPost(gReportUrl,deviceJson); 689 | if(false ~= str)then 690 | common.kyToast("上报成功!...") 691 | else 692 | common.kyToast("上报失败!...") 693 | end; 694 | common.kyLog("kyReportDeviceData--2--" ..isActive); 695 | end; 696 | 697 | -- ipCheck 检查 698 | -- 0: 代表IP 没有问题 1: 有问题,IP不统一 699 | function common.ipCheck() 700 | common.kyLog("ipCheck--0"); 701 | ipUrl = "http://pangu.u-app.cn/pc/remoteIp.pangu" 702 | common.kyToast("获取Ip中...",5); 703 | nowIp = ""; 704 | repeat 705 | nowIp = pg_net.netIpcheck(); 706 | if(nowIp ~= nil)then 707 | common.kyLog("ipCheck--2"); 708 | if(false == common.isBlackIp(nowIp))then -- 黑名单IP 709 | ipOK = 1; 710 | else 711 | ipOK = 0; 712 | common.kyToast("IP在黑名单中,继续等待新IP...",10); 713 | common.kySleep(10); 714 | end; 715 | else 716 | ipOK = 0; 717 | common.kyLog("ipCheck--3"); 718 | common.kyToast("网络异常,正等待连接...",10); 719 | common.kySleep(10); 720 | end; 721 | until(ipOK == 1) 722 | common.kyLog("ipCheck--8"); 723 | if( nowIp == gTaskIP )then 724 | return 0; 725 | else 726 | common.kyToast("目前IP和任务中的IP不一致! 将重新运行脚本"..gTaskIP,5); 727 | common.kyLuaRestart(); 728 | return 1; 729 | end; 730 | --]] 731 | end; 732 | -- 处理修改系统数据 733 | function common.kyShiqianNewDevice() 734 | common.kyShiqianUseNetData(); 735 | end; 736 | 737 | 738 | function common.kyUninstallAppByLua(packageName) 739 | common.kyLog("kyUninstallAppByLua--0"); 740 | uninstallApp(packageName); -- 卸载 741 | common.kyLog("kyUninstallAppByLua--1"); 742 | end; 743 | 744 | -- 切换手机 745 | function common.changeMobileInfo() 746 | common.kyLog("changeMobileInfo--0"); 747 | common.kyCloseApp(gAppshiqian); 748 | common.kyUninstallDirtyAppByLua(); -- 卸载所有垃圾应用 749 | common.kyInitMyApp(); 750 | common.kySleep(1); 751 | common.kyShiqianNewDevice(); 752 | common.kySleep(1); 753 | common.kyLog("changeMobileInfo--1"); 754 | end; 755 | -- 初始化 756 | function common.initMobile() 757 | width, height = getScreenSize(); 758 | gWXH = width.."X"..height; 759 | common.kyLog("initMobile--0--"..gWXH); 760 | pressHomeKey(); --点击 Home 键 761 | common.changeMobileInfo(); 762 | common.kyLog("initMobile--2"); 763 | showFloatButton(true); -- 显示悬浮条 764 | pressHomeKey(); --点击 Home 键 765 | common.kyLog("initMobile--3"); 766 | end; 767 | 768 | function common.exitMobile() 769 | common.kyLog("exitMobile--0"); 770 | uninstallApp(gYourAppPackage); -- 卸载应用 771 | common.kyUninstallDirtyAppByLua(); -- 卸载所有垃圾应用 772 | 773 | --common.kyOpenApp(gAppshiqian); -- 删除 azb 目录,清空下载缓存 774 | --common.kyToast("清除下载缓存",5); 775 | --common.kyCloseApp(gAppshiqian); 776 | 777 | pressHomeKey(); --点击 Home 键 778 | showFloatButton(true); -- 关闭悬浮条 779 | common.kyLog("exitMobile--1"); 780 | end; 781 | 782 | function common.kyCloseAndOpenApp() 783 | common.kyCloseApp(gYourAppPackage);-- 关闭应用 784 | common.kyOpenApp(gYourAppPackage); -- 启动应用 785 | end; 786 | 787 | 788 | function common.kyCloseDirtyApp() 789 | common.kyLog("kyCloseDirtyApp--0"); 790 | if(true == common.isDirtyApp())then 791 | bid,class = common.kyFrontAppBid(); -- 获取当前包 792 | common.kyLog("kyCloseDirtyApp--1"); 793 | common.kyToast("卸载垃圾应用"..bid); 794 | common.kyCloseApp(gYourAppPackage); 795 | common.kySleep(1); 796 | uninstallApp(gYourAppPackage); -- 卸载 797 | pressHomeKey(); --点击 Home 键 798 | common.kySleep(2); 799 | common.kyCloseApp(bid); --退出垃圾应用 800 | common.kySleep(1); 801 | uninstallApp(bid); -- 直接卸载垃圾 802 | common.kyProcessScreen(); -- 拉回竖屏 803 | end; 804 | common.kyLog("kyCloseDirtyApp--2"); 805 | end; 806 | 807 | return common; --------------------------------------------------------------------------------