mayankmetha / Rucky

A simple to use USB HID Rubber Ducky Launch Pad for Android.
https://mayankmetha.github.io/Rucky
GNU General Public License v3.0
530 stars 65 forks source link

Rucky not registering the ENTER key on android device #41

Closed MasterAtRobloxLua closed 3 years ago

MasterAtRobloxLua commented 3 years ago

Type: Missing/Correction Keyboard Language: American English Unicode Value: \u Encoding: ASCII/ISO_8859-1/ISO_8859-5/Unicode Shift Used: F Meta/Windows Used: F Alt Used: F Ctrl Used: F

Hey so, the app works fantastically great against a PC but it needs some improvement against android When I plug my phone with another phone using a USB type C cable then launch a simple attack which is supposed to unlock the target android phone "DOWN LEFT ENTER" the ENTER command doesn't register on the target android phone when using rucky but it works fine when I use nethunter's built in duckhunter HID

I prefer rucky over nethunter HID due to the fact that it has more features and rucky has less bugs than nethunter

the target android phone's model is SM-N985(note 20 ultra) the attacker's android which is using rucky is SM-G781B(S20 FE 5G)

TL;DR ENTER key doesn't work against an android phone

mayankmetha commented 3 years ago

Enter Key is mapped to USB Keyboard key number 0x28. Moreover "ENTER" is a valid Rubber Duck Command. Rucky and Nethunter HID makes use of similar logic from Hak5 and USB HID Spec Document.

Probably can you retest it. If a command works on Windows/Linux/Mac, then there is no issue. On some Android Devices (device under attack), keyboard mapping codes could have been remapped due to device settings, of that device (device under attack). Probably I may need more details from your end to include such special mapping. In your case Enter key on the android device under attack could have been remapped to DPAD_Center key instead like many other Android OEM do.

MasterAtRobloxLua commented 3 years ago

Enter Key is mapped to USB Keyboard key number 0x28. Moreover "ENTER" is a valid Rubber Duck Command. Rucky and Nethunter HID makes use of similar logic from Hak5 and USB HID Spec Document.

Probably can you retest it. If a command works on Windows/Linux/Mac, then there is no issue. On some Android Devices (device under attack), keyboard mapping codes could have been remapped due to device settings, of that device (device under attack). Probably I may need more details from your end to include such special mapping. In your case Enter key on the android device under attack could have been remapped to DPAD_Center key instead like many other Android OEM do.

Okay so, I retested it and still, nethunter's hid works while Rucky's enter doesn't Also I've remembered something, when I was in the process of installing nethunter the guide on xda instructed me to download a file named hid-keyboard and place it in /system/xbin This might be causing the issue Here's the XDA thread(the hid-keyboard file is within the first link the one called SM... inside the zip file named Nethunter_WirusMOD_Binaries_Android_11.zip

https://forum.xda-developers.com/t/kernel-nethunter-for-galaxy-s20-fe-5g-r8q-snapdragon.4205881/

Here's the hid-keyboard file directly

https://www.mediafire.com/file/k66l7ui3mgauj75/hid-keyboard/file

Here is the output in duckhunter hid inside the nethunter app

!/system/bin/sh

The script is converted by "us" keyboard layout

echo "[!] Executing duckyscript.." echo "[!] Checking if HID driver has been installed on target machine.." COUNT=0 until echo volume-up [/system/xbin/hid-keyboard /dev/ hidgo keyboard > /dev/null 2>&1; do sleep 1 COUNT=$((COUNT+1)) if [ $COUNT -eq 60 ]; then #60 seconds echo "[-] HID driver still cannot be installed on target machine after $COUNT second.... \nScript aborted." exit 1 fi done echo "[+] HID driver is found installed on target machine already! Executing attack..." echo enter|/system/xbin/hid-keyboard /dev/hidgo keyboard echo "[+] Attack complete."

Nethunter used the file hid-keyboard echo enter|/system/xbin/hid-keyboard

mayankmetha commented 3 years ago

I tested the ENTER key with AOSP on Nexus5 and OxygenOS on Oneplus7Pro. On both it seems to work fine.

Probably you might have to contact the kernel developer for the nethunter to get more information regarding the issue. Kernel support and custom device settings is beyond the of this project. Probably getting help from the kernel developers here can be a better and faster solution. Please tag your kernel developer here so we can sync and get the solution at the earliest.

MasterAtRobloxLua commented 3 years ago

I mean I don't really think the custom kernel is causing the issue since every other key except the ENTER key works fine

Look at the gif I made https://gfycat.com/revolvingorganichapuka

The gif was recorded on the note 20 ultra

while connected to the s20 fe 5g(attacker) using the Rucky app

The textbox inside the rucky app had the command ENTER only and I was clicking on the launch attack multiple times hence the effect on the gif

In the gif some sort of pressing is shown but it isn't really pressing the button so maybe could you add a feature to change the key mapping or key delay pressing or something similar?

im not quite sure whether this would help but there's an app called Bluetooth keyboard and mouse and the enter key works fine on it

mayankmetha commented 3 years ago

It looks like enter key is working then. Delay can be added in 2 ways:

Refer https://docs.hak5.org/hc/en-us/articles/360010555153-Ducky-Script-the-USB-Rubber-Ducky-language

MasterAtRobloxLua commented 3 years ago

I might've not been clear on the previous comment but what I meant is, the phone is registering some sort of ENTER key but doesn't interpret it as an actual tap like as in a real keyboard or nethunter HID

What should've happened in the gif is the option in the setting opening

mayankmetha commented 3 years ago

ENTER key seems to work from the above mentioned comment.

MasterAtRobloxLua commented 3 years ago

But it wasn't interpreting it as an actual tap..... whilst duckhunter hid was??

mayankmetha commented 3 years ago

The gif you sent shows ENTER is working! It did register a UI click/long click event. Use DEFAULTDELAY and retry.

MasterAtRobloxLua commented 3 years ago

The gif you sent shows ENTER is working! It did register a UI click/long click event. Use DEFAULTDELAY and retry.

Nope, using DEFAULTDELAY didn't work the code

DEFAULTDELAY 100
ENTER

I've tried changing the value of the DEFAULTDELAY to 10, 1000, 500 but it still didn't register it as a tap

MasterAtRobloxLua commented 3 years ago

ENTER key seems to work from the above mentioned comment.

Enter key is supposed to open things in android like a tap, yet it doesn't also using the defaultdelay didn't change anything

mayankmetha commented 3 years ago

Retested the issue. Enter key works as expected. No issues found.

mayankmetha commented 3 years ago

https://mayankmetha.github.io/Rucky/

From here you can download the latest nightly build.