Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor fix for another empty keys in dict

  • Loading branch information...
commit 00dd21aea9b3461ead92c617a695556208de0b4b 1 parent 9673c19
@jekil jekil authored
Showing with 22 additions and 18 deletions.
  1. +6 −4 cuckoo/reporting/tasks/maec.py
  2. +16 −14 cuckoo/reporting/tasks/metadata.py
View
10 cuckoo/reporting/tasks/maec.py
@@ -109,10 +109,12 @@ def addActions(self):
for process in self.results['behavior']['processes']:
self.createActionAPI(process)
# Network
- for pkt in self.results['network']['udp']:
- self.createActionNet(pkt)
- for pkt in self.results['network']['tcp']:
- self.createActionNet(pkt)
+ if len(self.results['network']['udp']) > 0:
+ for pkt in self.results['network']['udp']:
+ self.createActionNet(pkt)
+ if len(self.results['network']['tcp']) > 0:
+ for pkt in self.results['network']['tcp']:
+ self.createActionNet(pkt)
def createActionNet(self, packet):
act = maec.ActionType(
View
30 cuckoo/reporting/tasks/metadata.py
@@ -66,22 +66,24 @@ def addObjects(self):
# Subject
self.objects.add_file(self.createFileObject(self.results['file']))
# Dropped files
- for f in self.results['dropped']:
- found = False
- for exist in self.objects.get_file():
- if exist.get_md5() == f['md5']:
- found = True
- if not found:
- self.objects.add_file(self.createFileObject(f))
- # URI objects
- if self.results['network']:
- for req in self.results['network']['http']:
+ if len(self.results['dropped']) > 0:
+ for f in self.results['dropped']:
found = False
- for exist in self.objects.get_uri():
- if exist.get_id() == req['uri']:
+ for exist in self.objects.get_file():
+ if exist.get_md5() == f['md5']:
found = True
- if not found:
- self.objects.add_uri(self.createUriObject(req))
+ if not found:
+ self.objects.add_file(self.createFileObject(f))
+ # URI objects
+ if self.results['network']:
+ if len(self.results['network']['http']) > 0:
+ for req in self.results['network']['http']:
+ found = False
+ for exist in self.objects.get_uri():
+ if exist.get_id() == req['uri']:
+ found = True
+ if not found:
+ self.objects.add_uri(self.createUriObject(req))
def createFileObject(self, f):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.