P
P
petrushik2021-10-31 02:48:46
Python
petrushik, 2021-10-31 02:48:46

Why doesn't the script send code directly to the application?

There is a script that, as planned, should send text input to the notepad, but this does not happen (Individually, everything is done, but the injection does not occur)

import pymem
import subprocess
from time import sleep

try:
    mem = pymem.Pymem('notepad.exe')
except:
    subprocess.Popen('notepad.exe')
    mem = pymem.Pymem('notepad.exe')

mem.inject_python_interpreter()
sleep(1)
code = """
from pywinauto import keyboard

keyboard.send_keys("{VK_SHIFT down}"
          "pywinauto"
          "{VK_SHIFT up}")
"""

mem.inject_python_shellcode(code)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question