Skip to content

Commit

Permalink
为base scan 添加去重
Browse files Browse the repository at this point in the history
  • Loading branch information
LoRexxar committed Aug 13, 2021
1 parent 9da4aa7 commit 9e67a5c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/index/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ def get_and_check_scanresult(scan_task_id):

def check_update_or_new_scanresult(scan_task_id, cvi_id, language, vulfile_path, source_code, result_type,
is_unconfirm, is_active):
# 优化基础扫描结果
if str(cvi_id).startswith('5'):
vulfile_path = vulfile_path.split(':')[0]

# 如果漏洞hash存在,那么更新信息,如果hash不存在,那么新建漏洞
scan_project_id = get_and_check_scantask_project_id(scan_task_id)
vul_hash = md5("{},{},{},{},{}".format(scan_project_id, cvi_id, language, vulfile_path, source_code))
Expand All @@ -257,7 +261,7 @@ def check_update_or_new_scanresult(scan_task_id, cvi_id, language, vulfile_path,
sr.source_code = source_code
sr.result_type = result_type
sr.is_unconfirm = is_unconfirm
# sr.is_active =is_active

try:
sr.save()
except IntegrityError:
Expand Down

0 comments on commit 9e67a5c

Please sign in to comment.