### Install pdscan with Homebrew Source: https://github.com/ankane/pdscan/blob/master/README.md Installs the pdscan tool using the Homebrew package manager. This is a convenient way to manage the tool's installation and updates. ```sh brew install ankane/brew/pdscan ``` -------------------------------- ### Scan Redis Databases with pdscan Source: https://context7.com/ankane/pdscan/llms.txt This section covers scanning Redis databases, including various data types like strings, lists, sets, hashes, and sorted sets, for PII. Examples show basic scans, authentication, scanning different database numbers, and adjusting the sample size of keys to check. Requires a Redis instance. ```bash # Scan Redis database pdscan redis://localhost:6379/0 # Scan with authentication pdscan redis://user:pass@localhost:6379/0 # Scan different database number pdscan redis://localhost:6379/1 # With larger sample size (number of random keys to check) pdscan --sample-size 5000 redis://localhost:6379/0 # Example output: # Found 1 database to scan, sampling 10000 keys from each... # # user:1234:email: found emails (1 key) # session:abc123: found OAuth tokens (1 key) ``` -------------------------------- ### Scan Elasticsearch and OpenSearch Indices with pdscan Source: https://context7.com/ankane/pdscan/llms.txt Instructions for scanning Elasticsearch and OpenSearch indices using pdscan. Examples show scanning all indices, specific indices, and indices matching a pattern, including support for both HTTP and HTTPS connections. Requires access to Elasticsearch or OpenSearch clusters. ```bash # Scan all Elasticsearch indices pdscan elasticsearch+http://user:pass@localhost:9200 # Scan with HTTPS pdscan elasticsearch+https://user:pass@localhost:9200 # Scan specific indices pdscan elasticsearch+http://user:pass@localhost:9200/customers,orders # Scan indices matching a pattern pdscan "elasticsearch+http://user:pass@localhost:9200/logs-*" # OpenSearch scanning (same syntax) pdscan opensearch+http://user:pass@localhost:9200 # OpenSearch with specific indices pdscan opensearch+https://user:pass@localhost:9200/users,profiles # Example output: # Found 3 indices to scan, sampling 10000 documents from each... # # customers.email: found emails (5234 documents) # customers.billing.credit_card: found credit card numbers (1289 documents) # orders.shipping.phone: found phone numbers (3421 documents) ``` -------------------------------- ### Scan MongoDB Collections with pdscan Source: https://context7.com/ankane/pdscan/llms.txt This section covers scanning MongoDB databases, including nested fields and arrays, for PII. Examples demonstrate basic scans, connecting via SRV records, showing low-confidence matches, and setting minimum count thresholds. Requires a running MongoDB instance. ```bash # Basic MongoDB scan pdscan mongodb://user:pass@localhost:27017/mydb # MongoDB with replica set or SRV connection pdscan "mongodb+srv://user:pass@cluster.mongodb.net/mydb" # Show low confidence matches that might be false positives pdscan --show-all mongodb://user:pass@localhost:27017/mydb # Set minimum count threshold (experimental) pdscan --min-count 10 mongodb://user:pass@localhost:27017/mydb # Example output: # Found 5 collections to scan, sampling 10000 documents from each... # # users.profile.email: found emails (1523 documents) # users.profile.address.street: found street addresses (892 documents) # contacts.phone: possible phone numbers (name match) ``` -------------------------------- ### Setting up pdscan for Development Source: https://github.com/ankane/pdscan/blob/master/README.md Standard commands to clone the repository and run the test suite using the provided Makefile. ```bash git clone https://github.com/ankane/pdscan.git cd pdscan make test ``` -------------------------------- ### pdscan Command-Line Options Source: https://github.com/ankane/pdscan/blob/master/README.md Demonstrates various command-line options for pdscan to customize scan behavior, including showing data, adjusting sample size, filtering data types, and output formatting. ```sh pdscan --show-data pdscan --show-all pdscan --sample-size 50000 pdscan --processes 4 pdscan --only email,phone,location pdscan --except ip,mac pdscan --min-count 10 pdscan --pattern "\d{16}" pdscan --format ndjson ``` -------------------------------- ### Scan SQL Server for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a SQL Server instance and scans it for PII using a provided connection string. ```sh pdscan "sqlserver://user:pass@host:1433?database=dbname" ``` -------------------------------- ### Scan MySQL and MariaDB Databases with pdscan Source: https://context7.com/ankane/pdscan/llms.txt Learn how to scan MySQL and MariaDB databases for PII using pdscan. This includes connecting to the databases, optimizing scan speed with multiple processes, and filtering PII types to include or exclude. The tool requires access to the specified databases. ```bash # Scan MySQL database pdscan mysql://user:pass@localhost:3306/mydb # Scan MariaDB database pdscan mariadb://user:pass@localhost:3306/mydb # Run with multiple processes for faster scanning pdscan --processes 4 mysql://user:pass@localhost:3306/mydb # Scan only for specific types of PII (email and phone) pdscan --only email,phone mysql://user:pass@localhost:3306/mydb # Exclude certain PII types from detection pdscan --except ip,mac mysql://user:pass@localhost:3306/mydb # Example output: # Found 8 tables to scan, sampling 10000 rows from each... # # contacts.email_address: found emails (2341 rows) # orders.billing_phone: found phone numbers (987 rows) ``` -------------------------------- ### Scan Local Files and Directories with pdscan Source: https://context7.com/ankane/pdscan/llms.txt This section provides guidance on using pdscan to scan local files and directories for PII. It supports various file formats including CSV, plain text, and compressed archives (zip, tar.gz). The tool has no runtime dependencies and can process files directly from the filesystem. -------------------------------- ### Running pdscan with Docker Source: https://github.com/ankane/pdscan/blob/master/README.md Commands to pull the pdscan image and execute it against various data sources including network URIs and local file paths. ```bash docker pull ankane/pdscan docker run -ti ankane/pdscan docker run -ti ankane/pdscan "postgres://user@host.docker.internal:5432/dbname?sslmode=disable" docker run -ti -v /path/to/files:/data ankane/pdscan file:///data ``` -------------------------------- ### Scan PostgreSQL Databases with pdscan Source: https://context7.com/ankane/pdscan/llms.txt This section details how to use pdscan to scan PostgreSQL databases for unencrypted PII. It covers basic scans, SSL configuration, adjusting sample sizes, and displaying matched data. Dependencies include a PostgreSQL database and the pdscan tool. ```bash # Basic PostgreSQL scan with default settings (10,000 rows per table) pdscan postgres://user:pass@localhost:5432/mydb # Scan with SSL disabled for local development pdscan "postgres://user:pass@localhost:5432/mydb?sslmode=disable" # Scan with larger sample size for more thorough detection pdscan --sample-size 50000 postgres://user:pass@localhost:5432/mydb # Show the actual data that was matched pdscan --show-data postgres://user:pass@localhost:5432/mydb # Example output: # Found 15 tables to scan, sampling 10000 rows from each... # # users.email: found emails (847 rows) # users.phone_number: possible phone numbers (name match) # customers.ssn: found SSNs (125 rows) # # Use --show-data to view data ``` -------------------------------- ### Scan MariaDB for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a MariaDB database and scans it for PII using a provided connection URI. ```sh pdscan mariadb://user:pass@host:3306/dbname ``` -------------------------------- ### Scan Redis for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a Redis instance and scans it for PII using a provided connection URI. ```sh pdscan redis://user:pass@host:6379/db ``` -------------------------------- ### Scan Postgres for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a PostgreSQL database and scans it for PII. Includes guidance on secure connections and enabling the tsm_system_rows extension for better sampling. ```sh pdscan postgres://user:pass@host:5432/dbname -- To disable SSL: pdscan postgres://user:pass@host:5432/dbname?sslmode=disable ``` ```sql CREATE EXTENSION tsm_system_rows; ``` -------------------------------- ### Scan MySQL for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a MySQL database and scans it for PII using a provided connection URI. ```sh pdscan mysql://user:pass@host:3306/dbname ``` -------------------------------- ### Scan MongoDB for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Connects to a MongoDB database and scans it for PII using a provided connection URI. ```sh pdscan mongodb://user:pass@host:27017/dbname ``` -------------------------------- ### Scan SQLite Database for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Scans an SQLite database file for PII. Note that this functionality is not available with prebuilt binaries. ```sh pdscan sqlite://path/to/dbname.sqlite3 ``` -------------------------------- ### Scan Files for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Scans local files or directories for PII. Supports relative and absolute paths, and paths relative to the home directory. ```sh pdscan file://path/to/file.txt pdscan file://path/to/directory pdscan file:///absolute/path/to/file.txt pdscan file://$HOME/file.txt ``` -------------------------------- ### Scan S3 Bucket for PII Source: https://github.com/ankane/pdscan/blob/master/README.md Scans an AWS S3 bucket for PII. Supports scanning individual files or entire directories (prefixes). Requires appropriate S3 permissions. ```sh pdscan s3://bucket/path/to/file.txt pdscan s3://bucket/path/to/directory/ ``` -------------------------------- ### Scan OpenSearch Data Source: https://github.com/ankane/pdscan/blob/master/README.md Scans an OpenSearch instance for PII. Supports both HTTP and HTTPS connections, and allows specifying specific indices or using wildcards. ```sh pdscan opensearch+http://user:pass@host:9200 pdscan opensearch+http://user:pass@host:9200/index1,index2 pdscan "opensearch+http://user:pass@host:9200/index*" ``` -------------------------------- ### Scan Elasticsearch Data Source: https://github.com/ankane/pdscan/blob/master/README.md Scans an Elasticsearch instance for PII. Supports both HTTP and HTTPS connections, and allows specifying specific indices or using wildcards. ```sh pdscan elasticsearch+http://user:pass@host:9200 pdscan elasticsearch+http://user:pass@host:9200/index1,index2 pdscan "elasticsearch+http://user:pass@host:9200/index*" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.