GithubHelp home page GithubHelp logo

jeanbritz / go-android-bruteforce-pin Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 18.15 MB

Android screen lock pin bruteforcer using Android Open Accessory Protocol (AOA)

Home Page: https://www.jeanbritz.co.za/2024/02/creating-a-pin-bruteforcer-using-android-open-accessory-protocol/

Go 94.58% Makefile 5.42%
android aoa bruteforce hid pin

go-android-bruteforce-pin's Introduction

Android PIN Bruteforcer

Purpose of this project is to demonstrate the use of the Android Open Accessory Protocol (AOA) to mimic key presses on an Android device. The script goes and try to type each PIN in the Android device in the list of pins located here

The only requirements to use this project, are the following:

  • Android device with the accessory mode capability
  • USB Cable
  • Linux OS with Go 1.22.0 installed

Prerequisites

If you are running this project for the first time on Linux, then you should install libusb as well, if you have not already. You can install it as follows:

$ make install-libusb

or, alternatively:

# apt-get install libusb-1.0-0-dev

Usage

To run the script, first build the project if you haven't yet:

$ make build

Then run it with sudo privileges:

$ make run

Details

I have used a Sony Xperia Z1 Compact as the Android phone, which I am still trying to bruteforce the PIN.

This script registers itself as an accessory with the Android phone, which allows me to interact with HID Events over USB. The Android OAO Protocol only sets up the initial part of registering the script as an accessory. This setup includes a HID report descriptor, which is sent to the Android phone to configure it. What this report descriptor does is it configures a mouse pointer and a stylus on the Android phone. For my case it made it easier for me to have both of them as the mouse pointer allowed me to use absolute values to position the pointer and then convert it to the stylus to emulate a touch to press any of the 10 digits (0-9)

For each HID event sent to the Android phone you need to send 5 bytes (depends on the report descriptor) Format for each action performed on the phone is described below:

Action Byte 0 Byte 1 Byte 2 Byte 3 Byte 4
Press 0x00 0x00 0x00 0x00 0x00
Convert Pointer
to Stylus accessory
0x01 0x00 0x00 0x00 0x00
Convert to Pointer and
Set Pointer Position
0x02 X Pos (LSB) X Pos (MSB) Y Pos (LSB) Y Pos (MSB)

Problems

There are a few problems with this script. Not due to bugs, I think, but due to the protocol being asynchronous. There is no feedback or error handling that can be implemented when send a HID event.

Through testing the script I have found that when sending the HID event, it does not always mean the action (described above) is executed 100% reliably everytime.

This means that you will need to 'babysit' the phone to see if every PIN combination is entered correctly.

Performance

It will vary between devices due to the backoff period between many PIN entries. On my Sony you have to wait for 30 seconds after you have entered 5 PINs.

For the Sony it takes on average about 8 seconds to enter 5 pins. Then 30 second of backoff time to wait before you can enter another 5 pins.

Demo

Demo

Credits

Useful tools

Related links

Academic articles

go-android-bruteforce-pin's People

Contributors

jeanbritz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.