Metagoofil: Complete Guide to Document Metadata Extraction and OSINT Using Kali Linux

Metagoofil: Complete Guide to Document Metadata Extraction and OSINT Using Kali Linux

metagoofil is a Linux-native metadata extraction tool, often described as FOCA’s command-line counterpart for Kali Linux. It searches for publicly indexed documents (PDF, DOC, XLS, PPT, and their modern equivalents) hosted on a specified target domain using search engine dorking, downloads them locally, and then extracts embedded metadata such as author names, software versions, and creation dates using underlying libraries like ExifTool and Hachoir. Metagoofil is a longstanding staple in the OSINT/recon phase for building username lists and fingerprinting an organization’s software environment purely from publicly available documents.

Installation

# Kali/Debian (pre-installed, or reinstall)
sudo apt update && sudo apt install metagoofil -y

# From source (any Linux distro with Python 3)
git clone https://github.com/opsdisk/metagoofil.git
cd metagoofil
pip3 install -r requirements.txt --break-system-packages
python3 metagoofil.py --help

Verify installation:

metagoofil --help

Syntax

metagoofil -d DOMAIN -t FILETYPES [OPTIONS]

Command-Line Options

FlagDescription
-d, --domain DOMAINTarget domain to search for documents
-t, --filetype TYPESComma-separated list of file extensions to search for (pdf,doc,xls,ppt,docx,xlsx,pptx,odp,ods)
-l, --limit NUMMaximum number of results to search for per file type
-n, --download-limit NUMMaximum number of files to actually download
-o, --output DIRDirectory to save downloaded files into
-w, --without-downloadOnly list discovered document URLs without downloading them
-s, --search-engine ENGINESearch engine to use for document discovery (e.g., google, bing)
-r, --report FILESave an HTML report of results
-v, --verboseEnable verbose logging output

Basic Usage

metagoofil -d example.com -t pdf,docx -l 50 -n 20 -o downloads -r report.html

Expected output:

[*] Searching for pdf files on example.com
[+] Found 12 pdf files
[*] Searching for docx files on example.com
[+] Found 7 docx files
[*] Downloading 19 files to ./downloads
[*] Extracting metadata...
[+] Report saved to report.html

Practical Examples

Example 1 — Search only (no downloading) for PDF files

metagoofil -d example.com -t pdf -l 30 -w
[*] Searching for pdf files on example.com
https://example.com/files/annual-report.pdf
https://example.com/whitepapers/security-overview.pdf

Example 2 — Download and analyze DOCX and XLSX files

metagoofil -d example.com -t docx,xlsx -l 20 -n 10 -o docs
[+] Found 10 docx/xlsx files
[*] Downloading to ./docs
[+] Downloaded: employee-handbook.docx
[+] Downloaded: budget-2026.xlsx

Example 3 — Full scan with HTML report generation

metagoofil -d example.com -t pdf,doc,docx,xls,xlsx -l 100 -n 50 -o results -r example_report.html
[*] Processing 50 documents...
[+] Report saved: example_report.html

Example 4 — Extracting just author metadata after download

metagoofil -d example.com -t pdf -l 20 -n 20 -o pdfs
grep -A2 "Author" pdfs/*.pdf 2>/dev/null
Author: J. Martinez
Author: A. Thompson

Example 5 — Searching using Bing instead of Google

metagoofil -d example.com -t pdf -s bing -l 30 -w
[*] Searching bing for pdf files on example.com
https://example.com/reports/q3-financials.pdf

Example 6 — Extracting usernames pattern from downloaded documents (manual post-processing)

for f in downloads/*.docx; do
    exiftool "$f" | grep -i "Last Modified By"
done
Last Modified By: r.johnson
Last Modified By: k.lee

Example 7 — Limiting output for a quick initial pass

metagoofil -d example.com -t pdf -l 10 -n 5 -o quick_check
[*] Found 5 pdf files
[*] Downloaded 5 files to ./quick_check

Common Use Cases

Automation with Bash

Full metadata-harvesting pipeline with username extraction:

#!/bin/bash
# metagoofil_pipeline.sh
DOMAIN=$1
OUTDIR="metagoofil_${DOMAIN}"
mkdir -p "$OUTDIR"

metagoofil -d "$DOMAIN" -t pdf,doc,docx,xls,xlsx,ppt,pptx \
    -l 100 -n 50 -o "$OUTDIR" -r "${OUTDIR}/report.html"

echo "[*] Extracting authors/usernames from downloaded documents..."
for f in "$OUTDIR"/*; do
    exiftool "$f" 2>/dev/null | grep -iE "Author|Last Modified By|Creator"
done | sort -u > "${OUTDIR}/discovered_usernames.txt"

echo "[+] Candidate usernames saved to ${OUTDIR}/discovered_usernames.txt"

Batch scan multiple domains:

#!/bin/bash
while IFS= read -r domain; do
    echo "[*] Processing $domain"
    metagoofil -d "$domain" -t pdf,docx -l 50 -n 20 -o "results_${domain}" -r "results_${domain}/report.html"
done < domains.txt

Tips and Best Practices

Troubleshooting

ProblemCauseFix
[-] Search engine returned no resultsSearch engine is throttling/blocking automated scrapingTry -s bing as an alternative to Google, or reduce -l and wait before retrying
Downloaded files fail to open/parseFile is corrupted, password-protected, or not actually the claimed file typeManually verify a sample with file filename and exiftool filename
Report HTML file is empty or missing sectionsNo metadata found in any downloaded documents (well-scrubbed documents)This is a valid finding (good target OPSEC), not a tool error
Extremely slow document downloadsTarget server rate-limiting or slow connectionReduce -n (download limit) and add delays between runs
ModuleNotFoundError running from sourceMissing Python dependenciesRun pip3 install -r requirements.txt --break-system-packages

References

Exit mobile version