goat

package module
v0.0.0-...-c287704 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

goat - go android tools

介绍

Android SDK 相关工具的封装。

开发计划

  • 命令的查找

    • 通过PATH来获取命令
    • 通过指定路径来获取命令
    • Android SDK 环境的获取
  • 命令的执行

    • 同步命令;等待返回结果;并获取结果。(推荐)
    • 异步命令;不等待返回结果
    • 命令超时;如何处理。
  • 命令的封装?

    • adb
    • skdmanager
    • aapt
    • dexdump
    • apksigner
  • 模拟器启动

    • 启动夜神模拟器
    • 启动雷电模拟器
    • 启动Android Studio模拟器
  • 连接设备

  • 控制设备;对设备进行操作。

    • ADB的封装
    • 设备信息获取
      • 设备型号
      • 设备版本
      • 设备序列号
      • 设备状态
    • 应用操作
      • 安装应用
      • 卸载应用
      • 启动应用
      • 停止应用
      • 获取应用信息
  • 多设备管理

    • 设备列表获取;DeviceList
    • 设备连接;ConnectDevice
    • 设备断开;DisconnectDevice
    • 设备状态获取;GetDeviceStatus
    • 设备信息获取;GetDeviceInfo
    • 设备应用操作;AppAction

    go - adb dexdump? aapt? 还是单独的模拟器?

    https://github.com/aiChenK/adb-service adb服务 https://github.com/lavafroth/droidrunco Android 包管理

    操作方案:

    1. 并发处理。
    2. 一个一个来。

    一次性处理一个;

Documentation

Overview

设备控制

环境路径获取

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandExists

func CommandExists(cmd string) bool

func FileExists

func FileExists(path string) bool

Types

type Device

type Device struct {
	AdbPath string
	// contains filtered or unexported fields
}

连接设备,操作设备

func NewDevice

func NewDevice(adb_path string, serial string) *Device

新建一个设备

func (*Device) BatteryStats

func (d *Device) BatteryStats(pkg string) string

func (*Device) Cat

func (d *Device) Cat(path string) string

func (*Device) Ls

func (d *Device) Ls(path string) string

func (*Device) NetStats

func (d *Device) NetStats()

TODO 首次安装时间,最近更新时间 TODO 打开次数 * TODO 默认电话应用 默认短信应用 辅助功能已经开启的应用 打开设备管理的应用

// TODO 流量

最近1天的流量 最近1周的流量 最近1月的流量

https://blog.csdn.net/u012514113/article/details/135731086 流量获取方式不一样, 低版本和高版本的位置不一样。 - dumpsys netstats detail - dumpsys netstats --full --uid --tag

// 总的

mAppUidStatsMap:
  uid rxBytes rxPackets txBytes txPackets
  10433 8195953 15523 1416948 13365
  10229 186523823 134524 2989837 25572

接收的字节数,

TODO 已经授权的高危权限

获取应用的流量

https://developer.android.com/tools/dumpsys?hl=zh-cn#uid_stats - dumpsys netstats --full --uid

func (*Device) PmListPackages

func (d *Device) PmListPackages(file bool, pt PackageType, uid bool, show_versioncode bool) string
Prints all packages; optionally only those whose name contains
the text in FILTER.

list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U]

[--show-versioncode] [--apex-only] [--uid UID] [--user USER_ID] [FILTER]

Options are:

-f: see their associated file
-a: all known packages (but excluding APEXes)
-d: filter to only show disabled packages
-e: filter to only show enabled packages
-s: filter to only show system packages
-3: filter to only show third party packages
-i: see the installer for the packages
-l: ignored (used for compatibility with older releases)
-U: also show the package UID
-u: also include uninstalled packages
--show-versioncode: also show the version code
--apex-only: only show APEX packages
--uid UID: filter to only show packages with the given UID
--user USER_ID: only list packages belonging to the given user

func (*Device) Pull

func (d *Device) Pull(remote string, local string)
copy files/dirs from device

pull [-a] [-z ALGORITHM] [-Z] REMOTE... LOCAL

-a: preserve file timestamp and mode
-z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd)
-Z: disable compression

func (*Device) Push

func (d *Device) Push(local string, remote string)

copy local files/directories to device

push [--sync] [-z ALGORITHM] [-Z] LOCAL... REMOTE

--sync: only push files that are newer on the host than the device
-n: dry run: push files to device without storing to the filesystem
-z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd)
-Z: disable compression

type PackageType

type PackageType int

定义 pm list packages 的显示类型

const (
	All PackageType = iota
	System
	ThridParty
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL