
def osuser():
    '''
    @description: Enumerate Linux distro, kernel, installed apps and services, printers, cronjobs, user lists and history files, CPU and memory info, etc.
    @author: ohdae [bindshell@live.com]
    @short: enumerate user and system information
    '''
    log_msg("\n\n  [ OS & User module ]")
    log_msg("\n Start Time: %s" % logtime)

    print("[+] Collecting operating system and user information....")
    maketemp("osinfo")
    os.chdir(Temp_Dir+"/osinfo/")
   
    proc = Popen('ps aux',
                 shell=True, 
                 stdout=PIPE,
                 )
    output = proc.communicate()[0]
    for items in output:
        writenew("ps_aux.txt", items)
    
    os.system("ls -alh /usr/bin > bin.txt")
    os.system("ls -alh /usr/sbin > sbin.txt")
    os.system("ls -al /etc/cron* > cronjobs.txt")
    os.system("ls -alhtr /media > media.txt")
    os.system("/usr/bin/lpstat -v > printers.txt")

    log_msg("\n Listings of sbin, bin, cronjobs, printers, media, ps aux")

    if distro == "ubuntu" or distro2 == "Ubuntu":
        os.system("dpkg -l > dpkg_list.txt")
    elif distro == "arch" or distro2 == "Arch":
        os.system("pacman -Q > pacman_list.txt")
    elif distro == "slackware" or distro2 == "Slackware":
        os.system("ls /var/log/packages > packages_list.txt")
    elif distro == "gentoo" or distro2 == "Gentoo":
        os.system("cat /var/lib/portage/world > packages.txt")
    elif distro == "centos" or distro2 == "CentOS":
        os.system("yum list installed > yum_list.txt")
    elif distro == "red hat" or distro2 == "Red Hat":
        os.system("rpm -qa > rpm_list.txt")
    else:
       pass
   
    if distro == "arch":
        os.system("egrep '^DAEMONS' /etc/rc.conf > services_list.txt")
    elif distro == "slackware":
        os.system("ls -F /etc/rc.d | grep \'*$\' > services_list.txt")
    elif whereis('chkconfig') is not None:
        os.system("chkconfig -A > services_list.txt")

    log_msg("\n Listings of installed packages, list of installed services.")

    os.system("mount -l > mount.txt")
    os.system("cat /etc/sysctl.conf > sysctl.txt")
    os.system("uname -a > distro_kernel.txt")
    os.system("df -hT > filesystem.txt")
    os.system("free -lt > memory.txt")
    os.system("cat /proc/cpuinfo > cpuinfo.txt")
    os.system("cat /proc/meminfo > meminfo.txt")
    copy2temp(Home_Dir+"/.bash_history")
    copy2temp(Home_Dir+"/.viminfo")
    copy2temp(Home_Dir+"/.mysql_history")

    log_msg("\n Collected: mount, sysctl, uname, diskspace, memory/cpu info..")

    if currentuser == "root":
        os.system("find /var/log -type f -exec ls -la {} \; > loglist.txt")
        os.system("locate sql | grep [.]sql$ > SQL_locations.txt")
        os.system("find /home -type f -iname '.*history' > HistoryList.txt")

    log_msg("\n Enumeration of history files, SQL locations and log lists.")

   
    sysfiles = ["distro_kernel.txt","filesystem.txt","memory.txt","cpuinfo.txt","meminfo.txt"]
    combinefiles("SysInfo.txt", sysfiles)
   
    maketemp("osinfo/users")
    os.chdir("users/")
   
    os.system("ls -alhR ~/ > CurrentUser.txt")

    if currentuser == "root":
        os.system("ls -alhR /home > AllUsers.txt")

    if os.path.exists(Home_Dir+"/.mozilla/") is True:
        os.system("find "+Home_Dir+"/.mozilla -name bookmarks*.json > UsersBookmarks.txt")

    log_msg("\n Listings of home user directories, Mozilla bookmarks and history..")

   
