def getCodeQualityofVersions(dictParam, meanFlag=True): versionDictToRet = {} versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) ### fileList = [] for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ ## let us first check if the vulnerabilites scores are there for all versions if not then excluded if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] if fileCount != None: fileList.append(fileCount) #print "Version #{} has #{} files".format(versionIDInRiskDict, fileCount) print "Stats on file count : len={}, median={}, mean={}, max={}, min={},".format( len(fileList), np.median(fileList), np.mean(fileList), max(fileList), min(fileList)) if meanFlag: thres = np.mean(fileList) else: #thres = np.median(fileList) thres = np.percentile(fileList, 25) #print "50th percentile of file count ... ", thres for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] # then lets check if the file coutn is at least the mdian file count if fileCount >= thres: versionDictToRet[versionIDInRiskDict] = dictParam[ versionIDInRiskDict] return versionDictToRet
def getMobilesoftCodeQualityVersions(dictParam, threshParam): versionDictToRet = {} versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) ### fileList = [] for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ ## let us first check if the vulnerabilites scores are there for all versions if not then excluded if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] if fileCount != None: fileList.append(fileCount) #print "Version #{} has #{} files".format(versionIDInRiskDict, fileCount) print "Stats on file count : len={}, median={}, mean={}, max={}, min={},".format( len(fileList), np.median(fileList), np.mean(fileList), max(fileList), min(fileList)) for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] if fileCount >= threshParam: versionDictToRet[versionIDInRiskDict] = dictParam[ versionIDInRiskDict] return versionDictToRet
def getCodeQualityofVersions(dictParam, meanFlag=True): versionDictToRet = {} versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) ### fileList = [] for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ ## let us first check if the vulnerabilites scores are there for all versions if not then excluded if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] if fileCount != None: fileList.append(fileCount) # print "Version #{} has #{} files".format(versionIDInRiskDict, fileCount) print "Stats on file count : len={}, median={}, mean={}, max={}, min={},".format( len(fileList), np.median(fileList), np.mean(fileList), max(fileList), min(fileList) ) if meanFlag: thres = np.mean(fileList) else: # thres = np.median(fileList) thres = np.percentile(fileList, 25) # print "50th percentile of file count ... ", thres for k_, v_ in versionRiskDict.items(): versionIDInRiskDict = k_ if versionIDInRiskDict in dictParam: fileCount = dictParam[versionIDInRiskDict][10] # then lets check if the file coutn is at least the mdian file count if fileCount >= thres: versionDictToRet[versionIDInRiskDict] = dictParam[versionIDInRiskDict] return versionDictToRet
def getVulnerbailityScoreStatus(dictParam): riskList = [] original_versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) for k_, v_ in dictParam.items(): ## get the scores for the valid versions riskScore = original_versionRiskDict[k_] riskList.append(riskScore) return np.mean(riskList), np.median(riskList)
def getVulnerbailityScoreStatus(dictParam): riskList = [] original_versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) for k_, v_ in dictParam.items(): ## get the scores for the valid versions riskScore = original_versionRiskDict[k_] riskList.append(riskScore) return np.mean(riskList), np.median(riskList)
def getVulnerbailityScoreOfSelectedVersions(dictParam): validDictToret={} riskList=[] original_versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) for k_, v_ in dictParam.items(): ## get the scores for the valid versions riskScore = original_versionRiskDict[k_] validDictToret[k_] = riskScore riskList.append(riskScore) print "Stats on risk score-->len={}, median={}, mean={}, max={}, min={},".format(len(riskList), np.median(riskList), np.mean(riskList), max(riskList), min(riskList)) return validDictToret
def getVulnerbailityScoreOfSelectedVersions(dictParam): validDictToret = {} riskList = [] original_versionRiskDict = DEFT.getValuesFrom_Vulnerability(dbFileName) for k_, v_ in dictParam.items(): ## get the scores for the valid versions riskScore = original_versionRiskDict[k_] validDictToret[k_] = riskScore riskList.append(riskScore) print "Stats on risk score-->len={}, median={}, mean={}, max={}, min={},".format( len(riskList), np.median(riskList), np.mean(riskList), max(riskList), min(riskList)) return validDictToret
#print "Output for InentVersionList ... ", InentVersionList #table 13 InentList = DEFT.getValuesFrom_Intent_(dbFileName) #print "Output for InentList ... ", InentList #table 14 OverPermissionList = DEFT.getValuesFrom_OverPermission_(dbFileName) #print "Output for OverPermissionList ... ", OverPermissionList #table 15 PermissionList = DEFT.getValuesFrom_Permission_(dbFileName) #print "Output for PermissionList ... ", PermissionList #table 16 UnderPermissionList = DEFT.getValuesFrom_UnderPermission_(dbFileName) #print "Output for UnderPermissionList ... ", UnderPermissionList #table 17 VersionList = DEFT.getValuesFrom_Version(dbFileName) #print "Output for VersionList ... ", VersionList #table 18 VulnerabilityList = DEFT.getValuesFrom_Vulnerability(dbFileName) #print "Output for VulnerabilityList ... ", VulnerabilityList
#table 11 GitHistoryList = DEFT.getValuesFrom_GitHistory(dbFileName) #print "Output for GitHistoryList ... ", GitHistoryList #table 12 InentVersionList = DEFT.getValuesFrom_Intent_Version(dbFileName) #print "Output for InentVersionList ... ", InentVersionList #table 13 InentList = DEFT.getValuesFrom_Intent_(dbFileName) #print "Output for InentList ... ", InentList #table 14 OverPermissionList = DEFT.getValuesFrom_OverPermission_(dbFileName) #print "Output for OverPermissionList ... ", OverPermissionList #table 15 PermissionList = DEFT.getValuesFrom_Permission_(dbFileName) #print "Output for PermissionList ... ", PermissionList #table 16 UnderPermissionList = DEFT.getValuesFrom_UnderPermission_(dbFileName) #print "Output for UnderPermissionList ... ", UnderPermissionList #table 17 VersionList = DEFT.getValuesFrom_Version(dbFileName) #print "Output for VersionList ... ", VersionList #table 18 VulnerabilityList = DEFT.getValuesFrom_Vulnerability(dbFileName) #print "Output for VulnerabilityList ... ", VulnerabilityList