加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mgsh.js 14.20 KB
一键复制 编辑 原始数据 按行查看 历史
鹤鸣悠香 提交于 2020-09-26 14:42 . update mgsh.js.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
//破解,源码出售1906507927
"ui";
ui.layout(
<vertical padding="16">
<text textSize="10sp" textColor="black" text="定制版 autojs源码提取,加密打包,代码解密,还原.九黎QQ1906507927" />
{/* <input id="cardNo" text="" /> */}
<text textSize="16sp" textColor="black" text="请输入美国号" />
<input id="phoneNo" text="" />
<text textSize="16sp" textColor="black" text="请输入接码地址" />
<input id="codeUrl" text="" />
<text textSize="16sp" textColor="black" text="请输入修改密码" />
<input id="password" text="" />
<button id="ok" text="确定" />
<text marginTop="50px" text="日志" />
<com.stardust.autojs.core.console.ConsoleView id="console" h="*" />
</vertical>
);
ui.console.setConsole(runtime.console);
// 设置控制台字体颜色
let c = new android.util.SparseArray();
let Log = android.util.Log;
c.put(Log.VERBOSE, new java.lang.Integer(colors.parseColor("#dfc0c0c0")));
c.put(Log.DEBUG, new java.lang.Integer(colors.parseColor("#cc000000")));
c.put(Log.INFO, new java.lang.Integer(colors.parseColor("#ff64dd17")));
c.put(Log.WARN, new java.lang.Integer(colors.parseColor("#ff2962ff")));
c.put(Log.ERROR, new java.lang.Integer(colors.parseColor("#ffd50000")));
c.put(Log.ASSERT, new java.lang.Integer(colors.parseColor("#ffff534e")));
ui.console.setColors(c);
var phoneNo = "";
var codeUrl = "";
var password = "";
var lastCode = "";
var cardNo = "";//激活码
var localStorage = storages.create("autoLoginDy");
loadCache();
function saveCache() {
var cacheData = {
phoneNo: phoneNo,
codeUrl: codeUrl,
password: password,
cardNo: cardNo,
}
log("save cache")
log(cacheData)
localStorage.put("cacheData", cacheData);
}
function loadCache() {
var defaultCacheData = {
phoneNo: "",
codeUrl: "",
password: "plm123456",
cardNo: "",
}
var cacheData = localStorage.get("cacheData", defaultCacheData);
log("load cache")
log(cacheData)
initData(cacheData);
}
function initData(cacheData) {
phoneNo = cacheData.phoneNo;
codeUrl = cacheData.codeUrl;
password = cacheData.password;
cardNo = cacheData.cardNo;
ui.phoneNo.setText(phoneNo);
ui.codeUrl.setText(codeUrl);
ui.password.setText(password);
//ui.cardNo.setText(cardNo);
}
//监听音量上键按下
events.onKeyDown("volume_up", function(event){
toast("停止脚本");
// exit();
home();
engines.stopAll();
});
//监听菜单键按下
events.onKeyDown("volume_down", function(event){
toast("停止脚本");
// exit();
home();
engines.stopAll();
});
//指定确定按钮点击时要执行的动作
ui.ok.click(function () {
// localStorage.put("url",ui.url.getText().toString());
// saveCache();
threads.start(function () {
sleep(1000)
toastLog("开始")
start_shanghao();
return ;
});
});
function start_shanghao() {
log("请确保开启无障碍服务哦~")
auto.waitFor()
//启用按键监听
events.observeKey();
// setScreenMetrics(1080, 2340);
// requestScreenCapture(false);
phoneNo = ui.phoneNo.getText().toString();
codeUrl = ui.codeUrl.getText().toString();
password = ui.password.getText().toString();
saveCache()
app.launchApp("抖音短视频")
loginjisu();
//changePass();
//app.launchApp("抖音短视频")
// sleep(5000);
//logindy();
toastLog("登陆成功")
}
function logindy() {
toastLog("开始登陆抖音")
for (var i = 0; i < 5; i++) {
if(text("").exists()){
break;
}
sleep(1000);
}
myWaitFor(text("同意"), 2);
if (clickUiBounds(text("同意"))) {
sleep(1000)
}
click(500, 500)
for (var i = 0; i < 10; i++) {
if (!text("输入手机号码").exists()) {
toastLog("返回到首页操作")
if (text("").exists()) {
clickUiBounds(text(""))
sleep(1000);
break;
}
click(device.width - 150, device.height - 50);
sleep(100)
back();
sleep(1000);
clickUiBounds(text("以后再说"))
} else {
break;
}
}
clickUiBounds(text(""))
myWaitFor(text("密码登录"), 5);
clickUiBounds(text("密码登录"))
myWaitFor(text("输入手机号码"), 5);
click(130, 380);
// if (text("输入手机号码").exists()) {
// var a = text("输入手机号码").findOne();
// var bounds = a.bounds();
// click(130, bounds.centerY());
// }
sleep(2000);
toastLog("选择国家")
var a = text("搜索国家和地区").findOne();
var bound = a.bounds();
text("搜索国家和地区").setText("美国");
sleep(500)
click(device.width - 50, bound.centerY())
sleep(500);
clickUiBounds(text("+1"));
sleep(1000);
toastLog("输入手机号码和密码")
setText(0, phoneNo);
setText(1, password);
sleep(1000);
if(!clickUiBounds(id("cmc"))){
click(130,690);
}
sleep(1000);
click(device.width / 2, 800)
sleep(5000);
if(text("+1").exists()){
if(!clickUiBounds(id("cmc"))){
click(130,690);
}
sleep(1000);
click(device.width / 2, 800)
}
}
function changePass() {
toastLog("开始修改密码")
back();
sleep(1000);
back();
for (var i = 0; i < 10; i++) {
if (text("").exists()) {
break;
}
sleep(1000);
back();
}
clickUiBounds(text(""));
myWaitFor(text("获赞"));
// var a = text("分享主页").findOne()
// var bounds = a.bounds();
// click(bounds.centerX() + 200, bounds.centerY());
sleep(1000)
// click(650,100);
swipe(device.width - 100, 450, 100, 450, 500);
sleep(1000)
myWaitFor(text("设置"));
clickUiBounds(text("设置"));
sleep(1000)
// myWaitFor(text("账号管理"));
// clickUiBounds(text("账号管理"));
// myWaitFor(text("更改密码"));
// clickUiBounds(text("更改密码"));]
toastLog("等待账号与安全出现。。。")
myWaitFor(text("帐号与安全"));
toastLog("等待2222")
clickUiBounds(text("帐号与安全"));
sleep(1000)
myWaitFor(text("抖音密码"));
clickUiBounds(text("抖音密码"));
sleep(1000)
myWaitFor(text("设置新的登录密码"));
setText(password);
sleep(1000)
// toastLog(id("w7").exists())
// clickUiBounds(id("w7"))
click(380, 850)
//1234
for (var i = 0; i < 50; i++) {
var code = getCode("密码");
if (code && code != lastCode) {
lastCode = code;
toastLog("尝试输入密码")
setText(code);
sleep(1000);
// clickUiBounds(id("w7"))
click(360, 860)
sleep(3000);
break;
}
sleep(3000);
}
}
function loginjisu() {
toastLog("好的。。。")
myWaitForTwo(text("我知道了"), text("好的"));
sleep(1000)
if (text("我知道了").exists()) {
clickUiBounds(text("我知道了"));
}
if (text("好的").exists()) {
clickUiBounds(text("好的"));
}
//
toastLog("点击好的")
toastLog("等待修改登陆地区")
myWaitForTwo(text("38.00"), text(""), 5);
sleep(1000)
if (text("38.00").exists()) {
// var a = text("38.00").findOne();
// var bounds = a.bounds();
// click(bounds.centerX(), bounds.centerY() + 300);
click(300,800)
}
toastLog("如果在首页")
if (text("").exists()) {
clickUiBounds(text(""))
}
myWaitFor(text("请输入手机号"), 5);
for (var i = 0; i < 10; i++) {
if (!text("请输入手机号").exists()) {
if (text("38.00").exists()) {
// var a = text("38.00").findOne();
// var bounds = a.bounds();
// click(bounds.centerX(), bounds.centerY() + 300);
click(300,800)
}
toastLog("如果没有38金币,则返回到首页操作")
if (text("").exists()) {
clickUiBounds(text(""))
sleep(1000);
break;
}
click(device.width - 150, device.height - 50);
sleep(100)
back();
sleep(1000);
} else {
break;
}
}
if (text("请输入手机号").exists()) {
var a = text("请输入手机号").findOne();
var bounds = a.bounds();
click(100, bounds.centerY());
sleep(1000);
}
if(text("密码登录").exists()){
clickUiBounds(100,400)
sleep(1000);
}
for (var i = 0; i < 100; i++) {
swipe(device.width / 2, device.height - 100, device.width / 2, 300, 200);
sleep(2000);
if (text("美国").exists()) {
sleep(100);
clickUiBounds(text("美国"));
break;
}
}
sleep(500);
text("请输入手机号").setText(phoneNo);
clickUiBounds(text("获取短信验证码"));
var dianjiyanzhengma = text("点击选中两个相同形状的物体");
myWaitForTwo(dianjiyanzhengma, desc("刷新"), 3);//desc = 刷新
for (var i = 0; i < 30; i++) {
toastLog("等待输入验证....")
if (!dianjiyanzhengma.exists() && text("请输入验证码").exists()) {
break;
}
sleep(2000);
}
for (var i = 0; i < 50; i++) {
//1234
// clickUiBounds(text("获取验证码"))
toastLog("已经进入验证码界面")
sleep(3000)
//点击收不到短信
if (text("收不到短信?获取语音验证码").exists()) {
var a = text("收不到短信?获取语音验证码").findOnce();
if (a) {
var b = a.bounds();
if (b) {
log(b)
click(b.centerX()+50, b.centerY());
//这里点击语音验证码,向中心点右边便宜50
return true;
}
}
}
var code = getCode("登录");
if (code && code != lastCode) {
lastCode = code;
toast("尝试输入密码")
//code
text("请输入验证码").id("eks").setText(code);
sleep(100);
var a = text("我已阅读并同意 用户协议 和 隐私政策").findOne();
var bounds = a.bounds();
click(bounds.centerX() - 50, bounds.centerY());
sleep(1000);
clickUiBounds(text("登录"))
break;
}
sleep(3000);
}
toastLog("登录成功!!!");
}
function getCode(containsStr) {
//这里写接码
log(codeUrl)
var r = "";
try {
r = http.get(codeUrl);
}
catch (err) {
toastLog(err);
return "";
}
//var str = {};
var str=r.body.string();
//toastLog(str);
//直接获取网页字符串作为返回,你说是直接返回验证码
var result = str
toastLog(result);
return result;
}
/**
* 不能点击的控件,通过坐标点击
* @param {*} uiSelector
*/
function clickUiBounds(ui) {
if (ui.exists()) {
var a = ui.findOne();
if (a) {
var b = a.bounds();
if (b) {
click(b.centerX(), b.centerY());
return true;
}
}
}
return false;
}
function clickUi(ui) {
if (ui.exists()) {
ui.findOne().click() //推送弹框
return true;
}
return false;
}
function getRandom(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function exitApp() {
for (var i = 0; i < 5; i++) {
back()
sleep(200)
}
}
function checkAppOpened(pname) {
if (!packageName(pname).exists()) {
app.launchPackage(pname);
sleep(5000);
}
}
function myWaitFor(ui, times) {
times = times | 10
for (var i = 0; i < times; i++) {
if (ui.exists()) {
sleep(200);
return true;
}
sleep(1000);
}
return false;
}
function myWaitForTwo(ui, ui2, times) {
if (!times) {
times = 10
}
for (var i = 0; i < times; i++) {
if (ui.exists() || ui2.exists()) {
sleep(200);
return true;
}
sleep(1000);
}
return false;
}
function commonWatchVideo(times) {
times = times | 15;
for (var i = 0; i < times; i++) {
log("观看视频" + i)
sleep(2000);
}
back()
sleep(1000)
}
function skipOpenAppAd(times) {
imes = times | 10;
for (var i = 0; i < times; i++) {
if (clickUiBounds(text("跳过")) || clickUiBounds(desc("跳过"))) {
break;
}
sleep(1000);
}
}
function captureAndSave(path) {
if (!path) {
path = "/sdcard/screenshot.png";
}
//请求截图
// requestScreenCapture(false);
//截图
var im = captureScreen();
// var path = "/sdcard/screenshot.png";
//保存图片
im.saveTo(path);
//把图片加入相册
media.scanFile(path);
return im;
}
function simulateSysCapture(path) {
if (!path) {
path = path = "/storage/emulated/0/Pictures/Screenshots/Screenshot_20200113-123456.png";
}
if (files.exists(path)) {
files.removeDir(path)
media.scanFile(path);
}
sleep(1000)
captureAndSave(path)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化