diff --git a/examples/wmiquery.py b/examples/wmiquery.py index 433d7fc669..34527f5391 100755 --- a/examples/wmiquery.py +++ b/examples/wmiquery.py @@ -101,10 +101,10 @@ def printReply(self, iEnum): print('%s |' % record[key]['value'], end=' ') print() except Exception as e: - if logging.getLogger().level == logging.DEBUG: - import traceback - traceback.print_exc() if str(e).find('S_FALSE') < 0: + if logging.getLogger().level == logging.DEBUG: + import traceback + traceback.print_exc() raise else: break diff --git a/impacket/dcerpc/v5/dcom/wmi.py b/impacket/dcerpc/v5/dcom/wmi.py index 79a1fb1afc..3f24facf1f 100644 --- a/impacket/dcerpc/v5/dcom/wmi.py +++ b/impacket/dcerpc/v5/dcom/wmi.py @@ -2613,7 +2613,7 @@ def SpawnInstance(self): def createProperties(self, properties): for property in properties: # Do we have an object property? - if properties[property]['type'] == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value: + if properties[property]['type'] == CIM_TYPE_ENUM.CIM_TYPE_OBJECT.value and properties[property]['value'] != None: # Yes.. let's create an Object for it too objRef = OBJREF_CUSTOM() objRef['iid'] = self._iid