def process(self, tup): raw_mail = tup.values[1] # Convert back to object strings convert manually if raw_mail.get("network"): if raw_mail["network"].get("shodan"): raw_mail["network"]["shodan"] = json.loads( raw_mail["network"]["shodan"]) if raw_mail["network"].get("virustotal"): raw_mail["network"]["virustotal"] = json.loads( raw_mail["network"]["virustotal"]) # Reformat output mail, attachments = reformat_output(raw_mail, self.component_name, **self._parameters) self._mails.append(mail) self._attachments += attachments # Flush if self._count == self._flush_size: self.flush() else: self._count += 1
def process(self, tup): raw_mail = tup.values[1] # Convert back to object strings converted manually if raw_mail.get("network"): if raw_mail["network"].get("shodan"): raw_mail["network"]["shodan"] = json.loads( raw_mail["network"]["shodan"]) if raw_mail["network"].get("virustotal"): raw_mail["network"]["virustotal"] = json.loads( raw_mail["network"]["virustotal"]) # Reformat output mail, attachments = reformat_output(raw_mail, self.component_name) # Mails if mail: self._mails.append(json.dumps(mail, ensure_ascii=False)) if self._counter["mails"] == self._flush_size: self.flush_mails() else: self._counter["mails"] += 1 # Attachments for i in attachments: self._attachments.append(json.dumps(i, ensure_ascii=False)) if self._counter["attachments"] == self._flush_size: self.flush_attachments() else: self._counter["attachments"] += 1
def process(self, tup): raw_mail = tup.values[1] # Reformat output mail, attachments = reformat_output( raw_mail, self.component_name, **self._parameters) self._mails.append(mail) self._attachments += attachments # Flush if self._count == self._flush_size: self.flush() else: self._count += 1
def process(self, tup): raw_mail = tup.values[1] # Reformat output mail, attachments = reformat_output( raw_mail, self.component_name) # Mails if mail: self._mails.append(json.dumps(mail, ensure_ascii=False)) if self._counter["mails"] == self._flush_size: self.flush_mails() else: self._counter["mails"] += 1 # Attachments for i in attachments: self._attachments.append(json.dumps(i, ensure_ascii=False)) if self._counter["attachments"] == self._flush_size: self.flush_attachments() else: self._counter["attachments"] += 1