def on_result(self, task, result): '''Called every result''' if not result: return if 'taskid' in task and 'project' in task and 'url' in task: logger.info('result %s:%s %s -> %.30r' % (task['project'], task['taskid'], task['url'], result)) # if self.es: # self.es.index(index=task['project'],doc_type="test-type",id=task['taskid'],body={"any": result['title']}) # else: # print('es error') sql = SQL() sql.insert(task['project'], **result) return self.resultdb.save(project=task['project'], taskid=task['taskid'], url=task['url'], result=result) else: logger.warning('result UNKNOW -> %.30r' % result) return
def on_result(self, result): if not result: return sql = SQL() if isinstance(result, dict): entrytype = result.pop('type') if entrytype == 'domain': sql.insert(tablename='Domains', **result) elif entrytype == 'host': sql.insert(tablename='Hosts', **result) elif entrytype == 'sample': sql.insert(tablename='Samples', **result) elif isinstance(result, list): for each in result: entrytype = each.pop('type') if entrytype == 'domain': sql.insert(tablename='Domains', **each) elif entrytype == 'host': sql.insert(tablename='Hosts', **each) elif entrytype == 'sample': sql.insert(tablename='Samples', **each)
def on_result(self,result): if not result or not result['original_id']: return sql = SQL() sql.insert('article',**result)
def on_result(self, result): if not result: return db = SQL() result['insert_time'] = time.strftime('%Y-%m-%d %H:%M:%S') db.insert('reeoo_detail', **result)