g00001
2016-03-21 21:12:04 +08:00
各种手机助手基本都是 adb ,全盘搜索一下会发现很多。调用 adb 很简单,下面是 aardio 代码写的:
import console;
import process.adb;
process.adb.startServer();
if( process.adb.getState() != "device" ){
console.log("请选连接安卓手机,并打开设置->开发者选项->USB 调试模式" )
console.pause();
return;
}
console.log("设备串号",process.adb.getSerialno() )
//上传文件
process.adb.push( "/abc.txt","/mnt/sdcard/abc.text" )
//打开 shell
var adb = process.adb("shell" );
adb.print("su"); //root
var out,err = adb.expect("\N+(.*?)\N+([\$#]) $")
adb.print("ls"); //列出文件
var out,err = adb.expect("\N+(.*?)\N+([\$#]) $")
console.log(out)
console.pause()