Skip to content

This Python script uses the Android Debug Bridge (ADB) to extract information about input fields from the currently displayed screen of a connected Android device.

Notifications You must be signed in to change notification settings

RaheesAhmed/ADB-Input-Field-Extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ADB Input Field Extractor

This Python script uses the Android Debug Bridge (ADB) to extract information about input fields from the currently displayed screen of a connected Android device.

Requirements

  • Python 3.x
  • adbutils
  • lxml
  • ADB (Android Debug Bridge) installed and added to the system's PATH

Setup

  1. Install Python Dependencies:

    pip install -r requirments.txt

    Enable USB Debugging on your Android device:

  2. Go to Settings > About phone > Tap Build number 7 times to enable Developer options.

  3. Go back to Settings > System > Developer options > Enable USB debugging. Connect your Android device to your computer via USB.

Usage

Run the Script:

python main.py

The script will connect to the first available device, dump the UI hierarchy, parse the XML, and extract information about input fields such as text, resource ID, and bounds.

The main function in your code performs the following tasks:

  • Connects to the first available Android device.
  • Launches the specified application using the provided package name.
  • Waits for a few seconds to allow the app to stabilize.
  • Dumps the UI hierarchy of the currently displayed screen.
  • Parses the XML of the UI hierarchy to extract information about input fields of type
    android.widget.EditText.
  • Prints the extracted input field data.

Output: The extracted input field information will be printed to the console in the following format:

[
   {
       'text': 'example text',
       'resource_id': 'com.example:id/inputField',
       'bounds': '[0,0][100,100]'
   },
   ...
]

Notes

The script currently only extracts information from input fields of type android.widget.EditText. Ensure that the screen you want to analyze is displayed on the device before running the script. The extraction process might take a few seconds, depending on the complexity of the UI.

About

This Python script uses the Android Debug Bridge (ADB) to extract information about input fields from the currently displayed screen of a connected Android device.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages