コード例 #1
0
def handle_diff_file(vuln):
    if vuln.vuln_func == "None":
        vuln.vuln_func_source = vuln.patched_func_source = "NO_FUNCTION_FOUND"
        vuln.save()
        return

    soft_name = vuln.cve_info.vuln_soft.software_name
    vuln_dir = os.path.join(settings.VULN_FUNC_PATH, soft_name,
                            vuln.cve_info.cveid)
    patch_dir = os.path.join(settings.PATCHED_FUNC_PATH, soft_name,
                             vuln.cve_info.cveid)
    if not os.path.isdir(vuln_dir):
        os.makedirs(vuln_dir)
    if not os.path.isdir(patch_dir):
        os.makedirs(patch_dir)

    vuln_func_src = vunlGener(vuln.cve_info.cveid,
                              vuln.cve_info.vuln_soft.sourcecodepath,
                              vuln.cve_info.diff_file, vuln.vuln_file,
                              vuln.vuln_func, vuln_dir)

    if vuln_func_src == "NO_FUNCTION_FOUND" or vuln_func_src == "NO_VULN_FILE_FOUND":
        vuln.vuln_func_source = vuln_func_src
        vuln.patched_func_source = vuln_func_src
        vuln.save()
    else:
        patch_func_src = patchedGener(vuln.cve_info.cveid,
                                      vuln.cve_info.vuln_soft.sourcecodepath,
                                      vuln.cve_info.diff_file, vuln.vuln_file,
                                      vuln.vuln_func, patch_dir)

        vuln.vuln_func_source = vuln_func_src
        vuln.patched_func_source = patch_func_src
        vuln.save()
コード例 #2
0
def handle_diff_file(vuln):
    if vuln.vuln_func == "None":
        vuln.vuln_func_source = vuln.patched_func_source = "NO_FUNCTION_FOUND"
        vuln.save()
        return 
    
    soft_name = vuln.cve_info.vuln_soft.software_name
    vuln_dir = os.path.join(settings.VULN_FUNC_PATH, soft_name, vuln.cve_info.cveid)
    patch_dir = os.path.join(settings.PATCHED_FUNC_PATH, soft_name, vuln.cve_info.cveid)
    if not os.path.isdir(vuln_dir):
        os.makedirs(vuln_dir)
    if not os.path.isdir(patch_dir):
        os.makedirs(patch_dir)
      
    
              
    vuln_func_src = vunlGener(vuln.cve_info.cveid,
                              vuln.cve_info.vuln_soft.sourcecodepath,
                              vuln.cve_info.diff_file,
                              vuln.vuln_file,
                              vuln.vuln_func,
                              vuln_dir)
    
    if vuln_func_src == "NO_FUNCTION_FOUND" or vuln_func_src == "NO_VULN_FILE_FOUND":
        vuln.vuln_func_source = vuln_func_src
        vuln.patched_func_source = vuln_func_src
        vuln.save()
    else:
        patch_func_src = patchedGener(vuln.cve_info.cveid,
                                      vuln.cve_info.vuln_soft.sourcecodepath,
                                      vuln.cve_info.diff_file,
                                      vuln.vuln_file,
                                      vuln.vuln_func,
                                      patch_dir)
            
        vuln.vuln_func_source = vuln_func_src
        vuln.patched_func_source = patch_func_src
        vuln.save()
コード例 #3
0
ファイル: DiffHandler.py プロジェクト: 1034556307/python
def dataHandler(cve_id,version,file_name,func_name,diff_file_dir,source_dir):
    vunlGener(cve_id,version,file_name,func_name,diff_file_dir,source_dir)
    patchedGener(cve_id,version,file_name,func_name,diff_file_dir,source_dir)