def find_malware(): r = do_some_searching() return jsonize( map( lambda r: { 'sha256': r.sha256, 'created_at': r.created_at.__str__() }, r))
def list_tags(): rows = db.list_tags() results = [] for row in rows: results.append(row.tag) return jsonize(results)
def full_search(): query = request.forms.get('query') r = db.full_search(query) return jsonize( map( lambda r: { 'sha256': r.sha256, 'created_at': r.created_at.__str__() }, r))
def recent_comms(): r = [] for cm in db.get_recent_vtcoms(): r.append({ 'comment': cm.cmnt, 'user': cm.user, 'date': str(cm.date), 'hash': cm.hash, 'type': cm.type, }) return jsonize(r)
def add_tag(hash=None, tag=None): m = db.find_via_hash(hash) db.add_tag(m, tag) if tag.startswith('ripped:') or tag.startswith('contains:') and m.parent: ## propaget tags backwards x = tag.split(':', 1)[1] for p in m.parent: if 'archive' in p.tags: add_tag(hash=p, tag='contains:' + x) return jsonize({'success': True})
def config_stats(): return jsonize(configdb().stats())
def config_recent(): return jsonize(list(configdb().recent()))
def config_get(cfg): if db.can_cfg_be_shared(cfg): return jsonize(configdb().config(cfg)) return HTTPError(403, 'No sample matching this config was shared with you')
def config_shared(cfg): return jsonize({'shared': db.can_cfg_be_shared(cfg)})
def config_samples(cfg): smpls = db.config_samples(cfg) return jsonize(map(low_details, smpls))
def find_malware(): r = do_some_searching() if type(r) == list: return jsonize(map(details, r)) return jsonize(details(r))
def task(task_id): task = get_analysis_status(task_id) r = {'state': str(task.state)} if task.successful(): r = task.result return jsonize(r)
def comment(hash=None): cmt = request.forms.get('cmt') db.add_comment(hash, cmt) return jsonize({'success': True})