Skip to content

Commit 6df5b98

Browse files
authored
Fix confusion between propertyType and cimType (#2035)
1 parent 2e51825 commit 6df5b98

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

impacket/dcerpc/v5/dcom/wmi.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class ENCODED_VALUE(Structure):
316316
def getValue(cls, cimType, entry, heap):
317317
# Let's get the default Values
318318
pType = cimType & (~(CIM_ARRAY_FLAG|Inherited))
319-
319+
cimType = cimType & (~Inherited)
320320
if entry != 0xffffffff:
321321
heapData = heap[entry:]
322322
if cimType & CIM_ARRAY_FLAG:
@@ -926,9 +926,10 @@ def printClass(self, pClass, cInstance = None):
926926
print('\t[%s(%s)]' % (qName, qualifiers[qName]))
927927
print("\t%s %s" % (properties[pName]['stype'], properties[pName]['name']), end=' ')
928928
if properties[pName]['value'] is not None:
929-
if properties[pName]['type'] == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value:
929+
cimType = properties[pName]['type'] & (~Inherited)
930+
if cimType == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value:
930931
print('= IWbemClassObject\n')
931-
elif properties[pName]['type'] == CIM_TYPE_ENUM.CIM_ARRAY_OBJECT.value:
932+
elif cimType == CIM_TYPE_ENUM.CIM_ARRAY_OBJECT.value:
932933
if properties[pName]['value'] == 0:
933934
print('= %s\n' % properties[pName]['value'])
934935
else:
@@ -2613,7 +2614,8 @@ def SpawnInstance(self):
26132614
def createProperties(self, properties):
26142615
for property in properties:
26152616
# Do we have an object property?
2616-
if properties[property]['type'] == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value and properties[property]['value'] != None:
2617+
cimType = properties[property]['type'] & (~Inherited)
2618+
if cimType == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value and properties[property]['value'] != None:
26172619
# Yes.. let's create an Object for it too
26182620
objRef = OBJREF_CUSTOM()
26192621
objRef['iid'] = self._iid
@@ -2623,7 +2625,7 @@ def createProperties(self, properties):
26232625
objRef['pObjectData'] = properties[property]['value']
26242626
value = IWbemClassObject( INTERFACE(self.get_cinstance(), objRef.getData(), self.get_ipidRemUnknown(),
26252627
oxid=self.get_oxid(), target=self.get_target()))
2626-
elif properties[property]['type'] == CIM_TYPE_ENUM.CIM_ARRAY_OBJECT.value:
2628+
elif cimType == CIM_TYPE_ENUM.CIM_ARRAY_OBJECT.value:
26272629
if isinstance(properties[property]['value'], list):
26282630
value = list()
26292631
for item in properties[property]['value']:

0 commit comments

Comments
 (0)