def analyzeAV():
        
        submit=Component()
        logbook=Component()
        mysql=Component()

        submit.attrib("1",  "submit",   "Administrator","Partially-Privileged User",  "Python", "Yes",  "Yes",  "Yes",  "Yes",  "No",   "Yes",  "No",   "Yes",  "Yes",   "Yes", "No",   "Yes",  "Yes",  "No",   "No",   "JDL", "Client",0,     "Yes","No",[2],[0])
        logbook.attrib("2", "logbook",  "Administrator","Partially-Privileged User",  "C/C++",  "No",   "Yes",  "Yes",  "Yes",  "No",   "Yes",  "No",   "Yes",  "Yes",   "No",  "No",   "No",   "No",   "No",   "No",   "JDL", "Server",0,     "No", "No",[3],[1])
        mysql.attrib("3","mysql","Partially-Privileged User","Partially-Privileged User","C/C++",  "No",   "No",   "No",   "No",   "Yes",  "No",   "No",   "Yes",  "No",    "No",  "No",   "No",   "No",   "No",   "No",   "SQL", "Server",0,     "No", "Yes",[0],[2])                       

        # variables "a,a2,a3" store CWSS values from rules

        a1 = oldrules.reglas(submit.cOwner,submit.cUser,submit.cLang,submit.cUIcom,submit.cSanit,submit.cTrans,submit.cTransf,submit.cTrust,submit.cDBint,submit.cTime,submit.cMaxmin,submit.cCalltpf,submit.cSpoof,submit.cTamper,submit.cEncryp,submit.cAttach,submit.cDataf,submit.cUError,submit.cRemote,submit.cCliSer,0)
        a2 = oldrules.reglas(logbook.cOwner,logbook.cUser,logbook.cLang,logbook.cUIcom,logbook.cSanit,logbook.cTrans,logbook.cTransf,logbook.cTrust,logbook.cDBint,logbook.cTime,logbook.cMaxmin,logbook.cCalltpf,logbook.cSpoof,logbook.cTamper,logbook.cEncryp,logbook.cAttach,logbook.cDataf,logbook.cUError,logbook.cRemote,logbook.cCliSer,0)
        a3 = oldrules.reglas(mysql.cOwner,mysql.cUser,mysql.cLang,mysql.cUIcom,mysql.cSanit,mysql.cTrans,mysql.cTransf,mysql.cTrust,mysql.cDBint,mysql.cTime,mysql.cMaxmin,mysql.cCalltpf,mysql.cSpoof,mysql.cTamper,mysql.cEncryp,mysql.cAttach,mysql.cDataf,mysql.cUError,mysql.cRemote,mysql.cCliSer,0)
              
        b1 = [a1[0],a1[0]*a1[1],a1[1]*a1[2],a1[1]*a1[2],a1[0]*a1[2],a1[0],a1[0],a1[0]*a1[1],a1[0]*a1[1]*a1[2],a1[2],a1[2],a1[1]*a1[2],a1[2],a1[2],a1[2],a1[1]*a1[2],a1[1],a1[2],a1[0]*a1[1]*a1[2],a1[0]*a1[2]]
        b11 = ["%.2f"%elem for elem in b1]

        b2 = [a2[0],a2[0]*a2[1],a2[1]*a2[2],a2[1]*a2[2],a2[0]*a2[2],a2[0],a2[0],a2[0]*a2[1],a2[0]*a2[1]*a2[2],a2[2],a2[2],a2[1]*a2[2],a2[2],a2[2],a2[2],a2[1]*a2[2],a2[1],a2[2],a2[0]*a2[1]*a2[2],a2[0]*a2[2]]
        b22 = ["%.2f"%elem for elem in b2]

        b3 = [a3[0],a3[0]*a3[1],a3[1]*a3[2],a3[1]*a3[2],a3[0]*a3[2],a3[0],a3[0],a3[0]*a3[1],a3[0]*a3[1]*a3[2],a3[2],a3[2],a3[1]*a3[2],a3[2],a3[2],a3[2],a3[1]*a3[2],a3[1],a3[2],a3[0]*a3[1]*a3[2],a3[0]*a3[2]]
        b33 = ["%.2f"%elem for elem in b3]

        l1=static.buscaCWE()
        l2=l1

        subanalyzeAV("submit",b11,l1,l2)

        l3=static.buscaCWE()
        l4=l3
        subanalyzeAV("logbook",b22,l3,l4)

        l5=static.buscaCWE()
        l6=l5
        subanalyzeAV("mysql",b33,l5,l6)
       
        return 0
Esempio n. 2
0
    def analyzeAV():
        
        submit=Component()
        logbook=Component()
        mysql=Component()

        submit.attrib("1",\
                         "submit",\
                         "Administrator",\
                         "Partially-Privileged User",\
                         "Python",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "No",\
                          "JDL",\
                          "Client",\
                          0,\
                          "Yes",\
                          "No",\
                          [2],\
                          [0])
        logbook.attrib("2",\
                       "logbook",\
                       "Administrator",\
                       "Partially-Privileged User",\
                       "C/C++",\
                       "No",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "No",\
                       "Yes",\
                       "Yes",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "JDL",\
                       "Server",\
                       0,\
                       "No",\
                       "No",\
                       [3],\
                       [1])
        mysql.attrib("3",\
                     "mysql",\
                     "Partially-Privileged User",\
                     "Partially-Privileged User",\
                     "C/C++",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "Yes",\
                     "Yes",\
                     "Yes",\
                     "Yes",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "SQL",\
                     "Server",\
                     0,\
                     "No",\
                     "Yes",\
                     [0],\
                     [2])                       

        # variables "a1,a2,a3" store CWSS values from rules

        a1 = newrules.reglas(submit.cOwner,submit.cUser,submit.cLang,submit.cUIcom,submit.cSanit,submit.cTrans,submit.cTransf,submit.cTrust,submit.cDBint,submit.cTime,submit.cMaxmin,submit.cLocalf,submit.cSpoof,submit.cTamper,submit.cEncryp,submit.cAttach,submit.cDataf,submit.cUError,submit.cRemotef,submit.cCliSer,0)
        a2 = newrules.reglas(logbook.cOwner,logbook.cUser,logbook.cLang,logbook.cUIcom,logbook.cSanit,logbook.cTrans,logbook.cTransf,logbook.cTrust,logbook.cDBint,logbook.cTime,logbook.cMaxmin,logbook.cLocalf,logbook.cSpoof,logbook.cTamper,logbook.cEncryp,logbook.cAttach,logbook.cDataf,logbook.cUError,logbook.cRemotef,logbook.cCliSer,0)
        a3 = newrules.reglas(mysql.cOwner,mysql.cUser,mysql.cLang,mysql.cUIcom,mysql.cSanit,mysql.cTrans,mysql.cTransf,mysql.cTrust,mysql.cDBint,mysql.cTime,mysql.cMaxmin,mysql.cLocalf,mysql.cSpoof,mysql.cTamper,mysql.cEncryp,mysql.cAttach,mysql.cDataf,mysql.cUError,mysql.cRemotef,mysql.cCliSer,0)
        
        ## To normalize the scores we assume the maximum risk in the rest of metrics
        ##since the maximum values in each metric groups are 100, 1, or 1.
              
        b1 = [a1[0],a1[0]*a1[1],100*a1[1]*a1[2],100*a1[1]*a1[2],a1[0]*a1[2],a1[0],a1[0],a1[0]*a1[1],a1[0]*a1[1]*a1[2],100*a1[2],100*a1[2],100*a1[1]*a1[2],100*a1[2],100*a1[2],100*a1[2],100*a1[1]*a1[2],100*a1[1],100*a1[2],a1[0]*a1[1]*a1[2],a1[0]*a1[2]]
        #b11 = [round(elem,1) for elem in b1]
        b11 = ["%.2f"%elem for elem in b1]

        b2 = [a2[0],a2[0]*a2[1],100*a2[1]*a2[2],100*a2[1]*a2[2],a2[0]*a2[2],a2[0],a2[0],a2[0]*a2[1],a2[0]*a2[1]*a2[2],100*a2[2],100*a2[2],100*a2[1]*a2[2],100*a2[2],100*a2[2],100*a2[2],100*a2[1]*a2[2],100*a2[1],100*a2[2],a2[0]*a2[1]*a2[2],a2[0]*a2[2]]
        #b22 = [round(elem,1) for elem in b2]
        b22 = ["%.2f"%elem for elem in b2]

        b3 = [a3[0],a3[0]*a3[1],100*a3[1]*a3[2],100*a3[1]*a3[2],a3[0]*a3[2],a3[0],a3[0],a3[0]*a3[1],a3[0]*a3[1]*a3[2],100*a3[2],100*a3[2],100*a3[1]*a3[2],100*a3[2],100*a3[2],100*a3[2],100*a3[1]*a3[2],100*a3[1],100*a3[2],a3[0]*a3[1]*a3[2],a3[0]*a3[2]]
        #b33 = [round(elem,1) for elem in b3]
        b33 = ["%.2f"%elem for elem in b3]

        l1=static.buscaCWE()
        l2=l1

        subanalyzeAV("submit",b11,l1,l2)

        l3=static.buscaCWE()
        l4=l3
        subanalyzeAV("logbook",b22,l3,l4)

        l5=static.buscaCWE()
        l6=l5
        subanalyzeAV("mysql",b33,l5,l6)
       
        return 0
    def analyzeAV():

        submit = Component()
        logbook = Component()
        mysql = Component()

        submit.attrib("1",\
                         "submit",\
                         "Administrator",\
                         "Partially-Privileged User",\
                         "Python",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "Yes",\
                          "Yes",\
                          "No",\
                          "No",\
                          "JDL",\
                          "Client",\
                          0,\
                          "Yes",\
                          "No",\
                          [2],\
                          [0])
        logbook.attrib("2",\
                       "logbook",\
                       "Administrator",\
                       "Partially-Privileged User",\
                       "C/C++",\
                       "No",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "Yes",\
                       "No",\
                       "Yes",\
                       "Yes",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "No",\
                       "JDL",\
                       "Server",\
                       0,\
                       "No",\
                       "No",\
                       [3],\
                       [1])
        mysql.attrib("3",\
                     "mysql",\
                     "Partially-Privileged User",\
                     "Partially-Privileged User",\
                     "C/C++",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "Yes",\
                     "Yes",\
                     "Yes",\
                     "Yes",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "No",\
                     "SQL",\
                     "Server",\
                     0,\
                     "No",\
                     "Yes",\
                     [0],\
                     [2])

        # variables "a1,a2,a3" store CWSS values from rules

        a1 = newrules.reglas(submit.cOwner, submit.cUser, submit.cLang,
                             submit.cUIcom, submit.cSanit, submit.cTrans,
                             submit.cTransf, submit.cTrust, submit.cDBint,
                             submit.cTime, submit.cMaxmin, submit.cLocalf,
                             submit.cSpoof, submit.cTamper, submit.cEncryp,
                             submit.cAttach, submit.cDataf, submit.cUError,
                             submit.cRemotef, submit.cCliSer, 0)
        a2 = newrules.reglas(logbook.cOwner, logbook.cUser, logbook.cLang,
                             logbook.cUIcom, logbook.cSanit, logbook.cTrans,
                             logbook.cTransf, logbook.cTrust, logbook.cDBint,
                             logbook.cTime, logbook.cMaxmin, logbook.cLocalf,
                             logbook.cSpoof, logbook.cTamper, logbook.cEncryp,
                             logbook.cAttach, logbook.cDataf, logbook.cUError,
                             logbook.cRemotef, logbook.cCliSer, 0)
        a3 = newrules.reglas(mysql.cOwner, mysql.cUser, mysql.cLang,
                             mysql.cUIcom, mysql.cSanit, mysql.cTrans,
                             mysql.cTransf, mysql.cTrust, mysql.cDBint,
                             mysql.cTime, mysql.cMaxmin, mysql.cLocalf,
                             mysql.cSpoof, mysql.cTamper, mysql.cEncryp,
                             mysql.cAttach, mysql.cDataf, mysql.cUError,
                             mysql.cRemotef, mysql.cCliSer, 0)

        ## To normalize the scores we assume the maximum risk in the rest of metrics
        ##since the maximum values in each metric groups are 100, 1, or 1.

        b1 = [
            a1[0], a1[0] * a1[1], 100 * a1[1] * a1[2], 100 * a1[1] * a1[2],
            a1[0] * a1[2], a1[0], a1[0], a1[0] * a1[1], a1[0] * a1[1] * a1[2],
            100 * a1[2], 100 * a1[2], 100 * a1[1] * a1[2], 100 * a1[2],
            100 * a1[2], 100 * a1[2], 100 * a1[1] * a1[2], 100 * a1[1],
            100 * a1[2], a1[0] * a1[1] * a1[2], a1[0] * a1[2]
        ]
        #b11 = [round(elem,1) for elem in b1]
        b11 = ["%.2f" % elem for elem in b1]

        b2 = [
            a2[0], a2[0] * a2[1], 100 * a2[1] * a2[2], 100 * a2[1] * a2[2],
            a2[0] * a2[2], a2[0], a2[0], a2[0] * a2[1], a2[0] * a2[1] * a2[2],
            100 * a2[2], 100 * a2[2], 100 * a2[1] * a2[2], 100 * a2[2],
            100 * a2[2], 100 * a2[2], 100 * a2[1] * a2[2], 100 * a2[1],
            100 * a2[2], a2[0] * a2[1] * a2[2], a2[0] * a2[2]
        ]
        #b22 = [round(elem,1) for elem in b2]
        b22 = ["%.2f" % elem for elem in b2]

        b3 = [
            a3[0], a3[0] * a3[1], 100 * a3[1] * a3[2], 100 * a3[1] * a3[2],
            a3[0] * a3[2], a3[0], a3[0], a3[0] * a3[1], a3[0] * a3[1] * a3[2],
            100 * a3[2], 100 * a3[2], 100 * a3[1] * a3[2], 100 * a3[2],
            100 * a3[2], 100 * a3[2], 100 * a3[1] * a3[2], 100 * a3[1],
            100 * a3[2], a3[0] * a3[1] * a3[2], a3[0] * a3[2]
        ]
        #b33 = [round(elem,1) for elem in b3]
        b33 = ["%.2f" % elem for elem in b3]

        l1 = static.buscaCWE()
        l2 = l1

        subanalyzeAV("submit", b11, l1, l2)

        l3 = static.buscaCWE()
        l4 = l3
        subanalyzeAV("logbook", b22, l3, l4)

        l5 = static.buscaCWE()
        l6 = l5
        subanalyzeAV("mysql", b33, l5, l6)

        return 0