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.
22 lines
644 B
Python
22 lines
644 B
Python
def pretty_print_ctypes_type(t):
|
|
format = "{0}"
|
|
if issubclass(t, ctypes.Array):
|
|
format = "[{0}" + "* {0}]".format(t._length_)
|
|
t = t._type_
|
|
|
|
if issubclass(t, ctypes._Pointer):
|
|
format = format.format("Pointer({0})")
|
|
t = t._type_
|
|
|
|
if issubclass(t, ctypes.Structure):
|
|
return format.format(":class:`{0}`".format(t.__name__))
|
|
return t
|
|
|
|
|
|
def autodoc_ctypes_struct(struct):
|
|
doc = ["fields:"]
|
|
for name, type in struct._fields_:
|
|
doc.append(" {0} -> {1}".format(name, pretty_print_ctypes_type(type)))
|
|
|
|
struct.__doc__ = "\n\n".join(doc)
|
|
return struct |