sendkeysonroids


Namesendkeysonroids JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/sendkeysonroids
Summarysendevent without using sendevent - keystrokes on Android
upload_time2024-07-18 05:13:01
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords android adb sendevent utf-8 keystrokes
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# sendevent without using sendevent - keystrokes on Android

### Tested against Windows 10 / Python 3.11 / Anaconda / Bluestacks 5

### pip install sendkeysonroids


## in action

[![YT](https://i.ytimg.com/vi/MifVqKNrxts/maxresdefault.jpg)](https://www.youtube.com/watch?v=MifVqKNrxts)
[https://www.youtube.com/watch?v=MifVqKNrxts]()


```py
from sendkeysonroids import (
    SendEventKeysOnRoids,
    std_key_mapping_dict,
    all_linux_key_events,
)
import shutil

# to see a list of all available keys
print(all_linux_key_events)


# this is the default key mapping
print(std_key_mapping_dict)

# define your key mapping
my_key_mapping_dict = {
    " ": "KEY_SPACE",
    "!": "KEY_LEFTSHIFT + KEY_1",
    "'": "KEY_APOSTROPHE",
    '"': "KEY_LEFTSHIFT + KEY_APOSTROPHE",
    "#": "KEY_LEFTSHIFT + KEY_3",
    "$": "KEY_LEFTSHIFT + KEY_4",
    "%": "KEY_LEFTSHIFT + KEY_5",
    "&": "KEY_LEFTSHIFT + KEY_7",
    "(": "KEY_LEFTSHIFT + KEY_9",
    ")": "KEY_LEFTSHIFT + KEY_0",
    "*": "KEY_LEFTSHIFT + KEY_8",
    "+": "KEY_KPPLUS",
    ",": "KEY_COMMA",
    "-": "KEY_MINUS",
    ".": "KEY_DOT",
    "/": "KEY_SLASH",
    "0": "KEY_0",
    "1": "KEY_1",
    "2": "KEY_2",
    "3": "KEY_3",
    "4": "KEY_4",
    "5": "KEY_5",
    "6": "KEY_6",
    "7": "KEY_7",
    "8": "KEY_8",
    "9": "KEY_9",
    ":": "KEY_LEFTSHIFT + KEY_SEMICOLON",
    ";": "KEY_SEMICOLON",
    "<": "KEY_LEFTSHIFT + KEY_COMMA",
    "=": "KEY_EQUAL",
    ">": "KEY_LEFTSHIFT + KEY_DOT",
    "?": "KEY_QUESTION",
    "@": "KEY_LEFTSHIFT + KEY_2",
    "A": "KEY_LEFTSHIFT + KEY_A",
    "B": "KEY_LEFTSHIFT + KEY_B",
    "C": "KEY_LEFTSHIFT + KEY_C",
    "D": "KEY_LEFTSHIFT + KEY_D",
    "E": "KEY_LEFTSHIFT + KEY_E",
    "F": "KEY_LEFTSHIFT + KEY_F",
    "G": "KEY_LEFTSHIFT + KEY_G",
    "H": "KEY_LEFTSHIFT + KEY_H",
    "I": "KEY_LEFTSHIFT + KEY_I",
    "J": "KEY_LEFTSHIFT + KEY_J",
    "K": "KEY_LEFTSHIFT + KEY_K",
    "L": "KEY_LEFTSHIFT + KEY_L",
    "M": "KEY_LEFTSHIFT + KEY_M",
    "N": "KEY_LEFTSHIFT + KEY_N",
    "O": "KEY_LEFTSHIFT + KEY_O",
    "P": "KEY_LEFTSHIFT + KEY_P",
    "Q": "KEY_LEFTSHIFT + KEY_Q",
    "R": "KEY_LEFTSHIFT + KEY_R",
    "S": "KEY_LEFTSHIFT + KEY_S",
    "T": "KEY_LEFTSHIFT + KEY_T",
    "U": "KEY_LEFTSHIFT + KEY_U",
    "V": "KEY_LEFTSHIFT + KEY_V",
    "W": "KEY_LEFTSHIFT + KEY_W",
    "X": "KEY_LEFTSHIFT + KEY_X",
    "Y": "KEY_LEFTSHIFT + KEY_Y",
    "Z": "KEY_LEFTSHIFT + KEY_Z",
    "[": "KEY_LEFTBRACE",
    "\n": "KEY_ENTER",
    "\t": "KEY_TAB",
    "]": "KEY_RIGHTBRACE",
    "^": "KEY_LEFTSHIFT + KEY_6",
    "_": "KEY_LEFTSHIFT + KEY_MINUS",
    "`": "KEY_GRAVE",
    "a": "KEY_A",
    "b": "KEY_B",
    "c": "KEY_C",
    "d": "KEY_D",
    "e": "KEY_E",
    "f": "KEY_F",
    "g": "KEY_G",
    "h": "KEY_H",
    "i": "KEY_I",
    "j": "KEY_J",
    "k": "KEY_K",
    "l": "KEY_L",
    "m": "KEY_M",
    "n": "KEY_N",
    "o": "KEY_O",
    "p": "KEY_P",
    "q": "KEY_Q",
    "r": "KEY_R",
    "s": "KEY_S",
    "t": "KEY_T",
    "u": "KEY_U",
    "v": "KEY_V",
    "w": "KEY_W",
    "x": "KEY_X",
    "y": "KEY_Y",
    "z": "KEY_Z",
    "{": "KEY_LEFTSHIFT + KEY_LEFTBRACE",
    "}": "KEY_LEFTSHIFT + KEY_RIGHTBRACE",
    "|": "KEY_LEFTSHIFT + KEY_BACKSLASH",
    "~": "KEY_LEFTSHIFT + KEY_GRAVE",
    "ç": "KEY_LEFTALT + KEY_C",
    "Ç": "KEY_LEFTALT + KEY_LEFTSHIFT + KEY_C",
    "ß": "KEY_LEFTALT + KEY_S",
    "ẞ": "KEY_LEFTSHIFT + KEY_LEFTALT + KEY_S",
    "\u0555": "KEY_LEFTCTRL + KEY_A", # use some unicode symbols that you never use, and bind them to a key combination (select all in this case)
    "\u0556": "KEY_LEFTCTRL + KEY_C", # Combinations need to be separated by ' + '
    "\u0557": "KEY_LEFTCTRL + KEY_V",
}
adb_path = shutil.which("adb")
device_serial = "127.0.0.1:5645"  # use None when running directly on Android -> https://github.com/hansalemaos/termuxfree
input_device = "/dev/input/event3"  # use None when running directly on Android
android_automation = SendEventKeysOnRoids(
    adb_path=adb_path,
    device_serial=device_serial,
    input_device=input_device,
    su_exe="su",
    blocksize=720,  # block size when using the dd command, this controls the execution speed of echo_input_text_dd/printf_input_text_dd
    prefered_execution="exec", # faster than eval
    chunk_size=1024, # chunk size to create the file for dd 
    key_mapping_dict=my_key_mapping_dict,
)
# adb_shell = UniversalADBExecutor(adb_path, device_serial)
my_text = "this is a test ÇßßaçÇqßßßßß2ß\u0555\u0556\u0557\u0557"
echo_input_text = android_automation.echo_input_text(text=my_text)
printf_input_text = android_automation.printf_input_text(text=my_text)
echo_input_text_dd = android_automation.echo_input_text_dd(text=my_text)
printf_input_text_dd = android_automation.printf_input_text_dd(text=my_text)
echo_input_keypress = android_automation.echo_input_keypress(key="A", duration=1)
printf_input_keypress = android_automation.printf_input_keypress(key="B", duration=1)

# commands can be executed multiple times
echo_input_text()
printf_input_text()
echo_input_text_dd()
printf_input_text_dd()
echo_input_keypress()
printf_input_keypress()
```

```py
    class SendEventKeysOnRoids(builtins.object)
     |  SendEventKeysOnRoids(adb_path=None, device_serial=None, input_device='/dev/input/event3', su_exe='su', blocksize=72, prefered_execution: Literal['exec', 'eval'] = 'exec', chunk_size=1024, key_mapping_dict=None) -> None
     |
     |  A class to manage and send key events to an Android device. It uses ADB, but also runs directly on the device (rooted and Python installed) -> https://github.com/hansalemaos/termuxfree
     |
     |  This class prepares binary data for key events, converts them into different formats, and executes
     |  corresponding commands on Android devices.
     |
     |  Methods defined here:
     |
     |  __init__(self, adb_path=None, device_serial=None, input_device='/dev/input/event3', su_exe='su', blocksize=72, prefered_execution: Literal['exec', 'eval'] = 'exec', chunk_size=1024, key_mapping_dict=None) -> None
     |      Initializes the SendEventKeysOnRoids class with specified parameters.
     |
     |      Args:
     |          adb_path (str, optional): Path to the ADB executable. Defaults to None.
     |          device_serial (str, optional): Serial number of the target Android device. Defaults to None.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to "/dev/input/event3".
     |          su_exe (str, optional): Command to gain superuser privileges on the Android device. Defaults to "su". ALWAYS NEEDED!
     |          blocksize (int, optional): Block size for the `dd` command. Defaults to 72. This controls the speed, use steps of 72
     |          prefered_execution (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to "exec".
     |          chunk_size (int, optional): Chunk size for splitting data into base64 blocks. Defaults to 1024.
     |          key_mapping_dict (dict, optional): Dictionary mapping keys to Linux key event codes. Defaults to None.
     |
     |      Attributes:
     |          adb_path (str): Path to the ADB executable.
     |          device_serial (str): Serial number of the target Android device.
     |          input_device (str): Path to the input device on the Android device.
     |          su_exe (str): Command to gain superuser privileges on the Android device.
     |          blocksize (int): Block size for the `dd` command.
     |          prefered_execution (str): Preferred method of command execution.
     |          chunk_size (int): Chunk size for splitting data into base64 blocks.
     |          key_mapping_dict (dict): Dictionary mapping keys to Linux key event codes.
     |          all_linux_key_events_data (dict): Prepared binary data for all Linux key events.
     |          adb_shell (UniversalADBExecutor): ADB shell executor instance.
     |
     |  echo_input_keypress(self, key, duration=1, input_device=None)
     |      Generates a command to send a key press event to the specified input device using echo.
     |
     |      Args:
     |          key (str): The key to press.
     |          duration (int, optional): Duration to hold the key press. Defaults to 1 second.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |
     |  echo_input_text(self, text, input_device=None)
     |      Generates a command to send text input to the specified input device using echo.
     |
     |      Args:
     |          text (str): The text to send as input.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |
     |  echo_input_text_dd(self, text, output_path='/sdcard/echo_input_text_dd.bin', blocksize=None, sleep_after_each_execution=0, exec_or_eval=None, input_device=None)
     |      Generates a command to send text input as binary data using echo and dd commands.
     |
     |      Args:
     |          text (str): The text to send as input.
     |          output_path (str, optional): Path to store the generated binary data on the device. Defaults to "/sdcard/echo_input_text_dd.bin".
     |          blocksize (int, optional): Block size for the `dd` command. Defaults to the class's blocksize, this controls the speed, use steps of 72
     |          sleep_after_each_execution (int, optional): Sleep duration between each command execution. Defaults to 0.
     |          exec_or_eval (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to the class's prefered_execution.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |
     |  printf_input_keypress(self, key, duration=1, input_device=None)
     |      Generates a command to send a key press event to the specified input device using printf.
     |
     |      Args:
     |          key (str): The key to press.
     |          duration (int, optional): Duration to hold the key press. Defaults to 1 second.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |
     |  printf_input_text(self, text, input_device=None)
     |      Generates a command to send text input to the specified input device using printf.
     |
     |      Args:
     |          text (str): The text to send as input.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |
     |  printf_input_text_dd(self, text, output_path='/sdcard/printf_input_text_dd.bin', blocksize=None, sleep_after_each_execution=0, exec_or_eval=None, input_device=None)
     |      Generates a command to send text input as binary data using printf and dd commands.
     |
     |      Args:
     |          text (str): The text to send as input.
     |          output_path (str, optional): Path to store the generated binary data on the device. Defaults to "/sdcard/printf_input_text_dd.bin".
     |          blocksize (int, optional): Block size for the `dd` command. Defaults to the class's blocksize.
     |          sleep_after_each_execution (int, optional): Sleep duration between each command execution. Defaults to 0.
     |          exec_or_eval (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to the class's prefered_execution.
     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.
     |
     |      Returns:
     |          CodeExec: An instance of CodeExec class to execute the generated command.
     |

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/sendkeysonroids",
    "name": "sendkeysonroids",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "android, adb, sendevent, utf-8, keystrokes",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2b/3b/8d7d71af6cafcabcc805e7852ceb70af2b82b3ff8e9467fc4391ff8768ca/sendkeysonroids-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# sendevent without using sendevent - keystrokes on Android\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda / Bluestacks 5\r\n\r\n### pip install sendkeysonroids\r\n\r\n\r\n## in action\r\n\r\n[![YT](https://i.ytimg.com/vi/MifVqKNrxts/maxresdefault.jpg)](https://www.youtube.com/watch?v=MifVqKNrxts)\r\n[https://www.youtube.com/watch?v=MifVqKNrxts]()\r\n\r\n\r\n```py\r\nfrom sendkeysonroids import (\r\n    SendEventKeysOnRoids,\r\n    std_key_mapping_dict,\r\n    all_linux_key_events,\r\n)\r\nimport shutil\r\n\r\n# to see a list of all available keys\r\nprint(all_linux_key_events)\r\n\r\n\r\n# this is the default key mapping\r\nprint(std_key_mapping_dict)\r\n\r\n# define your key mapping\r\nmy_key_mapping_dict = {\r\n    \" \": \"KEY_SPACE\",\r\n    \"!\": \"KEY_LEFTSHIFT + KEY_1\",\r\n    \"'\": \"KEY_APOSTROPHE\",\r\n    '\"': \"KEY_LEFTSHIFT + KEY_APOSTROPHE\",\r\n    \"#\": \"KEY_LEFTSHIFT + KEY_3\",\r\n    \"$\": \"KEY_LEFTSHIFT + KEY_4\",\r\n    \"%\": \"KEY_LEFTSHIFT + KEY_5\",\r\n    \"&\": \"KEY_LEFTSHIFT + KEY_7\",\r\n    \"(\": \"KEY_LEFTSHIFT + KEY_9\",\r\n    \")\": \"KEY_LEFTSHIFT + KEY_0\",\r\n    \"*\": \"KEY_LEFTSHIFT + KEY_8\",\r\n    \"+\": \"KEY_KPPLUS\",\r\n    \",\": \"KEY_COMMA\",\r\n    \"-\": \"KEY_MINUS\",\r\n    \".\": \"KEY_DOT\",\r\n    \"/\": \"KEY_SLASH\",\r\n    \"0\": \"KEY_0\",\r\n    \"1\": \"KEY_1\",\r\n    \"2\": \"KEY_2\",\r\n    \"3\": \"KEY_3\",\r\n    \"4\": \"KEY_4\",\r\n    \"5\": \"KEY_5\",\r\n    \"6\": \"KEY_6\",\r\n    \"7\": \"KEY_7\",\r\n    \"8\": \"KEY_8\",\r\n    \"9\": \"KEY_9\",\r\n    \":\": \"KEY_LEFTSHIFT + KEY_SEMICOLON\",\r\n    \";\": \"KEY_SEMICOLON\",\r\n    \"<\": \"KEY_LEFTSHIFT + KEY_COMMA\",\r\n    \"=\": \"KEY_EQUAL\",\r\n    \">\": \"KEY_LEFTSHIFT + KEY_DOT\",\r\n    \"?\": \"KEY_QUESTION\",\r\n    \"@\": \"KEY_LEFTSHIFT + KEY_2\",\r\n    \"A\": \"KEY_LEFTSHIFT + KEY_A\",\r\n    \"B\": \"KEY_LEFTSHIFT + KEY_B\",\r\n    \"C\": \"KEY_LEFTSHIFT + KEY_C\",\r\n    \"D\": \"KEY_LEFTSHIFT + KEY_D\",\r\n    \"E\": \"KEY_LEFTSHIFT + KEY_E\",\r\n    \"F\": \"KEY_LEFTSHIFT + KEY_F\",\r\n    \"G\": \"KEY_LEFTSHIFT + KEY_G\",\r\n    \"H\": \"KEY_LEFTSHIFT + KEY_H\",\r\n    \"I\": \"KEY_LEFTSHIFT + KEY_I\",\r\n    \"J\": \"KEY_LEFTSHIFT + KEY_J\",\r\n    \"K\": \"KEY_LEFTSHIFT + KEY_K\",\r\n    \"L\": \"KEY_LEFTSHIFT + KEY_L\",\r\n    \"M\": \"KEY_LEFTSHIFT + KEY_M\",\r\n    \"N\": \"KEY_LEFTSHIFT + KEY_N\",\r\n    \"O\": \"KEY_LEFTSHIFT + KEY_O\",\r\n    \"P\": \"KEY_LEFTSHIFT + KEY_P\",\r\n    \"Q\": \"KEY_LEFTSHIFT + KEY_Q\",\r\n    \"R\": \"KEY_LEFTSHIFT + KEY_R\",\r\n    \"S\": \"KEY_LEFTSHIFT + KEY_S\",\r\n    \"T\": \"KEY_LEFTSHIFT + KEY_T\",\r\n    \"U\": \"KEY_LEFTSHIFT + KEY_U\",\r\n    \"V\": \"KEY_LEFTSHIFT + KEY_V\",\r\n    \"W\": \"KEY_LEFTSHIFT + KEY_W\",\r\n    \"X\": \"KEY_LEFTSHIFT + KEY_X\",\r\n    \"Y\": \"KEY_LEFTSHIFT + KEY_Y\",\r\n    \"Z\": \"KEY_LEFTSHIFT + KEY_Z\",\r\n    \"[\": \"KEY_LEFTBRACE\",\r\n    \"\\n\": \"KEY_ENTER\",\r\n    \"\\t\": \"KEY_TAB\",\r\n    \"]\": \"KEY_RIGHTBRACE\",\r\n    \"^\": \"KEY_LEFTSHIFT + KEY_6\",\r\n    \"_\": \"KEY_LEFTSHIFT + KEY_MINUS\",\r\n    \"`\": \"KEY_GRAVE\",\r\n    \"a\": \"KEY_A\",\r\n    \"b\": \"KEY_B\",\r\n    \"c\": \"KEY_C\",\r\n    \"d\": \"KEY_D\",\r\n    \"e\": \"KEY_E\",\r\n    \"f\": \"KEY_F\",\r\n    \"g\": \"KEY_G\",\r\n    \"h\": \"KEY_H\",\r\n    \"i\": \"KEY_I\",\r\n    \"j\": \"KEY_J\",\r\n    \"k\": \"KEY_K\",\r\n    \"l\": \"KEY_L\",\r\n    \"m\": \"KEY_M\",\r\n    \"n\": \"KEY_N\",\r\n    \"o\": \"KEY_O\",\r\n    \"p\": \"KEY_P\",\r\n    \"q\": \"KEY_Q\",\r\n    \"r\": \"KEY_R\",\r\n    \"s\": \"KEY_S\",\r\n    \"t\": \"KEY_T\",\r\n    \"u\": \"KEY_U\",\r\n    \"v\": \"KEY_V\",\r\n    \"w\": \"KEY_W\",\r\n    \"x\": \"KEY_X\",\r\n    \"y\": \"KEY_Y\",\r\n    \"z\": \"KEY_Z\",\r\n    \"{\": \"KEY_LEFTSHIFT + KEY_LEFTBRACE\",\r\n    \"}\": \"KEY_LEFTSHIFT + KEY_RIGHTBRACE\",\r\n    \"|\": \"KEY_LEFTSHIFT + KEY_BACKSLASH\",\r\n    \"~\": \"KEY_LEFTSHIFT + KEY_GRAVE\",\r\n    \"\u00e7\": \"KEY_LEFTALT + KEY_C\",\r\n    \"\u00c7\": \"KEY_LEFTALT + KEY_LEFTSHIFT + KEY_C\",\r\n    \"\u00df\": \"KEY_LEFTALT + KEY_S\",\r\n    \"\u1e9e\": \"KEY_LEFTSHIFT + KEY_LEFTALT + KEY_S\",\r\n    \"\\u0555\": \"KEY_LEFTCTRL + KEY_A\", # use some unicode symbols that you never use, and bind them to a key combination (select all in this case)\r\n    \"\\u0556\": \"KEY_LEFTCTRL + KEY_C\", # Combinations need to be separated by ' + '\r\n    \"\\u0557\": \"KEY_LEFTCTRL + KEY_V\",\r\n}\r\nadb_path = shutil.which(\"adb\")\r\ndevice_serial = \"127.0.0.1:5645\"  # use None when running directly on Android -> https://github.com/hansalemaos/termuxfree\r\ninput_device = \"/dev/input/event3\"  # use None when running directly on Android\r\nandroid_automation = SendEventKeysOnRoids(\r\n    adb_path=adb_path,\r\n    device_serial=device_serial,\r\n    input_device=input_device,\r\n    su_exe=\"su\",\r\n    blocksize=720,  # block size when using the dd command, this controls the execution speed of echo_input_text_dd/printf_input_text_dd\r\n    prefered_execution=\"exec\", # faster than eval\r\n    chunk_size=1024, # chunk size to create the file for dd \r\n    key_mapping_dict=my_key_mapping_dict,\r\n)\r\n# adb_shell = UniversalADBExecutor(adb_path, device_serial)\r\nmy_text = \"this is a test \u00c7\u00df\u00dfa\u00e7\u00c7q\u00df\u00df\u00df\u00df\u00df2\u00df\\u0555\\u0556\\u0557\\u0557\"\r\necho_input_text = android_automation.echo_input_text(text=my_text)\r\nprintf_input_text = android_automation.printf_input_text(text=my_text)\r\necho_input_text_dd = android_automation.echo_input_text_dd(text=my_text)\r\nprintf_input_text_dd = android_automation.printf_input_text_dd(text=my_text)\r\necho_input_keypress = android_automation.echo_input_keypress(key=\"A\", duration=1)\r\nprintf_input_keypress = android_automation.printf_input_keypress(key=\"B\", duration=1)\r\n\r\n# commands can be executed multiple times\r\necho_input_text()\r\nprintf_input_text()\r\necho_input_text_dd()\r\nprintf_input_text_dd()\r\necho_input_keypress()\r\nprintf_input_keypress()\r\n```\r\n\r\n```py\r\n    class SendEventKeysOnRoids(builtins.object)\r\n     |  SendEventKeysOnRoids(adb_path=None, device_serial=None, input_device='/dev/input/event3', su_exe='su', blocksize=72, prefered_execution: Literal['exec', 'eval'] = 'exec', chunk_size=1024, key_mapping_dict=None) -> None\r\n     |\r\n     |  A class to manage and send key events to an Android device. It uses ADB, but also runs directly on the device (rooted and Python installed) -> https://github.com/hansalemaos/termuxfree\r\n     |\r\n     |  This class prepares binary data for key events, converts them into different formats, and executes\r\n     |  corresponding commands on Android devices.\r\n     |\r\n     |  Methods defined here:\r\n     |\r\n     |  __init__(self, adb_path=None, device_serial=None, input_device='/dev/input/event3', su_exe='su', blocksize=72, prefered_execution: Literal['exec', 'eval'] = 'exec', chunk_size=1024, key_mapping_dict=None) -> None\r\n     |      Initializes the SendEventKeysOnRoids class with specified parameters.\r\n     |\r\n     |      Args:\r\n     |          adb_path (str, optional): Path to the ADB executable. Defaults to None.\r\n     |          device_serial (str, optional): Serial number of the target Android device. Defaults to None.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to \"/dev/input/event3\".\r\n     |          su_exe (str, optional): Command to gain superuser privileges on the Android device. Defaults to \"su\". ALWAYS NEEDED!\r\n     |          blocksize (int, optional): Block size for the `dd` command. Defaults to 72. This controls the speed, use steps of 72\r\n     |          prefered_execution (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to \"exec\".\r\n     |          chunk_size (int, optional): Chunk size for splitting data into base64 blocks. Defaults to 1024.\r\n     |          key_mapping_dict (dict, optional): Dictionary mapping keys to Linux key event codes. Defaults to None.\r\n     |\r\n     |      Attributes:\r\n     |          adb_path (str): Path to the ADB executable.\r\n     |          device_serial (str): Serial number of the target Android device.\r\n     |          input_device (str): Path to the input device on the Android device.\r\n     |          su_exe (str): Command to gain superuser privileges on the Android device.\r\n     |          blocksize (int): Block size for the `dd` command.\r\n     |          prefered_execution (str): Preferred method of command execution.\r\n     |          chunk_size (int): Chunk size for splitting data into base64 blocks.\r\n     |          key_mapping_dict (dict): Dictionary mapping keys to Linux key event codes.\r\n     |          all_linux_key_events_data (dict): Prepared binary data for all Linux key events.\r\n     |          adb_shell (UniversalADBExecutor): ADB shell executor instance.\r\n     |\r\n     |  echo_input_keypress(self, key, duration=1, input_device=None)\r\n     |      Generates a command to send a key press event to the specified input device using echo.\r\n     |\r\n     |      Args:\r\n     |          key (str): The key to press.\r\n     |          duration (int, optional): Duration to hold the key press. Defaults to 1 second.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n     |  echo_input_text(self, text, input_device=None)\r\n     |      Generates a command to send text input to the specified input device using echo.\r\n     |\r\n     |      Args:\r\n     |          text (str): The text to send as input.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n     |  echo_input_text_dd(self, text, output_path='/sdcard/echo_input_text_dd.bin', blocksize=None, sleep_after_each_execution=0, exec_or_eval=None, input_device=None)\r\n     |      Generates a command to send text input as binary data using echo and dd commands.\r\n     |\r\n     |      Args:\r\n     |          text (str): The text to send as input.\r\n     |          output_path (str, optional): Path to store the generated binary data on the device. Defaults to \"/sdcard/echo_input_text_dd.bin\".\r\n     |          blocksize (int, optional): Block size for the `dd` command. Defaults to the class's blocksize, this controls the speed, use steps of 72\r\n     |          sleep_after_each_execution (int, optional): Sleep duration between each command execution. Defaults to 0.\r\n     |          exec_or_eval (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to the class's prefered_execution.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n     |  printf_input_keypress(self, key, duration=1, input_device=None)\r\n     |      Generates a command to send a key press event to the specified input device using printf.\r\n     |\r\n     |      Args:\r\n     |          key (str): The key to press.\r\n     |          duration (int, optional): Duration to hold the key press. Defaults to 1 second.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n     |  printf_input_text(self, text, input_device=None)\r\n     |      Generates a command to send text input to the specified input device using printf.\r\n     |\r\n     |      Args:\r\n     |          text (str): The text to send as input.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n     |  printf_input_text_dd(self, text, output_path='/sdcard/printf_input_text_dd.bin', blocksize=None, sleep_after_each_execution=0, exec_or_eval=None, input_device=None)\r\n     |      Generates a command to send text input as binary data using printf and dd commands.\r\n     |\r\n     |      Args:\r\n     |          text (str): The text to send as input.\r\n     |          output_path (str, optional): Path to store the generated binary data on the device. Defaults to \"/sdcard/printf_input_text_dd.bin\".\r\n     |          blocksize (int, optional): Block size for the `dd` command. Defaults to the class's blocksize.\r\n     |          sleep_after_each_execution (int, optional): Sleep duration between each command execution. Defaults to 0.\r\n     |          exec_or_eval (str, optional): Preferred method of command execution ('exec' or 'eval'). Defaults to the class's prefered_execution.\r\n     |          input_device (str, optional): Path to the input device on the Android device. Defaults to the class's input_device.\r\n     |\r\n     |      Returns:\r\n     |          CodeExec: An instance of CodeExec class to execute the generated command.\r\n     |\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "sendevent without using sendevent - keystrokes on Android",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/sendkeysonroids"
    },
    "split_keywords": [
        "android",
        " adb",
        " sendevent",
        " utf-8",
        " keystrokes"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce7ce9ef17047d431460f776d2bcee1309bc5133ce8766c936e032df199529b8",
                "md5": "f5b53926bfe4168f06b2d43a5e2a54a9",
                "sha256": "9b467bc3f1500e0e891ff6e6fea45f4efbebc528d3a22888a694df7b7aaae5f4"
            },
            "downloads": -1,
            "filename": "sendkeysonroids-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f5b53926bfe4168f06b2d43a5e2a54a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 20004,
            "upload_time": "2024-07-18T05:12:59",
            "upload_time_iso_8601": "2024-07-18T05:12:59.966322Z",
            "url": "https://files.pythonhosted.org/packages/ce/7c/e9ef17047d431460f776d2bcee1309bc5133ce8766c936e032df199529b8/sendkeysonroids-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b3b8d7d71af6cafcabcc805e7852ceb70af2b82b3ff8e9467fc4391ff8768ca",
                "md5": "e2c7adf3f8622c1f32a886657ddd8170",
                "sha256": "8284b374b387924dd4e7dfd287cde649aa004246dc484db513b1ddf5b7c7a992"
            },
            "downloads": -1,
            "filename": "sendkeysonroids-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "e2c7adf3f8622c1f32a886657ddd8170",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19253,
            "upload_time": "2024-07-18T05:13:01",
            "upload_time_iso_8601": "2024-07-18T05:13:01.827085Z",
            "url": "https://files.pythonhosted.org/packages/2b/3b/8d7d71af6cafcabcc805e7852ceb70af2b82b3ff8e9467fc4391ff8768ca/sendkeysonroids-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-18 05:13:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "sendkeysonroids",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "sendkeysonroids"
}
        
Elapsed time: 0.28657s