Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
appium-adb
Advanced tools
The appium-adb npm package is a Node.js library that provides a set of tools and utilities for interacting with Android devices using the Android Debug Bridge (ADB). It is primarily used in the context of mobile automation, particularly with the Appium framework, to perform various operations on Android devices such as installing apps, managing device state, and executing shell commands.
Install an APK
This feature allows you to install an APK file on a connected Android device. The code sample demonstrates how to create an ADB instance and use it to install an APK.
const ADB = require('appium-adb');
(async () => {
const adb = await ADB.createADB();
await adb.install('/path/to/your/app.apk');
})();
Execute Shell Command
This feature allows you to execute shell commands on a connected Android device. The code sample shows how to list the contents of the /system directory.
const ADB = require('appium-adb');
(async () => {
const adb = await ADB.createADB();
const result = await adb.shell(['ls', '/system']);
console.log(result);
})();
Start an App
This feature allows you to start an application on a connected Android device. The code sample demonstrates how to start an app by specifying its package and main activity.
const ADB = require('appium-adb');
(async () => {
const adb = await ADB.createADB();
await adb.startApp({
pkg: 'com.example.yourapp',
activity: 'com.example.yourapp.MainActivity'
});
})();
Get Device Properties
This feature allows you to retrieve various properties of a connected Android device. The code sample shows how to get and print the device properties.
const ADB = require('appium-adb');
(async () => {
const adb = await ADB.createADB();
const properties = await adb.getProperties();
console.log(properties);
})();
adbkit is a pure Node.js client for the Android Debug Bridge (ADB) protocol. It provides a set of tools for interacting with Android devices, similar to appium-adb. However, adbkit is more focused on providing a low-level interface to ADB, whereas appium-adb is tailored for use with the Appium automation framework.
adb-driver is another Node.js library for interacting with Android devices via ADB. It offers functionalities like installing APKs, running shell commands, and more. Compared to appium-adb, adb-driver is more lightweight and may lack some of the higher-level abstractions provided by appium-adb.
adbkit-apkreader is a library for reading information from APK files. While it does not provide direct ADB functionalities, it can be used in conjunction with other ADB libraries to gather detailed information about APKs. It complements appium-adb by offering additional capabilities for APK analysis.
A wrapper over android-adb, implemented using ES6 and along with async/await
. This package is mainly used by Appium to perform all adb operations on android device.
Note: Issue tracking for this repo has been disabled. Please use the main Appium issue tracker instead.
npm install appium-adb
npm run dev
npm run test
By default the functional tests use an avd named NEXUS_S_18_X86
, with API Level
18. To change this, you can use the environment variables PLATFORM_VERSION
,
API_LEVEL
, and ANDROID_AVD
. If PLATFORM_VERSION
is set then it is not
necessary to set API_LEVEL
as it will be inferred.
npm run e2e-test
example:
import ADB from 'appium-adb';
const adb = await ADB.createADB();
console.log(await adb.getPIDsByName('com.android.phone'));
createADB
getAdbWithCorrectAdbPath
initAapt
initZipAlign
getApiLevel
isDeviceConnected
mkdir
isValidClass
forceStop
clear
stopAndClear
availableIMEs
enabledIMEs
enableIME
disableIME
setIME
defaultIME
keyevent
lock
back
goToHome
isScreenLocked
isSoftKeyboardPresent
sendTelnetCommand
isAirplaneModeOn
setAirplaneMode
broadcastAirplaneMode
isWifiOn
getScreenSize
getScreenDensity
setWifiState
isDataOn
setDataState
setWifiAndData
rimraf
push
pull
processExists
forwardPort
reversePort
(ApiLevel >=21)forwardAbstractPort
ping
restart
startLogcat
stopLogcat
getLogcatLogs
getPIDsByName
killProcessesByName
killProcessByPID
broadcastProcessEnd
broadcast
endAndroidCoverage
instrument
androidCoverage
packageAndLaunchActivityFromManifest
compileManifest
insertManifest
hasInternetPermissionFromManifest
getSdkBinaryPath
getBinaryFromSdkRoot
getBinaryFromPath
getConnectedDevices
getDevicesWithRetry
restartAdb
adbExec
shell
getAdbServerPort
getEmulatorPort
getPortFromEmulatorString
getConnectedEmulators
setEmulatorPort
setDeviceId
getRunningAVD
getRunningAVDWithRetry
killAllEmulators
launchAVD
waitForEmulatorReady
waitForDevice
reboot
signWithDefaultCert
signWithCustomCert
sign
zipAlignApk
checkApkCert
checkCustomApkCert
getKeystoreHash
isAppInstalled
startApp
startUri
getFocusedPackageAndActivity
waitForActivityOrNot
waitForActivity
waitForNotActivity
uninstallApk
installFromDevicePath
install
fingerprint
(ApiLevel >=23 | emulator only)sendSMS
(emulator only)rotate
(emulator only)powerAC
(emulator only)powerCapacity
(emulator only)powerOFF
(emulator only)gsmCall
(emulator only)gsmSignal
(emulator only)gsmVoice
(emulator only)root
unroot
FAQs
Android Debug Bridge interface
The npm package appium-adb receives a total of 283,141 weekly downloads. As such, appium-adb popularity was classified as popular.
We found that appium-adb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.