diff --git a/api.js b/api.js new file mode 100644 index 0000000..4dba1ca --- /dev/null +++ b/api.js @@ -0,0 +1,59 @@ +//提供api调用 +var api={} +var wrapFuncString=function(fn,data){ + return "("+fn.toString()+")("+JSON.stringify(data)+");" +} +api.wrapFuncString=wrapFuncString +api.getApi=function(data){ + return wrapFuncString(function(data){ + global.obj={} + var obj=global.obj + obj.data=data + obj.apiCode="" + var myapi=require("api.js") + obj.myapi=myapi; + var uniqueId=data.uniqueId// + global.api=(function(){ + return { + getId(){ + return uniqueId + }, + getExtras(){ + return data.extras + } + } + })() + if(uniqueId=="app_ui")//root应用可以设置 + global.api.setApi=function(code){ + obj.apiCode=myapi.wrapFuncString(code).replace(/[\r\n]/g, "") + } + global.tempstorages=global.storages + global.storages=(function(){ + return { + create(str){ + return global.tempstorages.create("appdata_"+uniqueId) + },remove(str){ + return global.tempstorages.remove("appdata_"+uniqueId) + } + } + })() + global.tempengines=global.engines + global.engines=(function(){ + return { + execScript(name, script, config){ + var code=""; + if(script.startsWith('"ui";'))code+='"ui";'; + var extras=null; + if(config&&config.extras)extras=config.extras + code+=myapi.getApi({uniqueId:uniqueId+"_"+name,extras:extras}); + if(obj.apiCode)code+=obj.apiCode; + code+=";global.obj=void 0;"; + code+=script; + return global.tempengines.execScript(name, code, config); + } + } + })() + + },data).replace(/[\r\n]/g, ""); +} +module.exports = api; \ No newline at end of file diff --git a/files/1.js b/files/1.js new file mode 100644 index 0000000..9d27cc1 --- /dev/null +++ b/files/1.js @@ -0,0 +1,311 @@ +toast("开始任务"); +device.keepScreenOn(3600 * 1000); +device.keepScreenDim(3600 * 1000) +if(typeof api==="undefined")toast("一点仓库有更新了!快更新吧!"); +//try {requiresApi(24);}catch (error){toast('需要在Android 7.0以上版本运行');throw "";} +auto.waitFor(); +var Package="com.taobao.taobao" +var chfn=function(fn,timeout){ + sleep(100) + if(!timeout)timeout=10000//10s + var i=0; + while(1){ + var result=fn() + if(result){ + return result; + }else{ + sleep(500); + if(i++>(timeout/500)){ + toast("任务步骤超时,请重新运行!"); + // sleep(1000); + // throw ""; + throw ""; + } + } + } +} +/** + * 贝塞尔曲线 + * @param {坐标点} ScreenPoint + * @param {偏移量} Offset + */ +function bezier_curves(ScreenPoint, Offset) { + cx = 3.0 * (ScreenPoint[1].x - ScreenPoint[0].x); + bx = 3.0 * (ScreenPoint[2].x - ScreenPoint[1].x) - cx; + ax = ScreenPoint[3].x - ScreenPoint[0].x - cx - bx; + cy = 3.0 * (ScreenPoint[1].y - ScreenPoint[0].y); + by = 3.0 * (ScreenPoint[2].y - ScreenPoint[1].y) - cy; + ay = ScreenPoint[3].y - ScreenPoint[0].y - cy - by; + tSquared =Offset * Offset; + tCubed = tSquared * Offset; + result = { + "x": 0, + "y": 0 + }; + result.x = (ax * tCubed) + (bx * tSquared) + (cx * Offset) + ScreenPoint[0].x; + result.y = (ay * tCubed) + (by * tSquared) + (cy * Offset) + ScreenPoint[0].y; + return result; +}; +/** + * 曲线滑动 + * @param {*} qx + * @param {*} qy + * @param {*} zx + * @param {*} zy + * @param {*} time + */ +function sml_move(qx, qy, zx, zy, time) { + var xxy = [parseInt(time+Math.random()*100)]; + var point = []; + var dx0 = { + "x": qx, + "y": qy + }; + var dx1 = { + "x": random(qx - 100, qx + 100), + "y": random(qy, qy + 50) + }; + var dx2 = { + "x": random(zx - 100, zx + 100), + "y": random(zy, zy + 50), + }; + var dx3 = { + "x": zx, + "y": zy + }; + for (var i = 0; i < 4; i++) { + eval("point.push(dx" + i + ")"); + }; + for (let i = 0; i < 1; i += 0.08) { + let newPoint=bezier_curves(point, i); + xxyy = [parseInt(newPoint.x), parseInt(newPoint.y)] + xxy.push(xxyy); + } + try{ + gesture.apply(null, xxy); + }catch(e){} +}; +var p=console.log; +pp=function(data,offset,size){ + for(var i=offset;i=data.length)return; + p(data[i].id()+"|"+data[i].text()+"|"+data[i].desc()+"|"+data[i].className()); + } +} + +// p(currentPackage()); +// p(currentPackage()); + +var current=currentPackage() +if(!current||current==="com.android.systemui"){ + back(); + sleep(2000) +} + +if(currentPackage()!==Package){ + //需要启动tb + app.launch(Package) + chfn(function(){ + return currentPackage()===Package + }) + if(packageName(currentPackage()).find().length==0){//说明是新开淘宝 + chfn(function(){ + sleep(100) + return packageName(currentPackage()).find().length + }) + sleep(1000)//给充足的时间加载 + chfn(function(){ + return desc("我的淘宝").findOnce() + },25000); + }else{ + if(desc("我的淘宝").findOnce()){//说明在首页 + + }else{//需要返回才能到达首页 + if(currentActivity()=="android.widget.FrameLayout"){} + chfn(function(){ + if(currentPackage()!==Package){ + app.launch(Package) + sleep(200) + } + if(desc("我的淘宝").findOnce()){ + return true; + }else{ + back(); + sleep(200); + } + },25000); + + } + } +} +cur=currentActivity() +// console.log(cur) +// console.log(textMatches(/.*?浏览\d+秒.*?/).findOnce()||descMatches(/.*?浏览\d+秒.*?/).findOnce()) +// pp(packageName(Package).find(),0,500); +// exit() +if(cur!="com.taobao.tao.TBMainActivity"&&cur!="com.taobao.browser.BrowserActivity"){ + back(); + sleep(1000); +} +// if(cur=="com.taobao.browser.exbrowser.BrowserUpperActivity"||cur=="com.taobao.android.shop.activity.ShopRenderActivity"){ +// back(); +// sleep(1000); +// } + +var autoclick=function(arr){ + for(var i=0;i=0;j--){ + chfn(arr[j]).click() + } + return; + } + } +} +var getMyCoin=function(){ + if(text("累计任务奖励").findOnce()){ + if(text("关闭").findOnce()){ + text("关闭").findOnce().click() + chfn(function(){ + return text("赚喵币").findOnce() + }) + var coin + if(textContains("我的喵币,").findOnce()){ + coin=parseInt(textContains("我的喵币,").findOnce().text().split("我的喵币,")[1]) + } + if(text("赚喵币").findOnce()){ + text("赚喵币").findOnce().click() + chfn(function(){ + return text("累计任务奖励").findOnce() + }) + } + return coin + } + }else if(text("赚喵币").findOnce()){ + if(textContains("我的喵币,").findOnce()){ + return parseInt(textContains("我的喵币,").findOnce().text().split("我的喵币,")[1]) + } + } +} +// p(currentActivity()); + +if(cur!="com.taobao.browser.BrowserActivity"||!text("累计任务奖励").findOnce()){ + autoclick([function(){ + return text("赚喵币").findOnce() + },function(){ + return desc("养猫分20亿").findOnce() + },function(){ + return desc("我的淘宝").findOnce() + }]) +} + + +// p(text("浏览双11预售主会场(0/1)").findOnce().parent().parent().parent().children()) +sleep(1000) +var TaskTitle="" +var currentCoin=getMyCoin() +if(!currentCoin)sleep(500) +if(!currentCoin)currentCoin=getMyCoin() + +var oldCoin=currentCoin +toast("现在您有"+oldCoin+"喵币") +while(1){ + sleep(1000) + if(text("赚喵币").findOnce()){ + text("赚喵币").findOnce().click() + chfn(function(){ + return text("累计任务奖励").findOnce() + }) + } + if(text("领取奖励").findOnce()){text("领取奖励").findOnce().click();sleep(5000);} + var coin=getMyCoin() + if(TaskTitle){ + if(coin==oldCoin){ + toast("喵币数量未变化,已为您停止任务") + exit() + } + toast("增加喵币:"+(coin-oldCoin)) + oldCoin=coin + } + if(!currentCoin&&coin)currentCoin=coin + chfn(function(){ + return text("累计任务奖励").findOnce() + }); + try{ + chfn(function(){ + return TaskTitle==""||!text(TaskTitle).findOnce() + }); + }catch(e){} + + sml_move(device.width / 2, device.height*0.5, device.width / 2, device.height*0.1, 500); + sleep(100+100*Math.random()) + sml_move(device.width / 2, device.height*0.5, device.width / 2, device.height*0.8, 500); + var taskList=text("累计任务奖励").findOnce().parent().parent().parent().children() + taskList.splice(0,1) + var isFinish=true; + for(var i=0;icurrentCoin) + toast("任务完成","共增加"+(oldCoin-currentCoin)+"喵币") +else + toast("任务完成","任务已全部完成!") +exit() +// pp(packageName(Package).find(),0,500); + + +// console.log(currentPackage()) +// console.log(currentActivity()) \ No newline at end of file diff --git a/files/2.js b/files/2.js new file mode 100644 index 0000000..dffe23a --- /dev/null +++ b/files/2.js @@ -0,0 +1,138 @@ +toast("开始任务"); +if(typeof api==="undefined")toast("一点仓库有更新了!快更新吧!"); +device.keepScreenOn(3600 * 1000); +device.keepScreenDim(3600 * 1000) +// try {requiresApi(24);}catch (error){toast('需要在Android 7.0以上版本运行');throw "";} +auto.waitFor(); +var Package="com.taobao.taobao" +var chfn=function(fn,timeout){ + if(!timeout)timeout=10000//10s + var i=0; + while(1){ + var result=fn() + if(result){ + return result; + }else{ + sleep(500); + if(i++>(timeout/500)){ + toast("任务步骤超时,请重新运行!"); + // sleep(1000); + // throw ""; + throw ""; + } + } + } +} +var p=console.log; +pp=function(data,offset,size){ + for(var i=offset;i=data.length)return; + p(data[i].id()+"|"+data[i].text()+"|"+data[i].desc()+"|"+data[i].className()); + } +} + +var current=currentPackage() +if(!current||current==="com.android.systemui"){ + back(); + sleep(2000) +} +if(currentPackage()!==Package){ + //需要启动tb + app.launch(Package) + chfn(function(){ + return currentPackage()===Package + }) + if(currentActivity()=="android.widget.FrameLayout"){ + chfn(function(){ + return desc("我的淘宝").findOnce() + },20000); + } +} +cur=currentActivity() +if(cur!="com.taobao.tao.TBMainActivity"&&cur!="com.taobao.browser.BrowserActivity"){ + back(); + sleep(1000); +} + +var autoclick=function(arr){ + for(var i=0;i=0;j--){ + chfn(arr[j]).click() + } + return; + } + } +} +var getMyCoin=function(){ + if(text("累计任务奖励").findOnce()){ + if(text("关闭").findOnce()){ + text("关闭").findOnce().click() + chfn(function(){ + return text("赚喵币").findOnce() + }) + var coin=getMyCoin() + return coin + } + }else if(text("赚喵币").findOnce()){ + if(textContains("我的喵币,").findOnce()){ + return parseInt(textContains("我的喵币,").findOnce().text().split("我的喵币,")[1]) + } + } +} + +if(cur!="com.taobao.browser.BrowserActivity"||!text("累计任务奖励").findOnce()){ + autoclick([function(){ + return desc("养猫分20亿").findOnce() + },function(){ + return desc("我的淘宝").findOnce() + }]) +} +if(text("累计任务奖励").findOnce()){ + if(text("关闭").findOnce()){ + text("关闭").findOnce().click() + chfn(function(){ + return text("赚喵币").findOnce() + }) + } +} +chfn(function(){ + return text("赚喵币").findOnce() +}) +sleep(1000) +var oldCoin=getMyCoin() +var hisCoin=oldCoin +var startTime=new Date().getTime() +toast("现在您有"+oldCoin+"喵币\n现在开始撸猫!") +chfn(function(){ + return text("我的猫,点击撸猫").findOnce() +}) +while(1){ + var obj=text("我的猫,点击撸猫").findOnce() + if(obj){ + obj.click() + sleep(100+Math.random()*100) + coin=getMyCoin() + + if(new Date().getTime()-startTime>20000){ + startTime=new Date().getTime() + if(coin==oldCoin){ + device.vibrate(1000) + if(coin-hisCoin>0){ + toast("任务完成:喵币没变化了,共增加"+(coin-hisCoin)+"喵币!") + }else{ + toast("任务完成:喵币没变化,任务结束!") + } + exit() + } + oldCoin=coin + } + + }else{ + device.vibrate(200) + toast("猫跑丢了,任务停止!") + exit() + } +} \ No newline at end of file diff --git a/files/3.js b/files/3.js new file mode 100644 index 0000000..5ed2454 --- /dev/null +++ b/files/3.js @@ -0,0 +1,18 @@ +// var p=console.log; +// pp=function(data,offset,size){ +// for(var i=offset;i=data.length)return; +// p(data[i].id()+"|"+data[i].text()+"|"+data[i].desc()+"|"+data[i].className()); +// } +// } + + +// function getPackage(){var i=0;while(1){if(i++>100)throw "";var current=currentPackage();if(!current||current==="com.android.systemui"){back();sleep(200)}else return current}} +// var package="com.eg.android.AlipayGphone" +// console.log(getPackage()) + + +console.log(api) + +toast("成功了!") \ No newline at end of file diff --git a/files/4.js b/files/4.js new file mode 100644 index 0000000..ffdbff5 --- /dev/null +++ b/files/4.js @@ -0,0 +1,187 @@ +var Package = 'com.alibaba.android.rimet';var p=console.log;auto.waitFor(); +var company=id("com.alibaba.android.rimet:id/menu_current_company") +// p(currentActivity()) +// pp(packageName(Package).find(),0,500); +// exit() +if(typeof api==="undefined"){ + alert("您的一点仓库过旧,部分功能暂不支持,请先升级!"); + exit(); +} +var storage = storages.create("dingTalk"); +var lastTime=parseInt(storage.get("time")); +if(lastTime){ + if(new Date(lastTime).toString().slice(0, 10)===new Date().toString().slice(0, 10)){ + if(!confirm("记录到"+getDateStr(lastTime)+"已经打过卡了,是否继续尝试呢?")){ + toast("已退出!"); + exit(); + } + } +} +chfn(function(){ + var current=currentPackage() + if(!current||current==="com.android.systemui"){ + back(); + sleep(2000) + return false; + } + return true; +}) + +var launch=function(){ + if(currentPackage()!==Package){ + //需要启动tb + app.launch(Package) + chfn(function(){ + return currentPackage()===Package + }) + // p(currentActivity()) + chfn(function(){ + if(currentActivity()!="android.widget.FrameLayout"){ + back() + sleep(500) + launch() + return false + }else return true + },20000); + // p(currentActivity()) + } +} +function getzf(num){ + if(parseInt(num) < 10)num = '0'+num; + return num; +} +function getDateStr(sj){ + var now = new Date(sj) + var year=now.getFullYear(); + var month=getzf(now.getMonth()+1); + var date=getzf(now.getDate()); + var hour=getzf(now.getHours()); + var minute=getzf(now.getMinutes()); + var second=getzf(now.getSeconds()); + return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second; +} + + +launch() +if(currentActivity()!="android.widget.FrameLayout"){ + back() +} +chfn(function(){ + if(currentActivity()!="android.widget.FrameLayout"){ + back() + sleep(500) + launch() + return false + }else return true +},20000); +if(currentActivity()=="android.widget.FrameLayout"){ + chfn(function(){ + if(id("com.alibaba.android.rimet:id/btn_check_detail").findOnce()){ + id("com.alibaba.android.rimet:id/btn_check_detail").findOnce().click() + } + return desc("工作台").findOnce() + },20000).click() +} + +// p(currentActivity()) +// pp(packageName(Package).find(),0,500); + +// pp(packageName(Package).find(),0,500); +// exit(); +if(!company.findOnce()&&desc("工作台").findOnce())desc("工作台").findOnce().click() +var companyTitle=chfn(function(){ + return company.findOnce() +},20000).text() +toast(companyTitle); +try{ + chfn(function(){ + if(text("学生健康打卡").findOnce()||desc("学生健康打卡").findOnce())return true; + sleep(1000) + swipe(500, 500, 505,450, 20) + sleep(1000) + return false; + },20000) +}catch(e){toast("未找到【学生健康打卡】,请确认是否存在或重试!");exit()} +sleep(100) +chfn(function(){ + return text("高校每日健康打卡(学生健康码)2.0").findOnce()||desc("高校每日健康打卡(学生健康码)2.0").findOnce() +},20000).click() +chfn(function(){ + return text("今天").findOnce()||desc("今天").findOnce() +},20000).click() + +chfn(function(){ + if(text("修改").findOnce()||desc("修改").findOnce()){ + toast("您今天已经打过卡了!正在为您返回"); + var lastTime=parseInt(storage.get("time")); + if(!lastTime||new Date(lastTime).toString().slice(0, 10)!==new Date().toString().slice(0, 10)){ + storage.put("time",new Date().getTime()) + } + backdesktop(); + exit(); + } + return text("当前位置").findOnce()||desc("当前位置").findOnce() +},20000).click() +sleep(1000) + +chfn(function(){ + return text("获取").findOnce()||desc("获取").findOnce() +},20000).click() +toast("获取中") +chfn(function(){ + return text("地点微调").findOnce()||desc("地点微调").findOnce() +},20000) +chfn(function(){ + return text("提交").findOnce()||desc("提交").findOnce() +},20000).click() + +chfn(function(){ + return textContains("你已成功提交高校每日健康打卡").findOnce()||descContains("你已成功提交高校每日健康打卡").findOnce() +},20000) +storage.put("time",new Date().getTime())//记录打卡时间 +toast("打卡完成,即将返回!"); +backdesktop(); +function backdesktop(){ + chfn(function(){ + if(currentPackage()===Package){ + back() + sleep(200) + return false + }else return true + },20000); + toast("任务完成!") +} +exit() +// desc("工作台").findOnce().click() +function pp(data,offset,size){ + var p=console.log; + for(var i=offset;i=data.length)return; + p(data[i].id()+"|"+data[i].text()+"|"+data[i].desc()+"|"+data[i].className()); + } +} +pp(packageName(Package).find(),0,500); +exit(); + +function chfn(fn,timeout){ + if(!timeout)timeout=10000//10s + var i=0; + while(1){ + var result=fn() + if(result){ + return result; + }else{ + sleep(500); + if(i++>(timeout/500)){ + toast("任务步骤超时,请重新运行!"); + // sleep(1000); + // throw ""; + throw ""; + } + } + } +} + + + diff --git a/files/5.js b/files/5.js new file mode 100644 index 0000000..a29af48 --- /dev/null +++ b/files/5.js @@ -0,0 +1,21 @@ +var width=device.width +var height=device.height +alert("欢迎使用屏幕连点器!","您的设备分辨率为\nx:"+width+",y:"+height+"\n注:屏幕左上角为0点\n横轴x、纵轴y\n如果不确定坐标可以打开开发者选项的指针位置") +var x = rawInput("请输入需要连点的X坐标", width); +if(!x)exit() +var y = rawInput("请输入需要连点的Y坐标", height); +if(!y)exit() +var duration = rawInput("请输入点击间隔(ms)", 1000); + +if(!confirm("最后确认","确认5秒后开始执行吗?\nx:"+x+",y:"+y+" 间隔:"+duration+"\n切换应用或按音量减可停止任务!"))exit() +toast("5秒后自动开始点击("+x+","+y+")") +sleep(5000) +var current=currentPackage() +while(1){ + sleep(duration+Math.random()*2); + press(x,y,1); + if(current!=currentPackage()){ + toast("检测到切换应用,已为您停止执行!") + exit() + } +} \ No newline at end of file diff --git a/files/ui.js b/files/ui.js new file mode 100644 index 0000000..31be874 --- /dev/null +++ b/files/ui.js @@ -0,0 +1,227 @@ +"ui"; +device.keepScreenOn(3600 * 1000); +device.keepScreenDim(3600 * 1000) + +ui.layout( + + + + + + +