Skip to content

Android auto detect USB powered to perform HID attack.

Notifications You must be signed in to change notification settings

zulfi0/hid-usb-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

hid-usb-detect

Android auto detect USB powered to perform HID attack.

When performing USB HID attack with android using DroidDucky or Rucky apk the device have to connected first to pc / laptop, these condition slightly bothers me so i create this script to detect if the device is connected to pc/laptop or not.

in android there are 2 power type AC and USB,

AC powered: This refers to when a device is powered or charged using an AC (Alternating Current) power source, typically from an electrical outlet. While the device might connect to the power source using a USB cable, the source of power itself is AC, which is then converted into DC (Direct Current) within the device to charge its battery.

USB Powered: This refers to when a device, such as a smartphone or tablet, is powered or charged using a USB (Universal Serial Bus) connection. Most Android devices can be charged through a USB connection using a computer, a USB wall charger, or other compatible USB power sources.

these can be viewed with dumpsys command

image

The Idea is when the device is powered through usb (USB powered become true) such as connected to pc/laptop then we will perfrom the HID attack so we can run the script before connecting the android device to pc/laptop.

Installation

download usb-detect.sh in this repo and droidducky repo at https://github.com/anbud/DroidDucky

move DroidDucky folder into /data/local/ and put usb-detect.sh in DroidDucky directory

mv /sdcard/Download/DroicDucky /data/local/
mv /sdcard/Download/usb-detect.sh /data/local/DroidDucky

Example

Try with the following payload:

GUI r
DELAY 100
STRING notepad.exe
ENTER
DELAY 200
STRING You have been hacked !! 
ENTER

save these in payload.txt and run the script:

sh usb-detect.sh payload.txt

not connected to pc/laptop

image

once connected

image

About

Android auto detect USB powered to perform HID attack.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages