def add_to_recent_scan(name, md5, url): """Add Entry to Database under Recent Scan.""" try: db_obj = RecentScansDB.objects.filter(MD5=md5) if not db_obj.exists(): new_db_obj = RecentScansDB( FILE_NAME=name, MD5=md5, URL=url, TIMESTAMP=timezone.now()) new_db_obj.save() except Exception: logger.exception('Adding Scan URL to Database')
def add_to_recent_scan(name, md5, url): """ Add Entry to Database under Recent Scan """ try: db_obj = RecentScansDB.objects.filter(MD5=md5) if not db_obj.exists(): new_db_obj = RecentScansDB( NAME=name, MD5=md5, URL=url, TS=timezone.now()) new_db_obj.save() except: PrintException("[ERROR] Adding Scan URL to Database")
def add_to_recent_scan(name, md5, url): """ Add Entry to Database under Recent Scan """ try: db_obj = RecentScansDB.objects.filter(MD5=md5) if not db_obj.exists(): new_db_obj = RecentScansDB(NAME=name, MD5=md5, URL=url, TS=timezone.now()) new_db_obj.save() except: PrintException("[ERROR] Adding Scan URL to Database")
def add_to_recent_scan(data): """Add Entry to Database under Recent Scan.""" try: db_obj = RecentScansDB.objects.filter(MD5=data['hash']) if not db_obj.exists(): new_db_obj = RecentScansDB(ANALYZER=data['analyzer'], SCAN_TYPE=data['scan_type'], FILE_NAME=data['file_name'], APP_NAME='', PACKAGE_NAME='', VERSION_NAME='', MD5=data['hash'], TIMESTAMP=timezone.now()) new_db_obj.save() except Exception: logger.exception('Adding Scan URL to Database')
def add_to_recent_scan(name, md5, url, request): """Add Entry to Database under Recent Scan.""" user = get_user_by_token(request) if not user: # 未登录跳转到登陆页面 return HttpResponseRedirect('login/') try: # 增加用户id判断 db_obj = RecentScansDB.objects.filter(MD5=md5, USER_ID=user.id) if not db_obj.exists(): db_obj = RecentScansDB.objects.filter(MD5=md5) if len(db_obj) > 0: db_obj = db_obj[0] new_db_obj = RecentScansDB(APP_NAME=db_obj.APP_NAME, PACKAGE_NAME=db_obj.PACKAGE_NAME, VERSION_NAME=db_obj.VERSION_NAME, FILE_NAME=name, MD5=md5, URL=url, TIMESTAMP=timezone.now() + timedelta(hours=8), USER_ID=user.id) else: new_db_obj = RecentScansDB( FILE_NAME=name, MD5=md5, URL=url, TIMESTAMP=timezone.now() + timedelta(hours=8), USER_ID=user.id) new_db_obj.save() except Exception: logger.exception('Adding Scan URL to Database')