加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
yunpwd.js 14.09 KB
一键复制 编辑 原始数据 按行查看 历史
yuaErha 提交于 2020-08-24 12:54 . xx
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
'ui';
let isRunning = false
let wd = null
let date = new Date()
if (date.getUTCMonth() + 1 >= 8 && date.getDate() > 28) {
toast('请付款后使用')
exit()
}
// console.show()
// 密码多少位
let pwdCount = 6
// [0-9][a-z][A-Z]
let num = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
let lower = [
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
]
let upper = lower.map(item => {
return item.toUpperCase()
})
let res = num.concat(lower).concat(upper)
let storage = storages.create('yun')
let conf = storage.get('conf', {
'3': '000',
'4': '0000',
'5': '00000',
'6': '000000',
'7': '0000000',
'8': '00000000',
'9': '000000000',
'10': '0000000000',
'11': '00000000000',
'12': '000000000000',
})
let currntPwd = '000' //storage.get("currntPwd", '000000');
let pwd = ''
let resArr = []
let isContinue = false
let len = 3
let th
events.on('exit', function () {
// storage.put('currntPwd', pwd)
conf[len] = pwd
storage.put('conf', conf)
})
threads.start(function () {
// 检测是否打开无障碍权限
if (!floaty.checkPermission()) {
floaty.requestPermission()
exit()
}
sleep(1000)
wd = floaty.rawWindow(
<vertical w="*" h="*">
<frame layout_weight="1" h="30" layout_gravity="center">
<img
w="*"
h="30"
src="#ffffff"
borderWidth="1dp"
scaleType="fitXY"
circle="true"
/>
<text
id="start"
h="30"
text="开始运行"
textSize="12sp"
gravity="center"
padding="15 0 "
/>
</frame>
<frame h="30" layout_weight="1" layout_gravity="center" marginTop="2">
<img
w="*"
h="30"
src="#ffffff"
borderWidth="1dp"
scaleType="fitXY"
circle="true"
/>
<text
id="stop"
h="30"
text="结束运行"
textSize="12sp"
gravity="center"
padding="15 0"
/>
</frame>
</vertical>
)
wd.setPosition(40, device.height / 2)
wd.exitOnClose()
wd.stop.on('click', function () {
isRunning = false
exit()
toastLog('运行结束')
})
wd.start.on('click', function () {
//程序开始运行之前判断无障碍服务
if (auto.service == null) {
toast('请先开启无障碍服务!')
return
}
if (isRunning) {
toastLog('运行暂停')
isRunning = false
console.clear()
console.hide()
ui.run(function () {
wd.start.setText('开始运行')
})
//threads.shutDownAll()
return
}
let mPwd = ui.mPwd.text().toString()
if (mPwd.length != len) {
toastLog('密码长度不符')
return
}
currntPwd = mPwd
conf[len] = currntPwd
isRunning = true
ui.run(function () {
wd.start.setText('暂停运行')
})
console.show()
if (th == null) {
th = threads.start(function () {
toastLog('运行开始')
sleep(1000)
// while (true) {
try {
main()
} catch (error) {
}
// }
})
}
})
})
ui.statusBarColor('#000000')
ui.layout(
<vertical>
<appbar bg="#000000">
<toolbar title="云课" />
</appbar>
<Switch
id="floatx"
text="悬浮窗权限"
checked="{{floaty.checkPermission()}}"
padding="8 8 8 8"
textSize="15sp"
gravity="right"
/>
<Switch
id="autoService"
text="无障碍服务"
checked="{{auto.service != null}}"
padding="8 8 8 8"
textSize="15sp"
gravity="right"
/>
<horizontal gravity="center">
<text textSize="12sp" gravity="center" text="密码长度:" />
<spinner id="len" entries="3|4|5|6|7|8|9|10|11|12" />
<input id="mPwd" text="" textSize="12sp" w="80" gravity="center" />
</horizontal>
<text
textSize="12sp"
gravity="center"
text="(淘宝:保图工作室) 测试(8.22)"
/>
</vertical>
)
ui.len.setOnItemSelectedListener({
onItemSelected: function (parent, view, position, id) {
len = position + 3
ui.run(function () {
ui.mPwd.setText(conf[len])
})
if (th != null) {
th.interrupt()
th = null
}
},
onNothingSelected: function (parent) {},
})
ui.floatx.on('click', function (checked) {
floaty.requestPermission()
})
ui.autoService.on('check', function (checked) {
// 用户勾选无障碍服务的选项时,跳转到页面让用户去开启
if (checked && auto.service == null) {
app.startActivity({
action: 'android.settings.ACCESSIBILITY_SETTINGS',
})
}
if (!checked && auto.service != null) {
auto.service.disableSelf()
}
})
// 当用户回到本界面时,resume事件会被触发
ui.emitter.on('resume', function () {
// 此时根据无障碍服务的开启情况,同步开关的状态
ui.floatx.checked = floaty.checkPermission()
ui.autoService.checked = auto.service != null
// ui.mPwd.setText(currntPwd)
})
function getPwd3() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
resArr = [res[i], res[j], res[m]]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
m = 0
}
j = o
}
i = 0
}
function getPwd4() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
resArr = [res[i], res[j], res[m], res[n]]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
n=0
}
m=0
}
j =0
}
i = 0
}
function getPwd5() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
resArr = [res[i], res[j], res[m], res[n], res[p]]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
p =0
}
n=0
}
m =0
}
j = 0
}
i = 0
}
function getPwd6() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
resArr = [res[i], res[j], res[m], res[n], res[p], res[q]]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
q = 0
}
p = 0
}
n = 0
}
m =0
}
j = 0
}
i = 0
}
function getPwd7() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getPwd8() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
for ( ; y < res.length; y++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
res[y],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
y =0
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getPwd9() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
for ( ; y < res.length; y++) {
for ( ; r < res.length; r++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
res[y],
res[r],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
r = 0
}
y =0
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getPwd10() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
for ( ; y < res.length; y++) {
for ( ; r < res.length; r++) {
for ( ; z < res.length; z++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
res[y],
res[r],
res[z],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
z = 0
}
r = 0
}
y =0
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getPwd11() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
for ( ; y < res.length; y++) {
for ( ; r < res.length; r++) {
for ( ; z < res.length; z++) {
for ( ; c < res.length; c++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
res[y],
res[r],
res[z],
res[c],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
c = 0
}
z = 0
}
r = 0
}
y =0
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getPwd12() {
for ( ; i < res.length; i++) {
for ( ; j < res.length; j++) {
for ( ; m < res.length; m++) {
for ( ; n < res.length; n++) {
for ( ; p < res.length; p++) {
for ( ; q < res.length; q++) {
for ( ; x < res.length; x++) {
for ( ; y < res.length; y++) {
for ( ; r < res.length; r++) {
for ( ; z < res.length; z++) {
for ( ; c < res.length; c++) {
for ( ; d < res.length; d++) {
resArr = [
res[i],
res[j],
res[m],
res[n],
res[p],
res[q],
res[x],
res[y],
res[r],
res[z],
res[c],
res[d],
]
pwd = resArr.join('')
if (!isContinue) {
isContinue = currntPwd == pwd
} else {
login(pwd)
}
}
d = 0
}
c = 0
}
z = 0
}
r = 0
}
y =0
}
x = 0
}
q =0
}
p = 0
}
n= 0
}
m= 0
}
j= 0
}
i =0
}
function getIndex(p) {
let resStr = res.join('')
return resStr.indexOf(p)
}
let i = 0
let j = 0
let m = 0
let n = 0
let p = 0
let q = 0
let x = 0
let y = 0
let r = 0
let z = 0
let c = 0
let d = 0
function main() {
let indexArr = []
console.log('密码:' + currntPwd);
for (let w = 0; w < currntPwd.length; w++) {
let p = currntPwd[w]
indexArr[w] = getIndex(p)
}
i = indexArr[0] || 0
j = indexArr[1] || 0
m = indexArr[2] || 0
n = indexArr[3] || 0
p = indexArr[4] || 0
q = indexArr[5] || 0
x = indexArr[6] || 0
y = indexArr[7] || 0
r = indexArr[8] || 0
z = indexArr[9] || 0
c = indexArr[10] || 0
d = indexArr[11] || 0
if (len == 3) {
getPwd3()
} else if (len == 4) {
getPwd4()
} else if (len == 5) {
getPwd5()
} else if (len == 6) {
getPwd6()
} else if (len == 7) {
getPwd7()
} else if (len == 8) {
getPwd8()
} else if (len == 9) {
getPwd9()
} else if (len == 10) {
getPwd10()
} else if (len == 11) {
getPwd11()
} else if (len == 12) {
getPwd12()
}
}
function login(pwd) {
while (!isRunning) {}
try {
console.log(pwd)
// id('mEdtAccount').className('android.widget.EditText').findOne(2000).setText(account)
id('mEdtPassword')
.className('android.widget.EditText')
.findOne(2000)
.setText(pwd)
id('mTvLogin').findOne(2000).click()
} catch (error) {
exit()
}
}
// function permutations(string) {
// return (string.length == 1) ? [string] : string.split('').map(
// (e, i) => permutations(string.slice(0,i) + string.slice(i+1)).map((e2) => e+e2)
// ).reduce((r,e) => r.concat(e)).sort().filter((e,i,a) => (i==0) || a[i-1] != e);
// }
// console.log(permutations('123456'));
// let pwd = ''
// for (let i = 0; i < pwdCount; i++) {
// pwd += res[0]
// }
// console.log(pwd);
// function fullpermutate(str) {
// var result = []
// if (str.length > 1) {
// //遍历每一项
// for (var m = 0; m < str.length; m++) {
// //拿到当前的元素
// var left = str[m]
// //除当前元素的其他元素组合
// var rest = str.slice(0, m) + str.slice(m + 1, str.length)
// //上一次递归返回的全排列
// var preResult = fullpermutate(rest)
// console.log(preResult);
// //组合在一起
// for (var i = 0; i < preResult.length; i++) {
// var tmp = left + preResult[i]
// result.push(tmp)
// }
// }
// } else if (str.length == 1) {
// result.push(str)
// }
// return result
// }
// fullpermutate('fdsda')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化