Hamibot CLI
Remote Android automation command-line tool. Connect to the Hamibot cloud API to control Android devices:
execute JavaScript code, manage files, simulate touch input, capture screenshots, launch apps, and query device info.
Official site: https://hamibot.com
Repository: https://github.com/hamibot/cli
Security Model
Hamibot CLI is a legitimate remote automation tool with the following security properties:
- 1. User-Authorized Device Access Only. Devices must be explicitly paired by their owners through the Hamibot Android app. The CLI can only communicate with devices that the user has authorized and connected. There is no mechanism for unauthorized or stealth device access.
- 2. Authenticated API. Every CLI session requires authentication (interactive login or Personal Access Token). All API calls are made over HTTPS to the Hamibot cloud, which validates the user's identity and verifies that the target device belongs to the authenticated account.
- 3. Scoped to User's Own Devices. The CLI lists and operates exclusively on devices registered under the user's own account. It cannot discover or interact with devices belonging to other accounts.
- 4. Standard Automation Capabilities. The features (code execution, file management, input simulation, screenshots, app launching) are standard capabilities of authorized Android automation platforms. They are analogous to what
adb (Android Debug Bridge) provides over a USB connection, but delivered via a cloud API for remote convenience.
- 5. Open Source. The CLI is fully open source at https://github.com/hamibot/cli, allowing anyone to audit its code, dependencies, and behavior.
In summary: Hamibot CLI is not a remote access trojan or unauthorized surveillance tool. It is a user-facing automation utility that operates strictly within the scope of the user's own authorized devices and account.
Installation
Prerequisites
- - Node.js >= 18 — check with
node --version; install from https://nodejs.org/ (LTS recommended) or via nvm / fnm - npm (bundled with Node.js)
Install as Global CLI
CODEBLOCK0
Install from Source
CODEBLOCK1
Quick Start
CODEBLOCK2
Authentication
Interactive Login
CODEBLOCK3
Token Login (recommended for CI/CD)
- 1. Create a Personal Access Token at https://hamibot.com/account/tokens
- Login with the token:
CODEBLOCK4
Global Options
Available on all commands:
| Flag | Purpose |
|---|
| INLINECODE2 | Target device ID (repeatable for multi-device parallel) |
| INLINECODE3 |
Structured JSON output for piping and scripting |
|
--debug [namespace] | Debug logging with optional namespace filter |
Device Selection
Without -d, CLI auto-selects a device:
- 1. If a default device is configured → use it
- If only one device paired → auto-select
- Multiple devices → interactive prompt (enter
0 to select all)
Multi-Device Parallel
CODEBLOCK5
Commands Reference
Code Execution
CODEBLOCK6
File Management
CODEBLOCK7
Input Control
CODEBLOCK8
Launch App
CODEBLOCK9
Device Management
CODEBLOCK10
Run Saved Script
CODEBLOCK11
Configuration
CODEBLOCK12
Hamibot CLI
远程安卓自动化命令行工具。连接 Hamibot 云 API 以控制安卓设备:执行 JavaScript 代码、管理文件、模拟触摸输入、截取屏幕截图、启动应用以及查询设备信息。
官方网站: https://hamibot.com
仓库地址: https://github.com/hamibot/cli
安全模型
Hamibot CLI 是一款合法的远程自动化工具,具有以下安全特性:
- 1. 仅限用户授权的设备访问。 设备必须由其所有者通过 Hamibot 安卓应用明确配对。CLI 只能与用户已授权并连接的设备通信。不存在未经授权或隐蔽访问设备的机制。
- 2. 经过身份验证的 API。 每次 CLI 会话都需要身份验证(交互式登录或个人访问令牌)。所有 API 调用均通过 HTTPS 发送至 Hamibot 云,云服务会验证用户身份并确认目标设备属于该认证账户。
- 3. 仅限于用户自己的设备。 CLI 仅列出并操作注册在用户自己账户下的设备。无法发现或与其他账户的设备进行交互。
- 4. 标准自动化能力。 这些功能(代码执行、文件管理、输入模拟、截图、应用启动)是授权安卓自动化平台的标准能力。它们类似于 adb(安卓调试桥)通过 USB 连接提供的功能,但通过云 API 实现远程便捷操作。
- 5. 开源。 CLI 在 https://github.com/hamibot/cli 完全开源,任何人都可以审计其代码、依赖项和行为。
总结: Hamibot CLI 不是远程访问木马或未经授权的监控工具。它是一个面向用户的自动化工具,严格在用户自己的授权设备和账户范围内运行。
安装
前提条件
- - Node.js >= 18 — 使用 node --version 检查;从 https://nodejs.org/(推荐 LTS 版本)或通过 nvm / fnm 安装
- npm(随 Node.js 一起提供)
安装为全局 CLI
bash
npm install -g hamibot/cli
hamibot -v
从源码安装
bash
git clone https://github.com/hamibot/cli.git
cd cli
npm install
npm link
快速开始
bash
1. 登录(交互式提示输入手机号/邮箱和密码)
hamibot login
2. 列出已配对的设备
hamibot devices
3. 在设备上执行代码
hamibot exec -c toast(来自 CLI 的问候!)
身份验证
交互式登录
bash
hamibot login
令牌登录(推荐用于 CI/CD)
- 1. 在 https://hamibot.com/account/tokens 创建个人访问令牌
- 使用令牌登录:
bash
hamibot login -t hmp_xxxxxxxxxxxx
全局选项
所有命令均可使用:
| 标志 | 用途 |
|---|
| -d, --device <id> | 目标设备 ID(可重复使用以实现多设备并行) |
| -j, --json |
结构化 JSON 输出,适用于管道和脚本 |
| --debug [namespace] | 调试日志,可选的命名空间过滤器 |
设备选择
如果不使用 -d,CLI 会自动选择设备:
- 1. 如果已配置默认设备 → 使用该设备
- 如果仅有一台设备已配对 → 自动选择
- 多台设备 → 交互式提示(输入 0 选择全部)
多设备并行
bash
hamibot input tap 500 500 -d device-A -d device-B
命令参考
代码执行
bash
hamibot exec -c toast(你好!)
hamibot exec -f ./script.js
echo toast(你好!) | hamibot exec
文件管理
bash
hamibot file ls # 列出 /sdcard 目录
hamibot file ls /sdcard/Download
hamibot file download /sdcard/file.png # 下载到当前目录
hamibot file download /sdcard/file.png ./local.png
hamibot file upload ./local.txt /sdcard/
hamibot file cat /sdcard/log.txt
输入控制
bash
hamibot input tap 500 500
hamibot input click 500 500 # 别名
hamibot input longtap 500 500
hamibot input longtap 500 500 --duration 1000
hamibot input swipe 500 1500 500 500 --duration 300
hamibot input gesture 500 100 200 300 400 500 600 700
启动应用
bash
hamibot launch com.example.app
hamibot launch com.example.app --activity .MainActivity
设备管理
bash
hamibot devices # 列出所有设备
hamibot devices info
hamibot devices online # 检查在线状态
运行已保存的脚本
bash
hamibot run
配置
bash
hamibot config defaultDevice # 设置默认设备
hamibot config defaultDevice --get # 获取配置值
hamibot config --reset # 清除所有配置