AdbWrapper

AdbWrapper

ADB wrapper

Can be use to manage/interact with a device connected through ADB ADB Wrapper has two state :

  • Standard state : no device id passed to ADB
  • Specialized state : where all operation are done for a specific device ID

Constructor

new AdbWrapper(adbpath, pDeviceID)

Source:
Parameters:
Name Type Default Description
adbpath String

The ADB binary path

pDeviceID String null

(optional) The device ID to manage.

Members

deviceID

Source:

host

Source:

ip

Source:

path :Path

Source:
Type:
  • Path

port

Source:

shortname

Source:
Since:
  • v0.7.2

transport

Source:

up

Source:

Bridge connection status

usbQualifier

Source:

Methods

(static) fromJsonObject(pData) → {AdbWrapper}

Source:
Parameters:
Name Type Description
pData Object

Poor object

Returns:

ADB wrapper instance

Type
AdbWrapper

clone(pOverride) → {AdbWrapper}

Source:
Since:
  • v0.7.2

To clone.

It returns a new instance of AdbWrapper

Parameters:
Name Type Description
pOverride Object

Optional. Override configuration (key/value)

Returns:

New instance with same configuration

Type
AdbWrapper

(async) connect(pIpAddress, pPortNumber, pDeviceID) → {Boolean}

Source:
Since:
  • v0.7.2

To connect a remote device over TCP

Parameters:
Name Type Description
pIpAddress String

IP Address of target device

pPortNumber Integer
pDeviceID String

Target device ID

Returns:

TRUE if success, else FALSE

Type
Boolean

(async) detachedShell(pCommand, pArgs) → {Boolean}

Source:

To execute a command into a detached process.

Useful to launch side application such as frida-server

Parameters:
Name Type Description
pCommand String
pArgs String
Returns:

TRUE is success, else FALSE

Type
Boolean

getPackagePath(packageIdentifier, deviceId) → {String}

Source:

To search the path of a specific package into the device

Parameters:
Name Type Description
packageIdentifier String

The package name of the application

deviceId String

(Optional) The ID of the device where search the package

Returns:

The path of the application package into the device

Type
String

isConnected() → {Boolean}

Source:

To get connection status

Returns:

TRUE is connected, else FALSE

Type
Boolean

isNetworkTransport() → {Boolean}

Source:
Since:
  • v0.7.1

To check if the bridge uses TCP transport

Returns:

TRUE if the wrapper is configured to use TCP, else FALSE

Type
Boolean

isReady() → {Boolean}

Source:

To check if ADB is ready to be used.

Actually, it checks only if ADB path is not null :( TODO : check ADB server state

Returns:

TRUE if ADB is ready to use, else FALSE

Type
Boolean

isUsbTransport() → {Boolean}

Source:
Since:
  • v0.7.1

To check if the bridge uses USB transport

Returns:

TRUE if the wrapper is configured to use TCP, else FALSE *

Type
Boolean

(async) kill()

Source:

To kill adb-server

(async) listDevices() → {Array.<Device>}

Source:

To list connected devices

Returns:

A collection of Device objects

Type
Array.<Device>

listPackages(deviceId) → {Array.<AppPackage>}

Source:

To list all packages installed on target device

Parameters:
Name Type Description
deviceId String

[Optional] A specific device ID

Returns:

An array of AppPackage objects

Type
Array.<AppPackage>

(async) parseDeviceList(pDeviceListStr) → {Array.<Device>}

Source:

To parse the output of "adb device -l" command

Parameters:
Name Type Description
pDeviceListStr String

the ouput of "adb device -l" command

Returns:

An array of Device instances corresponding to ADB output

Type
Array.<Device>

performProfiling() → {DeviceProfile}

Source:

To perform profiling of the device associated to this adb wrapper instance.

Returns:

The device profile of target device

Type
DeviceProfile

(async) privilegedShell(command)

Source:

Execute a command on the device via 'su -c' Same as 'adb shell su -c' commande.

Parameters:
Name Type Description
command String

The command to execute remotely

pull(remote_path, local_path)

Source:

Pull a remote resource into the project workspace Same as 'adb pull' commande.

Parameters:
Name Type Description
remote_path *

The path of the remote resource to download

local_path *

The path where the resource will be stored locally

pullRessource(package_name, remote_path, local_path)

Source:

Pull a remote resource into the project workspace with Application Privileges Same as 'adb pull' commande.

Parameters:
Name Type Description
package_name *

The package name

remote_path *

The path of the remote resource to download

local_path *

The path where the resource will be stored locally

push(local_path, remote_path)

Source:

Push a local resource to a remote location Same as 'adb push' commande.

Parameters:
Name Type Description
local_path *

The path of the local resource to upload

remote_path *

The path where the resource will be stored remotely

setIpAddress(pIP)

Source:
Parameters:
Name Type Description
pIP String

IP Address

setPortNumber(pNumber)

Source:
Parameters:
Name Type Description
pNumber Integer

Port number

setTransport(transport_type)

Source:

Set the transport type

Parameters:
Name Type Description
transport_type Char

setup(deviceID) → {String}

Source:

To init the next command, if a device ID is passed as arguments then the command will use this device, else if a default device ID is configured the ID will be use, else no device ID is set.

Parameters:
Name Type Description
deviceID String

The ID of the device to use

Returns:

The begin of the command

Type
String

shell(command)

Source:

Execute a command on the device Same as 'adb shell' commande.

Parameters:
Name Type Description
command *

The command to execute remotely

(async) shellAsync(command)

Source:

Execute a command on the device Same as 'adb shell' commande.

Parameters:
Name Type Description
command *

The command to execute remotely

shellWithEH(command)

Source:

Execute a command on the device Same as 'adb shell' commande.

Parameters:
Name Type Description
command *

The command to execute remotely

shellWithEHsync(command)

Source:

Execute a command on the device Same as 'adb shell' commande.

Parameters:
Name Type Description
command *

The command to execute remotely

toJsonObject(pExcludeList) → {Object}

Source:

To tranform an instance to a simple object ready to be JSON serialized

Parameters:
Name Type Description
pExcludeList Object

An hashmap key/value of property to exclude

Returns:

A simple object ready to be JSON serialized

Type
Object