first commit

This commit is contained in:
编码猿
2024-09-27 01:26:21 +08:00
commit 63459fdc40
12 changed files with 148 additions and 0 deletions

23
.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

1
.pydio Normal file
View File

@@ -0,0 +1 @@
0bf40545-e6e5-4371-b0fe-6e41a7e2fbda

BIN
ADBKeyboard.apk Normal file

Binary file not shown.

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
https://github.com/senzhk/ADBKeyBoard
1adb shell input tap 985 1213 点击点赞
2adb shell input swipe 271 1733 208 516 从底部坐标滑到顶部坐标,滑动切换视频
adb shell input tap 149 552 从桌面打开抖音App的坐标
adb shell input tap 992 1460 点击评论图标,打开评论弹窗
adb shell input tap 347 2175 点击输入框,获得输入框焦点
adb shell input text test(废弃) 在输入框输入文字(不支持中文)
adb shell am broadcast -a ADB_INPUT_TEXT --es msg '随机评论的中文字'
adb shell input tap 1007 1854 点击发送按钮
//package:com.android.adbkeyboard

1
config/.pydio Normal file
View File

@@ -0,0 +1 @@
fc3940ae-ad6b-4e14-945c-7d3b195ddf08

27
config/index.js Normal file
View File

@@ -0,0 +1,27 @@
const config = {
// 基础命令
baseShell: {
adbkeyboard: 'adb shell pm list packages adbkeyboard',
adb: 'adb version'
},
// 功能性命令
shellAction: {
// 点击输入框
tap: 'adb shell input tap',
// 滑动页面
swipe: 'adb shell input swipe',
},
// 坐标集合
shellCoordinate: {
// 先点赞,然后滑动下一个视频
Fabulous: {
tap: '988 1229', // 点赞按钮的坐标
swipe: '868 1811 800 272', // 滑动页面
}
},
startShell: (action, coordinate) => {
return `${config.shellAction[action]} ${coordinate}`
}
}
module.exports = config

14
index.js Normal file
View File

@@ -0,0 +1,14 @@
const config = require("./config");
const utils= require("./utils");
for (const key in config.shellCoordinate.Fabulous) {
let shell = config.startShell(key, config.shellCoordinate.Fabulous[key])
console.log(shell)
setInterval(async ()=> {
console.log(await utils.execShell(shell))
},1500)
}
// utils.CheckInstallAdb().then(res => {
// console.log(res)
// })

1
shell/.pydio Normal file
View File

@@ -0,0 +1 @@
4f3298b7-6a94-46ec-928b-7ba7afe08f60

2
shell/comment.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
echo "你好"

8
test.js Normal file
View File

@@ -0,0 +1,8 @@
const exec = require('child_process').exec;
exec('pwd', function(err,stdout,stderr) {
if(err) {
console.log('shell is run: '+ stderr);
} else {
console.log(stdout)
}
});

1
utils/.pydio Normal file
View File

@@ -0,0 +1 @@
358a802d-b623-4739-bde0-48834194aec5

55
utils/index.js Normal file
View File

@@ -0,0 +1,55 @@
const exec = require('child_process').exec;
const config = require('../config');
class Utils{
/**
* 运行命令
* @param cmdStr
* @returns {Promise<unknown>}
*/
execShell (cmdStr) {
return new Promise((resolve,reject)=> {
exec(cmdStr, function(err,stdout,stderr) {
if(err) {
console.log('shell is run: '+ stderr);
} else {
resolve(stdout)
}
});
})
}
/**
* 检查是否安装 ADBKeyboard.apk app
* 否则无法输入中文
* @constructor
*/
async CheckAdbKeyboard() {
let res = await this.execShell(config.baseShell.adbkeyboard);
if (res.indexOf("com.android.adbkeyboard") > -1) {
return true
} else {
console.error("请先安装 ADBKeyboard.apk")
return false
}
}
/**
* 检查是否安装adb
* @returns {Promise<void>}
* @constructor
*/
async CheckInstallAdb() {
let res = await this.execShell(config.baseShell.adb)
if (res.indexOf("Android Debug Bridge version") > -1) {
return true
} else {
console.error("请先在PC电脑上安装adb工具")
return false
}
}
}
module.exports = new Utils();