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.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import ctypes
|
|
import windows.generated_def as gdef
|
|
|
|
from ..apiproxy import ApiProxy, NeededParameter
|
|
from ..error import fail_on_zero, result_is_error_code, no_error_check
|
|
|
|
class DNSapiProxy(ApiProxy):
|
|
APIDLL = "dnsapi"
|
|
default_error_check = staticmethod(fail_on_zero)
|
|
|
|
|
|
@DNSapiProxy()
|
|
def DnsGetCacheDataTable(DnsEntries):
|
|
return DnsGetCacheDataTable.ctypes_function(DnsEntries)
|
|
|
|
|
|
@DNSapiProxy(error_check=result_is_error_code)
|
|
def DnsQuery_A(pszName, wType, Options, pExtra, ppQueryResults, pReserved):
|
|
return DnsQuery_A.ctypes_function(pszName, wType, Options, pExtra, ppQueryResults, pReserved)
|
|
|
|
|
|
@DNSapiProxy(error_check=result_is_error_code)
|
|
def DnsQuery_W(pszName, wType, Options, pExtra, ppQueryResults, pReserved):
|
|
return DnsQuery_W.ctypes_function(pszName, wType, Options, pExtra, ppQueryResults, pReserved)
|
|
|
|
@DNSapiProxy(error_check=result_is_error_code)
|
|
def DnsQueryEx(pQueryRequest, pQueryResults, pCancelHandle):
|
|
return DnsQueryEx.ctypes_function(pQueryRequest, pQueryResults, pCancelHandle)
|
|
|
|
@DNSapiProxy(error_check=no_error_check)
|
|
def DnsFree(pData, FreeType):
|
|
return DnsFree.ctypes_function(pData, FreeType)
|