mirror of
https://github.com/naksyn/PythonMemoryModule
synced 2026-06-06 16:24:25 +00:00
db1893910c
This update include support to passing command line parameters to unmanaged exe via PEB stomping. This technique is not working with every executable since it depends on which functions are used to pass arguments. Generally, to get a universally working technique would be required to hook GetCommandlineA GetCommandlineW __getmainargs and __wgetmainargs since PEB stomping won't cover all cases, more details here: https://blog-30cm-tw.translate.goog/2020/08/windows-c-mainargc-argv.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=it&_x_tr_pto=wapp However, during my testing I found that mimikatz and several go binaries are working just by doing PEB stomping. On the other hand, cmdline passing via PEB stomping alone to mingw and VS compiled binaries won't likely work.
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""
|
|
Python for Windows
|
|
A lot of python object to help navigate windows stuff
|
|
|
|
Exported:
|
|
|
|
system : :class:`windows.winobject.System`
|
|
|
|
current_process : :class:`windows.winobject.CurrentProcess`
|
|
|
|
current_thread : :class:`windows.winobject.CurrentThread`
|
|
"""
|
|
|
|
# check we are on windows
|
|
import sys
|
|
if sys.platform != "win32":
|
|
raise NotImplementedError("It's called PythonForWindows not PythonFor{0}".format(sys.platform.capitalize()))
|
|
|
|
import warnings
|
|
warnings.filterwarnings('once', category=DeprecationWarning, module=__name__)
|
|
|
|
from windows import winproxy
|
|
from windows import winobject
|
|
|
|
from .winobject.system import System
|
|
from .winobject.process import CurrentProcess, CurrentThread, WinProcess, WinThread
|
|
from .winobject.file import WinFile
|
|
|
|
|
|
system = System()
|
|
current_process = CurrentProcess()
|
|
current_thread = CurrentThread()
|
|
|
|
del System
|
|
del CurrentProcess
|
|
del CurrentThread
|
|
|
|
# Late import: other imports should go here
|
|
# Do not move it: risk of circular import
|
|
|
|
import windows.utils
|
|
import windows.wintrust
|
|
import windows.syswow64
|
|
import windows.com
|
|
|
|
__all__ = ["system", 'current_process', 'current_thread']
|