Skip to content

Instantly share code, notes, and snippets.

@jimmy-ly00
Last active June 14, 2022 14:58
Show Gist options
  • Save jimmy-ly00/ca4e23f264f32e2cb851b0b9e5a4d8dd to your computer and use it in GitHub Desktop.
Save jimmy-ly00/ca4e23f264f32e2cb851b0b9e5a4d8dd to your computer and use it in GitHub Desktop.
Find PII (Personally Identifiable Information) using pdscan
import glob
from selectors import EpollSelector
import subprocess
# Change these
ROOT_DIR = "/home/jimmy/desktop/spam"
PDSCAN_FILE = "/home/jimmy/desktop/pdscan" # Download from https://github.com/ankane/pdscan#installation
for filename in glob.iglob(ROOT_DIR + '**/**', recursive=True):
result = subprocess.run([PDSCAN_FILE, "file://" + filename,"--show-data", "--show-all"], capture_output=True, text=True) # remove "--show-all" for high confidence results
# print(result.stdout)
if "Empty buffer" in result.stdout or "No sensitive data found" in result.stdout:
pass
else:
print(result.stdout)
print("------------------------------------------------")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment