<!DOCTYPE html>
<html>
<head>
<title>WebADB | Android Debug Bridge WebApp</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="WebUSB based Android Debug Bridge (adb) host" />
<meta name="keywords" content="adb, webusb, android adb, adb host, adb webapp" />
<link rel="manifest" href="manifest-webadb.json" />
<link rel="stylesheet" type="text/css" href="https://www.w3schools.com/w3css/3/w3.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script>
<script src="./adb.js"></script>
</head>
<body>
<form>
<div id="nowebusb" class="w3-container w3-block w3-sand w3-border w3-border-red w3-left-align w3-round" style="display: none">
<p>
Ouch!
<a href="https://wicg.github.io/webusb">WebUSB API</a> is not supported by your browser.
<br> Chrome users may update to version 61.
</p>
</div>
<div id="disclaimer" data-bind="visible: true" class="w3-container w3-block w3-sand w3-border w3-border-orange w3-left-align w3-round"
style="display: none">
<p>
This
<span data-bind="text: is_webapp() ? 'application' : 'page'"></span> uses the
<a href="https://developer.android.com/studio/command-line/adb.html">ADB</a> protocol over
<a href="https://wicg.github.io/webusb">WebUSB</a> to access the Android device connected to your PC via USB. The whole elaboration is done locally
and under your complete responsibility.
<br>
</p>
<p>
<a href="https://labs.mwrinfosecurity.com/blog/webusb/">What could possibly go wrong?</a>
</p>
</div>
<div data-bind="visible: 'usb' in navigator" class="w3-container w3-block w3-sand w3-border w3-border-blue w3-left-align w3-round"
style="display: none">
<p>
<div class="w3-container w3-cell w3-cell-middle">
<input type="button" data-bind="click: connect_usb, enable: is_connect_disconnect_enabled(), value: connect_disconnect_value()"
class="w3-button w3-green" />
</div>
<div class="w3-container w3-cell w3-cell-middle">
<span data-bind="text: connect_message, visibile: connect_message() != ''"></span>
</div>
</p>
</div>
<div data-bind="visible: is_execute_visible()" class="w3-container w3-block w3-sand w3-border w3-border-blue w3-left-align w3-round"
style="display: none">
<p>
<div class="w3-container w3-cell w3-cell-middle">
<input type="button" data-bind="click: push_usb, enable: is_execute_enabled() && adb && push_files().length" class="w3-button w3-green"
value="Push" />
</div>
<div class="w3-container w3-cell w3-cell-middle" style="width: 50%">
<input type="file" data-bind="event: { change: on_file_select }, enable: is_execute_enabled() && adb" class="w3-input w3-border w3-round"
/>
</div>
<!-- div class="w3-container w3-cell w3-cell-middle" style="width: 20%">
<input type="text" data-bind="numeric, value: push_mode, enable: is_execute_enabled() && adb" class="w3-input w3-border w3-round"/>
</div -->
<div class="w3-container w3-cell w3-cell-middle" style="width: 50%">
<input type="text" data-bind="value: push_dest, enable: is_execute_enabled() && adb" class="w3-input w3-border w3-round"
/>
</div>
</p>
<p>
<div class="w3-container w3-cell w3-cell-middle">
<input type="button" data-bind="click: pull_usb, enable: is_execute_enabled() && adb" class="w3-button w3-green" value="Pull"
/>
</div>
<div class="w3-container w3-cell w3-cell-middle" style="width: 100%">
<input type="text" data-bind="value: pull_filename, enable: is_execute_enabled() && adb" class="w3-input w3-border w3-round"
/>
</div>
</p>
<p>
<div class="w3-container w3-cell w3-cell-middle">
<input type="button" data-bind="click: stat_usb, enable: is_execute_enabled() && adb" class="w3-button w3-green" value="Stat"
/>
</div>
<div class="w3-container w3-cell w3-cell-middle" style="width: 100%">
<input type="text" data-bind="value: stat_filename, enable: is_execute_enabled() && adb" class="w3-input w3-border w3-round"
/>
</div>
</p>
<p>
<div class="w3-container w3-cell w3-cell-middle">
<input type="submit" data-bind="click: execute_usb, enable: is_execute_enabled()" class="w3-button w3-green" value="Send"
/>
</div>
<div class="w3-container w3-cell w3-cell-middle" style="width: 100%">
<input type="text" data-bind="value: execute_cmd, enable: is_execute_enabled(), hasFocus: is_execute_enabled()" class="w3-input w3-border w3-round"
/>
</div>
</p>
</div>
<div data-bind="visible: is_cancel_visible(), style: { visibility: 'visible' }" class="w3-container w3-block w3-sand w3-border w3-border-blue w3-left-align w3-round"
style="visibility: hidden">
<p>
<pre data-bind="text: execute_output, visible: execute_output() != ''" style="font-size: 0.75em"></pre>
<div class="w3-container w3-cell w3-cell-middle">
<input type="button" data-bind="click: cancel_usb, enable: is_cancel_enabled(), hasFocus: is_cancel_enabled()" class="w3-button w3-green"
value="Cancel" />
</div>
</p>
</div>
<span id="bottom"></span>
</form>
<script>
var params = location.search.substring(1).split("&");
var is_webapp = false;
var webusb = null;
var adb = null;
var fastboot = null;
var shell = null;
var sync = null;
for (p in params) {
var pair = params[p].split("=");
if (pair[0] == "debug" && pair[1] == "yes")
Adb.Opt.debug = true;
if (pair[0] == "dump" && pair[1] == "yes")
Adb.Opt.dump = true;
if (pair[0] == "reuse_key")
Adb.Opt.reuse_key = (pair[1] == "yes") ? true : (pair[1] == "no") ? false : parseInt(pair[1]);
if (pair[0] == "webapp")
is_webapp = (pair[1] == "yes");
}
function removeElementById(id) {
let node = document.getElementById(id);
if (node != null)
node.parentNode.removeChild(node);
}
async function disconnect_usb() {
if (shell != null)
shell.close();
if (sync != null)
await sync.abort();
webusb.close();
webusb = null;
}
async function connect_usb() {
try {
if (webusb != null) {
this.state("disconnecting");
disconnect_usb();
this.state("ready");
return;
} else {
this.state("connecting");
webusb = await Adb.open("WebUSB");
}
if (!webusb || !(webusb.isAdb() || webusb.isFastboot()))
throw new E
没有合适的资源?快使用搜索试试~ 我知道了~
WebUSB项目adb.js
共8个文件
js:2个
svg:2个
html:2个
需积分: 8 0 下载量 49 浏览量
2023-04-07
10:07:12
上传
评论
收藏 1.52MB ZIP 举报
温馨提示
WebUSB相关项目,adb.js
资源推荐
资源详情
资源评论
收起资源包目录
webusb-master.zip (8个子文件)
webusb-master
adb.js 36KB
adb.svg 36KB
webview.apk 1.41MB
test.apk 224KB
index.html 6KB
vue.js 283KB
code.svg 55KB
test.html 18KB
共 8 条
- 1
资源评论
lishizhi
- 粉丝: 3
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功