kmaork / hypno

Inject python code into a running python process
MIT License
88 stars 13 forks source link

pyinjector.pyinjector.InjectorError: injector_inject returned -5, see error code definition in injector/include/injector.h #6

Closed Spindermoon1 closed 3 years ago

Spindermoon1 commented 3 years ago

I have no idea what to do after this. I'm on windows 10.

C:\Users\dmale>hypno 17752 x=1
~~ATTACHING
RET ZERO-VALUE: 0 EXCEPTION_MAP: {-8: <class 'pyinjector.pyinjector.InjectorPermissionError'>} UNDER: ATTACH
+FINISHED ATTACHING FUNCTION
~~INJECTING **didn't finish the injecting part**
RET VALUE: -5 EXCEPTION_MAP: None UNDER: INJECT
~~DEATTACHING
RET ZERO-VALUE: 0 EXCEPTION_MAP: None UNDER: DEATTACH
+FINISHED DEATTACHING FUNCTION
Traceback (most recent call last):
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\Scripts\hypno-script.py", line 11, in <module>
    load_entry_point('hypno==0.1.3', 'console_scripts', 'hypno')()
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\lib\site-packages\hypno-0.1.3-py3.7-win-amd64.egg\hypno\__main__.py", line 16, in main
    inject_py(parsed_args.pid, parsed_args.python_code)
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\lib\site-packages\hypno-0.1.3-py3.7-win-amd64.egg\hypno\hypno.py", line 20, in inject_py
    inject(pid, str(copied_lib))
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinjector\pyinjector.py", line 91, in inject
    injector.inject(library_path)
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinjector\pyinjector.py", line 79, in inject
    call_c_func(libinjector.injector_inject, self.injector_p, library_path, custom_msg='INJECT') #<-------- HERE THE ERROR HAPPENS
  File "C:\Users\dmale\AppData\Local\Programs\Python\Python37\lib\site-packages\pyinjector\pyinjector.py", line 56, in call_c_func
    raise exception_cls(func.__name__, ret)
pyinjector.pyinjector.InjectorError: injector_inject returned -5, see error code definition in injector/include/injector.h

image I tried injecting to all available pids.

More eye-pleasing version: image

kmaork commented 3 years ago

Hey @Spindermoon1 , thank you for bringing the issue to my attention. Actually, as mentioned in #3, I haven't found the time to make hypno support Windows yet, although it shouldn't be very hard. According to your comment in #5 , it seems that you may have made a step towards that goal, would you mind adding another comment there explaining what you did? Anyway, I have published a newer version of pyinjector that has more detailed error messages. Try running pip install pyinjector=1.0.2 and then retry hypno.

Spindermoon1 commented 3 years ago

Great I'll check it out. Also, do you have any social media that I can contact you to ask some questions about how your program works? I can't fully understand it that's why.

kmaork commented 3 years ago

I've opened a discord channel for the repo: https://discord.gg/P3mN92eM2X

Spindermoon1 commented 3 years ago

Hello, I joined the discord server and I have explained what I did to "hotfix" hypno to make it work. Also I posted some more things.

kmaork commented 2 years ago

I now released hypno==1.0.0 which supports Windows and uploaded windows wheels to pypi 😄