- it uses Shannon Entropy to find private keys.
- it supports multiprocessing for analyzing files.
- it unpacks compressed archives (e.g. zip, tar.gz etc.)
- it supports advanced search using simple rules (details below)
usage: DumpsterDiver.py [-h] -p LOCAL_PATH [-r] [-a]
Command line options
-p LOCAL_PATH– path to the folder containing files to be analyzed.
-r, --remove– when this flag is set, then files which don’t contain any secret (or anything interesting if
-aflag is set) will be removed.
-a, --advance– when this flag is set, then all files will be additionally analyzed using rules specified in ‘rules.yaml’ file.
To run the DumpsterDiver you have to install python libraries. You can do this by running the following command:
pip install -r requirements.txt
Understanding config.yaml file
There is no single tool which fits for everyone’s needs and the DumpsterDiver is not an exception here. So, in
config.yaml file you can custom the program to search exactly what you want. Below you can find a description of each setting.
logfile– specifies a file where logs should be saved.
excluded– specifies file extensions which you don’t want to omit during a scan. There is no point in searching for hardcoded secrets in picture or video files, right?
min_key_length– specifies minimum and maximum length of the secret you’re looking for. Depending on your needs this setting can greatly limit the amount of false positives. For example, the AWS secret has a length of 40 bytes so if you set
min_key_lengthto 40 then the DumpsterDiver will analyze only 40 bytes strings. However, it won’t take into account longer strings like Azure shared key or private SSH key.
The DumpsterDiver supports also an advanced search. Beyond a simple grepping with wildcards this tool allows you to create conditions. Let’s assume you’re searching for a leak of corporate emails. Additionaly, you’re interested only in a big leaks, which contain at least 100 email addresses. For this purpose you should edit a ‘rules.yaml’ file in the following way:
Let’s assume a different scenario, you’re looking for terms “pass”, “password”, “haslo”, “hasło” (if you’re analyzing polish company repository) in a
.sql file. Then you can achieve this by modifying a ‘rules.yaml’ file in the following way:
filetype: [".db", ".sql"]
grep_words: ["*pass*", "*haslo*", "*hasÅ‚o*"]
Note that the rule will be triggered only when the total weight (
filetype_weight + grep_words_weight) is