Hi-
I have a Python OpenDXL application that listens for TIE reputation change events. Once a reputation change event is received, I want to make a call to VirusTotal to get information about the file whose reputation has changed. My application currently uses the TIE Client Library as well as the VirusTotal Client Library (and its associated service).
However, I receive the following error message when a reputation change event is received and I attempt to invoke the VirusTotal service:
DxlException: Synchronous requests may not be invoked while handling an incoming message. The synchronous request must be made on a different thread.
Here's the code for my callback:
Python: Reputation Change Callback
- class MyReputationChangeCallback(ReputationChangeCallback):
- def __init__(self, dxl_client):
- super(MyReputationChangeCallback, self).__init__()
- self.dxl_client = dxl_client
- def on_reputation_change(self, rep_change_dict, original_event):
- # Display the DXL topic that the event was received on
- print "Reputation change on topic: " + original_event.destination_topic
- # Dump the reputation change dictionary
- print json.dumps(rep_change_dict,
- sort_keys=True, indent=4, separators=(',', ': '))
- # Extract MD5 value
- md5 = rep_change_dict[RepChangeEventProp.HASHES][HashType.MD5]
- # Invoke VirusTotal
- vtapi_client = VirusTotalApiClient(self.dxl_client)
- vtapi_response_dict = vtapi_client.file_report(resource=md5)
- # Dump the VirusTotal dictionary
- print json.dumps(vtapi_response_dict,
- sort_keys=True, indent=4, separators=(',', ': '))
Any ideas why this might be happening?
Greatly appreciate any help,
Mark