def enum_root_pkg_proc(pkgsandprocs, userinfo):
    """
    Enumerate root packages (enum_root_pkg_proc)
    Enumerate Root/superuser packages to target based on process information
    :param pkgsandprocs: Dictionary with process and package information
    :param userinfo:  Dictionary with the user information commands and results

    :return: The drive information Dictionary with the commands results included
    """
    print "[*] IDENTIFYING PROCESSES AND PACKAGES RUNNING AS ROOT OR OTHER SUPERUSER...\n"

    # find the package information for the processes currently running
    # under root or another super user

    procs = pkgsandprocs["PROCS"]["results"]
    pkgs = pkgsandprocs["PKGS"]["results"]
    supusers = userinfo["SUPUSERS"]["results"]
    procdict = {}  # dictionary to hold the processes running as super users

    for proc in procs:  # loop through each process
        relatedpkgs = []  # list to hold the packages related to a process
        try:
            for user in supusers:  # loop through the known super users
                if (user != "") and (user in proc):  # if the process is being run by a super user
                    procname = proc.split(" ")[4]  # grab the process name
                    if "/" in procname:
                        splitname = procname.split("/")
                        procname = splitname[len(splitname)-1]
                    for pkg in pkgs:  # loop through the packages
                        if not len(procname) < 3:  # name too short to get reliable package results
                            if procname in pkg:
                                if procname in procdict:
                                    relatedpkgs = procdict[proc]  # if already in the dict, grab its pkg list
                                if pkg not in relatedpkgs:
                                    relatedpkgs.append(pkg)  # add pkg to the list
                    procdict[proc] = relatedpkgs  # add any found related packages to the process dictionary entry
        except:
            pass

    for key in procdict:
        print "    " + key  # print the process name
        try:
            if not procdict[key][0] == "":  # only print the rest if related packages were found
                print "        Possible Related Packages: "
                for entry in procdict[key]:
                    print "            " + entry  # print each related package
        except IndexError:
            pass

    Enumerate root packages (enum_root_pkg_proc)
    Enumerate Root/superuser packages to target based on process information
    :param pkgsandprocs: Dictionary with process and package information
    :param userinfo:  Dictionary with the user information commands and results

    :return: The drive information Dictionary with the commands results included
    
linuxprivchecker.py