1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-20 14:39:22 +01:00

Land #606, minor fixes for Python 2.5

minor fixes to make python meterpreter comptaible with Python 2.5
This commit is contained in:
Spencer McIntyre 2023-02-17 11:55:42 -05:00
commit ea70c919f1
No known key found for this signature in database
GPG Key ID: 58101BA0D0D9C987
2 changed files with 14 additions and 13 deletions

View File

@ -1865,7 +1865,7 @@ def stdapi_net_config_get_arp_table(request, response):
result = GetIpNetTable(ipnet_table, size, False) result = GetIpNetTable(ipnet_table, size, False)
if result == ERROR_INSUFFICIENT_BUFFER: if result == ERROR_INSUFFICIENT_BUFFER:
ipnet_table = ctypes.cast(ctypes.create_string_buffer(b'', size.value), ctypes.c_void_p) ipnet_table = ctypes.cast(ctypes.create_string_buffer(bytes(), size.value), ctypes.c_void_p)
elif result != ERROR_SUCCESS and result != ERROR_NO_DATA: elif result != ERROR_SUCCESS and result != ERROR_NO_DATA:
return error_result_windows(result), response return error_result_windows(result), response

View File

@ -361,18 +361,19 @@ if DEBUGGING:
file_handler.setLevel(logging.DEBUG) file_handler.setLevel(logging.DEBUG)
logging.getLogger().addHandler(file_handler) logging.getLogger().addHandler(file_handler)
class SYSTEM_INFO(ctypes.Structure): if has_windll:
_fields_ = [("wProcessorArchitecture", ctypes.c_uint16), class SYSTEM_INFO(ctypes.Structure):
("wReserved", ctypes.c_uint16), _fields_ = [("wProcessorArchitecture", ctypes.c_uint16),
("dwPageSize", ctypes.c_uint32), ("wReserved", ctypes.c_uint16),
("lpMinimumApplicationAddress", ctypes.c_void_p), ("dwPageSize", ctypes.c_uint32),
("lpMaximumApplicationAddress", ctypes.c_void_p), ("lpMinimumApplicationAddress", ctypes.c_void_p),
("dwActiveProcessorMask", ctypes.c_uint32), ("lpMaximumApplicationAddress", ctypes.c_void_p),
("dwNumberOfProcessors", ctypes.c_uint32), ("dwActiveProcessorMask", ctypes.c_uint32),
("dwProcessorType", ctypes.c_uint32), ("dwNumberOfProcessors", ctypes.c_uint32),
("dwAllocationGranularity", ctypes.c_uint32), ("dwProcessorType", ctypes.c_uint32),
("wProcessorLevel", ctypes.c_uint16), ("dwAllocationGranularity", ctypes.c_uint32),
("wProcessorRevision", ctypes.c_uint16)] ("wProcessorLevel", ctypes.c_uint16),
("wProcessorRevision", ctypes.c_uint16)]
def rand_bytes(n): def rand_bytes(n):
return os.urandom(n) return os.urandom(n)