Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debian: Listing all user-installed packages?

Tags:

For a cyber security competition I participate in, I'm given a Debian virtual machine with many packages installed and asked to clean extraneous or malicious packages.

In the past, I've used dpkg -l | grep [searchterm] and a list of common packages to preform this task. However, this is extremely inefficient and time-consuming.

To speed up my task, is there any way to search through the list of packages installed on a system for which processes have been installed by a user and are not system "default" packages?

like image 475
Thorne Garvin Avatar asked Dec 07 '16 00:12

Thorne Garvin


People also ask

How do I see all packages in Debian?

List Installed Packages with dpkg-query. dpkg-query is a command line that can be used to display information about packages listed in the dpkg database. The command will display a list of all installed packages including the packages versions, architecture, and a short description.

Where are packages installed in Debian?

Debian already comes with pre-approved sources to get packages from and this is how it installs all the base packages you see on your system (if a user did a net-install). On a Debian system, this sources file is the "/etc/apt/sources.


2 Answers

This command may shorten your work:

apt-mark showmanual

It is supposed to show what packages were installed "manually". It is not 100% reliable though, as many automatically installed packages are flagged as manually installed (because of reasons too long to describe here).

You may also (if allowed) run security tools such as clamav and/or rkhunter to scan your computer for malicious programs.

like image 161
Jamil Said Avatar answered Sep 20 '22 16:09

Jamil Said


Below is a line from a "health" script I run on my desktop every night. Besides gathering information from sensors, network usage, HDD temperature, etc. it also gets a list of all the software I've installed manually from the command line.

I'm running Kubuntu 14.04.5 (Trusty) at the moment and I don't know the details of any differences between Ubuntu and Debian's package management but hopefully this will work for you as well as it does for me.

( zcat $( ls -tr /var/log/apt/history.log*.gz ) ; cat /var/log/apt/history.log ) | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep '^Commandline:' | egrep 'install' 1>>installed_packages.txt
like image 36
Benny Hill Avatar answered Sep 22 '22 16:09

Benny Hill