Coverage for /private/tmp/im/impacket/impacket/dcerpc/v5/dhcpm.py : 59%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Author: Alberto Solino (@agsolino) # # Description: # [MS-DHCPM] Interface implementation # # Best way to learn how to use these calls is to grab the protocol standard # so you understand what the call does, and then read the test case located # at https://github.com/SecureAuthCorp/impacket/tree/master/tests/SMB_RPC # # Some calls have helper functions, which makes it even easier to use. # They are located at the end of this file. # Helper functions start with "h"<name of the call>. # There are test cases for them too. #
0x00004E2D: ("ERROR_DHCP_JET_ERROR", "An error occurred while accessing the DHCP server database."), 0x00004E25: ("ERROR_DHCP_SUBNET_NOT_PRESENT", "The specified IPv4 subnet does not exist."), 0x00004E54: ("ERROR_DHCP_SUBNET_EXISTS", "The IPv4 scope parameters are incorrect. Either the IPv4 scope already" " exists, corresponding to the SubnetAddress and SubnetMask members of " "the structure DHCP_SUBNET_INFO (section 2.2.1.2.8), or there is a " "range overlap of IPv4 addresses between those associated with the " "SubnetAddress and SubnetMask fields of the new IPv4 scope and the " "subnet address and mask of an already existing IPv4 scope"),
}
else:
################################################################################ # CONSTANTS ################################################################################
# DHCP enumeratiom flags
# Errors ################################################################################ # STRUCTURES ################################################################################ # 2.2.1.1.3 DHCP_SEARCH_INFO_TYPE
# 2.2.1.1.11 QuarantineStatus
# 2.2.1.2.7 DHCP_HOST_INFO ('IpAddress', DHCP_IP_ADDRESS), ('NetBiosName', LPWSTR), ('HostName', LPWSTR), )
# 2.2.1.2.9 DHCP_BINARY_DATA
('Data', BYTE_ARRAY), )
('DataLength', DWORD), ('Data_', PBYTE_ARRAY), )
# 2.2.1.2.11 DATE_TIME ('dwLowDateTime', DWORD), ('dwHighDateTime', DWORD), )
# 2.2.1.2.19 DHCP_CLIENT_INFO_VQ ('ClientIpAddress', DHCP_IP_ADDRESS), ('SubnetMask', DHCP_IP_MASK), ('ClientHardwareAddress', DHCP_CLIENT_UID), ('ClientName', LPWSTR), ('ClientComment', LPWSTR), ('ClientLeaseExpires', DATE_TIME), ('OwnerHost', DHCP_HOST_INFO), ('bClientType', BYTE), ('AddressState', BYTE), ('Status', QuarantineStatus), ('ProbationEnds', DATE_TIME), ('QuarantineCapable', BOOL), )
DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress: ('ClientIpAddress', DHCP_IP_ADDRESS), DHCP_SEARCH_INFO_TYPE.DhcpClientHardwareAddress: ('ClientHardwareAddress', DHCP_CLIENT_UID), DHCP_SEARCH_INFO_TYPE.DhcpClientName: ('ClientName', LPWSTR), }
('SearchType', DHCP_SEARCH_INFO_TYPE), ('SearchInfo', DHCP_CLIENT_SEARCH_UNION), )
# 2.2.1.2.14 DHCP_CLIENT_INFO_V4 ('ClientIpAddress', DHCP_IP_ADDRESS), ('SubnetMask', DHCP_IP_MASK), ('ClientHardwareAddress', DHCP_CLIENT_UID), ('ClientName', LPWSTR), ('ClientComment', LPWSTR), ('ClientLeaseExpires', DATE_TIME), ('OwnerHost', DHCP_HOST_INFO), ('bClientType', BYTE), )
('ClientIpAddress', DHCP_IP_ADDRESS), ('SubnetMask', DHCP_IP_MASK), ('ClientHardwareAddress', DHCP_CLIENT_UID), ('ClientName', LPWSTR), ('ClientComment', LPWSTR), ('ClientLeaseExpires', DATE_TIME), ('OwnerHost', DHCP_HOST_INFO), ('bClientType', BYTE), ('AddressState', BYTE), )
('Data', DHCP_CLIENT_INFO_V4), )
('Data', DHCP_CLIENT_INFO_V5), )
# 2.2.1.2.115 DHCP_CLIENT_INFO_PB ('ClientIpAddress', DHCP_IP_ADDRESS), ('SubnetMask', DHCP_IP_MASK), ('ClientHardwareAddress', DHCP_CLIENT_UID), ('ClientName', LPWSTR), ('ClientComment', LPWSTR), ('ClientLeaseExpires', DATE_TIME), ('OwnerHost', DHCP_HOST_INFO), ('bClientType', BYTE), ('AddressState', BYTE), ('Status', QuarantineStatus), ('ProbationEnds', DATE_TIME), ('QuarantineCapable', BOOL), ('FilterStatus', DWORD), ('PolicyName', LPWSTR), )
('Data', DHCP_CLIENT_INFO_PB), )
('Data', DHCP_CLIENT_INFO_VQ), )
('Data', DHCP_CLIENT_INFO_VQ_ARRAY), )
('NumElements', DWORD), ('Clients', LPDHCP_CLIENT_INFO_VQ_ARRAY), )
('Data', DHCP_CLIENT_INFO_ARRAY_VQ), )
('Data', DHCP_CLIENT_INFO_V4_ARRAY), )
('Data', DHCP_CLIENT_INFO_V5_ARRAY), )
('NumElements', DWORD), ('Clients', LPDHCP_CLIENT_INFO_V4_ARRAY), )
('NumElements', DWORD), ('Clients', LPDHCP_CLIENT_INFO_V4_ARRAY), )
('Data', DHCP_CLIENT_INFO_ARRAY_V5), )
('Data', DHCP_CLIENT_INFO_ARRAY_V4), )
('Data', DHCP_IP_ADDRESS_ARRAY), )
('NumElements', DWORD), ('Elements', LPDHCP_IP_ADDRESS_ARRAY), )
('SubnetAddress', DHCP_IP_ADDRESS), ('SubnetMask', DHCP_IP_MASK), ('SubnetName', LPWSTR), ('SubnetComment', LPWSTR), ('PrimaryHost', DHCP_HOST_INFO), ('SubnetState', DHCP_SUBNET_STATE), )
('Data', DHCP_SUBNET_INFO), )
('ReservedIpAddress', DHCP_IP_ADDRESS), ('ReservedIpSubnetAddress', DHCP_IP_ADDRESS), )
DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions : (), DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions : (), DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions : ('SubnetScopeInfo', DHCP_IP_ADDRESS), DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions : ('ReservedScopeInfo', DHCP_RESERVED_SCOPE), DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions : ('MScopeInfo', LPWSTR), }
('ScopeType', DHCP_OPTION_SCOPE_TYPE), ('ScopeInfo', DHCP_OPTION_SCOPE_UNION), )
('Data', DHCP_OPTION_SCOPE_INFO) )
('DWord1', DWORD), ('DWord2', DWORD), )
('StartAddress', DHCP_IP_ADDRESS), ('EndAddress', DHCP_IP_ADDRESS), ('BootpAllocated', ULONG), ('MaxBootpAllowed', DHCP_IP_ADDRESS), ('MaxBootpAllowed', ULONG ), )
('ReservedIpAddress', DHCP_IP_ADDRESS), ('ReservedForClient', DHCP_CLIENT_UID), ('bAllowedClientTypes', BYTE), )
('StartAddress', DHCP_IP_ADDRESS), ('EndAddress', DHCP_IP_ADDRESS), )
('ClusterAddress', DHCP_IP_ADDRESS), ('ClusterMask', DWORD), )
DHCP_SUBNET_ELEMENT_TYPE.DhcpIpRanges : ('IpRange', DHCP_BOOTP_IP_RANGE), DHCP_SUBNET_ELEMENT_TYPE.DhcpSecondaryHosts : ('SecondaryHost', DHCP_HOST_INFO), DHCP_SUBNET_ELEMENT_TYPE.DhcpReservedIps : ('ReservedIp', DHCP_IP_RESERVATION_V4), DHCP_SUBNET_ELEMENT_TYPE.DhcpExcludedIpRanges : ('ExcludeIpRange', DHCP_IP_RANGE), DHCP_SUBNET_ELEMENT_TYPE.DhcpIpUsedClusters : ('IpUsedCluster', DHCP_IP_CLUSTER), }
('ElementType', DHCP_SUBNET_ELEMENT_TYPE), ('Element', DHCP_SUBNET_ELEMENT_UNION_V5), )
('NumElements', DWORD), ('Elements', LPDHCP_SUBNET_ELEMENT_DATA_V5), )
('Data', DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5) )
('tag', DHCP_OPTION_DATA_TYPE), ) DHCP_OPTION_DATA_TYPE.DhcpByteOption : ('ByteOption', BYTE), DHCP_OPTION_DATA_TYPE.DhcpWordOption : ('WordOption', WORD), DHCP_OPTION_DATA_TYPE.DhcpDWordOption : ('DWordOption', DWORD), DHCP_OPTION_DATA_TYPE.DhcpDWordDWordOption : ('DWordDWordOption', DWORD_DWORD), DHCP_OPTION_DATA_TYPE.DhcpIpAddressOption : ('IpAddressOption', DHCP_IP_ADDRESS), DHCP_OPTION_DATA_TYPE.DhcpStringDataOption : ('StringDataOption', LPWSTR), DHCP_OPTION_DATA_TYPE.DhcpBinaryDataOption : ('BinaryDataOption', DHCP_BINARY_DATA), DHCP_OPTION_DATA_TYPE.DhcpEncapsulatedDataOption: ('EncapsulatedDataOption', DHCP_BINARY_DATA), DHCP_OPTION_DATA_TYPE.DhcpIpv6AddressOption : ('Ipv6AddressDataOption', LPWSTR), }
('OptionType', DHCP_OPTION_DATA_TYPE), ('Element', DHCP_OPTION_ELEMENT_UNION), )
('Data', DHCP_OPTION_DATA_ELEMENT_ARRAY2), )
('NumElements', DWORD), ('Elements', LPDHCP_OPTION_DATA_ELEMENT), )
('OptionID', DHCP_OPTION_ID), ('Value', DHCP_OPTION_DATA), )
('Data', DHCP_OPTION_VALUE), )
('Data', DHCP_OPTION_VALUE_ARRAY2), )
('NumElements', DWORD), ('Values', LPDHCP_OPTION_VALUE), )
('Data', DHCP_OPTION_VALUE_ARRAY), )
('ClassName', LPWSTR), ('VendorName', LPWSTR), ('IsVendor', BOOL), ('OptionsArray', LPDHCP_OPTION_VALUE_ARRAY), )
('Data', OPTION_VALUES_ARRAY), )
('Flags', DWORD), ('NumElements', DWORD), ('Options', LPOPTION_VALUES_ARRAY), )
('Data', DHCP_ALL_OPTIONS_VALUES), )
################################################################################ # RPC CALLS ################################################################################ # Interface dhcpsrv ('ServerIpAddress', DHCP_SRV_HANDLE), ('SubnetAddress', DHCP_IP_ADDRESS), )
('SubnetInfo', LPDHCP_SUBNET_INFO), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', LPDWORD), ('EnumInfo', DHCP_IP_ARRAY), ('EnumRead', DWORD), ('EnumTotal', DWORD), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('OptionID', DHCP_OPTION_ID), ('ScopeInfo', DHCP_OPTION_SCOPE_INFO), )
('OptionValue', PDHCP_OPTION_VALUE), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('ScopeInfo', DHCP_OPTION_SCOPE_INFO), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', DWORD), ('OptionValues', LPDHCP_OPTION_VALUE_ARRAY), ('OptionsRead', DWORD), ('OptionsTotal', DWORD), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('SearchInfo', DHCP_SEARCH_INFO), )
('ClientInfo', LPDHCP_CLIENT_INFO_V4), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('SubnetAddress', DHCP_IP_ADDRESS), ('ResumeHandle', DWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', LPDWORD), ('ClientInfo', LPDHCP_CLIENT_INFO_ARRAY_V4), ('ClientsRead', DWORD), ('ClientsTotal', DWORD), ('ErrorCode', ULONG), )
# Interface dhcpsrv2
('ServerIpAddress', DHCP_SRV_HANDLE), ('SubnetAddress', DHCP_IP_ADDRESS), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', DWORD), ('ClientsInfo', LPDHCP_CLIENT_INFO_ARRAY_V5), ('ClientsRead', DWORD), ('ClientsTotal', DWORD), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('Flags', DWORD), ('OptionID', DHCP_OPTION_ID), ('ClassName', LPWSTR), ('VendorName', LPWSTR), ('ScopeInfo', DHCP_OPTION_SCOPE_INFO), )
('OptionValue', PDHCP_OPTION_VALUE), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('Flags', DWORD), ('ClassName', LPWSTR), ('VendorName', LPWSTR), ('ScopeInfo', DHCP_OPTION_SCOPE_INFO), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', DWORD), ('OptionValues', LPDHCP_OPTION_VALUE_ARRAY), ('OptionsRead', DWORD), ('OptionsTotal', DWORD), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('Flags', DWORD), ('ScopeInfo', DHCP_OPTION_SCOPE_INFO), )
('Values', LPDHCP_ALL_OPTION_VALUES), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('SubnetAddress', DHCP_IP_ADDRESS), ('EnumElementType', DHCP_SUBNET_ELEMENT_TYPE), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', DWORD), ('EnumElementInfo', LPDHCP_SUBNET_ELEMENT_INFO_ARRAY_V5), ('ElementsRead', DWORD), ('ElementsTotal', DWORD), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('SubnetAddress', DHCP_IP_ADDRESS), ('ResumeHandle', LPDWORD), ('PreferredMaximum', DWORD), )
('ResumeHandle', LPDWORD), ('ClientInfo', LPDHCP_CLIENT_INFO_ARRAY_VQ), ('ClientsRead', DWORD), ('ClientsTotal', DWORD), ('ErrorCode', ULONG), )
('ServerIpAddress', DHCP_SRV_HANDLE), ('SearchInfo', DHCP_SEARCH_INFO), )
('ClientInfo', LPDHCP_CLIENT_INFO_PB), ('ErrorCode', ULONG), )
################################################################################ # OPNUMs and their corresponding structures ################################################################################ 0: (DhcpEnumSubnetClientsV5, DhcpEnumSubnetClientsV5Response), 2: (DhcpGetSubnetInfo, DhcpGetSubnetInfoResponse), 3: (DhcpEnumSubnets, DhcpEnumSubnetsResponse), 13: (DhcpGetOptionValue, DhcpGetOptionValueResponse), 14: (DhcpEnumOptionValues, DhcpEnumOptionValuesResponse), 21: (DhcpGetOptionValueV5, DhcpGetOptionValueV5Response), 22: (DhcpEnumOptionValuesV5, DhcpEnumOptionValuesV5Response), 30: (DhcpGetAllOptionValues, DhcpGetAllOptionValuesResponse), 34: (DhcpGetClientInfoV4, DhcpGetClientInfoV4Response), 35: (DhcpEnumSubnetClientsV4, DhcpEnumSubnetClientsV4Response), 38: (DhcpEnumSubnetElementsV5, DhcpEnumSubnetElementsV5Response), 47: (DhcpEnumSubnetClientsVQ, DhcpEnumSubnetClientsVQResponse), 123: (DhcpV4GetClientInfo, DhcpV4GetClientInfoResponse), }
################################################################################ # HELPER FUNCTIONS ################################################################################
# This should be a DHCP_BINARY_DATA request['SearchInfo']['SearchInfo']['ClientHardwareAddress'] = searchValue else:
request = DhcpGetSubnetInfo()
request['ServerIpAddress'] = NULL request['SubnetAddress'] = subnetaddress resp = dce.request(request)
return resp
request = DhcpGetOptionValue()
request['ServerIpAddress'] = NULL request['OptionID'] = optionID request['ScopeInfo']['ScopeType'] = scopetype if scopetype != DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions and scopetype != DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions: request['ScopeInfo']['ScopeInfo']['tag'] = scopetype if scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions: request['ScopeInfo']['ScopeInfo']['SubnetScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions: request['ScopeInfo']['ScopeInfo']['ReservedScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions: request['ScopeInfo']['ScopeInfo']['MScopeInfo'] = options
status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet() return resp
preferredMaximum=0xffffffff): request = DhcpEnumOptionValues()
request['ServerIpAddress'] = NULL request['ScopeInfo']['ScopeType'] = scopetype if scopetype != DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions and scopetype != DHCP_OPTION_SCOPE_TYPE.DhcpGlobalOptions: request['ScopeInfo']['ScopeInfo']['tag'] = scopetype if scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions: request['ScopeInfo']['ScopeInfo']['SubnetScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions: request['ScopeInfo']['ScopeInfo']['ReservedScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions: request['ScopeInfo']['ScopeInfo']['MScopeInfo'] = options request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum
status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet() return resp
scopetype=DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions, options=NULL, preferredMaximum=0xffffffff): request = DhcpEnumOptionValuesV5()
request['ServerIpAddress'] = NULL request['Flags'] = flags request['ClassName'] = classname request['VendorName'] = vendorname request['ScopeInfo']['ScopeType'] = scopetype request['ScopeInfo']['ScopeInfo']['tag'] = scopetype if scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions: request['ScopeInfo']['ScopeInfo']['SubnetScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions: request['ScopeInfo']['ScopeInfo']['ReservedScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions: request['ScopeInfo']['ScopeInfo']['MScopeInfo'] = options request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum
status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet() return resp
scopetype=DHCP_OPTION_SCOPE_TYPE.DhcpDefaultOptions, options=NULL):
elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions: request['ScopeInfo']['ScopeInfo']['ReservedScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions: request['ScopeInfo']['ScopeInfo']['MScopeInfo'] = options
except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet()
request = DhcpGetAllOptionValues()
request['ServerIpAddress'] = NULL request['Flags'] = NULL request['ScopeInfo']['ScopeType'] = scopetype request['ScopeInfo']['ScopeInfo']['tag'] = scopetype if scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpSubnetOptions: request['ScopeInfo']['ScopeInfo']['SubnetScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpReservedOptions: request['ScopeInfo']['ScopeInfo']['ReservedScopeInfo'] = options elif scopetype == DHCP_OPTION_SCOPE_TYPE.DhcpMScopeOptions: request['ScopeInfo']['ScopeInfo']['MScopeInfo'] = options
status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet() return resp
request = DhcpEnumSubnets()
request['ServerIpAddress'] = NULL request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('STATUS_MORE_ENTRIES') < 0: raise resp = e.get_packet() return resp
request = DhcpEnumSubnetClientsVQ()
request['ServerIpAddress'] = NULL request['SubnetAddress'] = NULL request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('STATUS_MORE_ENTRIES') < 0: raise resp = e.get_packet() return resp
request = DhcpEnumSubnetClientsV4()
request['ServerIpAddress'] = NULL request['SubnetAddress'] = NULL request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('STATUS_MORE_ENTRIES') < 0: raise resp = e.get_packet() return resp
resp = e.get_packet() return resp
request = DhcpEnumSubnetElementsV5()
request['ServerIpAddress'] = NULL request['SubnetAddress'] = subnet_address request['EnumElementType'] = element_type request['ResumeHandle'] = NULL request['PreferredMaximum'] = preferredMaximum
status = system_errors.ERROR_MORE_DATA while status == system_errors.ERROR_MORE_DATA: try: resp = dce.request(request) except DCERPCException as e: if str(e).find('ERROR_NO_MORE_ITEMS') < 0: raise resp = e.get_packet() return resp |