Beispiel #1
0
##For loop to run through each server in the group specified using the variable
## entered in to the script "svr_grp" - output is server health report for every server in the entire group
for svr in data:
    ## Print each servers health report - each server separated by *** above and below contents
    print(
        "**************************************************************************************"
    )
    print("+++ file {0} ".format(gfile))
    print("++++ group {0}".format(svr_grp))
    print("++++ svr", svr)
    hostname = intermediate(graphdata, 'type_hostname', svr)
    print("++++ hostname {0}".format(hostname))

    (num_pkg_vers, num_pkgs, pkg_ver_dict,
     pkg_multiver_dict) = svr_pkgs(graphdata, svr)
    print("+++++ {0} package/versions".format(num_pkg_vers))
    print("+++++ {0} packages".format(num_pkgs))
    mypprint(pkg_multiver_dict)

    ## print supressed cves
    print("supressed cve's:")
    scp = svr_cve_pkgs(graphdata, svr)
    sup_cves = pkg_cve_supr(scp)
    mypprint(sup_cves)

    ## print bins of cvss
    no_cves = len(pkgs_with_no_cve(scp))
    print("{0} packages with no cve's:".format(no_cves))
    ten_cves = pkg_cve_cvss_threshold(scp, 10, 100)
    l_ten_cves = len(ten_cves)
Beispiel #2
0
## histogram of number of extra versions per server
extra_hist = {}

## histogram of number of multi-ver packages per server
##    note a server could have one package with 3 extra versions
##       which would show as 3 on extra versions and 1 on this
pkg_hist = {}

## dict with key of multi-ver-packages and value of list of servers
mvp = {}

## loop thru all servers
svrs = graphdata.neighbors("type_server")
for svr in svrs:
    ## get all packages, versions
    (num_pkg_vers, num_pkgs, pkg_ver_dict, pkg_multiver_dict) = svr_pkgs(graphdata, svr)
    ## make a list (from the iterator) of muti-ver packages
    pkgs = list( pkg_multiver_dict.keys() )

    ## evaluate extras
    extra = num_pkg_vers - num_pkgs
    if(num_pkg_vers > num_pkgs):
        multi_ver_count += 1
    else:
        clean_ver_count += 1
        clean_ver_list += [svr]
    if extra in extra_hist:
        extra_hist[extra] += 1
    else:
        extra_hist[extra] = 1
    num_pkgs = len(pkgs)