Skip to content

0x4xel0rd/Windows-String-Search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 

Repository files navigation

πŸ” Windows Grep Alternatives Cheatsheet

This cheatsheet provides grep alternatives for Windows CMD and PowerShell to search for usernames, passwords, hashes, API keys, and database connection strings.


πŸ” 1️⃣ CMD (Command Prompt) Grep Alternatives

CMD does not have grep, but you can use findstr instead.

πŸ”Ή Search for "username:password" Patterns

findstr /R /I "username[:=].* password[:=].*" /S C:\path\to\folder\*.*

βœ… Matches:

username=admin
password:SuperSecret123

πŸ”Ή Search for Hashes (MD5, SHA1, SHA256, NTLM)

findstr /R /I "[a-f0-9]\{32,64\}" /S C:\path\to\folder\*.*

βœ… Matches:

5f4dcc3b5aa765d61d8327deb882cf99  # MD5
d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2  # SHA1

πŸ”Ή Search for Database Connection Strings

findstr /R /I "mysql:\/\/.*:.*@.*" /S C:\path\to\folder\*.*

βœ… Matches:

mysql://root:BackDropJ2024DS2024@127.0.0.1/backdrop
postgresql://admin:SuperSecure123@localhost:5432/mydb

πŸ”Ή Search for API Keys and Secrets

findstr /R /I "api[_\-]?key[=:].*" /S C:\path\to\folder\*.*

βœ… Matches:

api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
apiKey='AKIAIOSFODNN7EXAMPLE'

πŸ” 2️⃣ PowerShell Grep Alternatives

PowerShell provides more powerful filtering with Select-String.

πŸ”Ή Search for "username:password" Patterns

Get-ChildItem -Path "C:\path\to\folder" -Recurse | Select-String -Pattern "username[:=].* password[:=].*" -CaseSensitive

βœ… Matches:

username=admin
password=SuperSecret123

πŸ”Ή Search for Hashes (MD5, SHA1, SHA256, NTLM)

Get-ChildItem -Path "C:\path\to\folder" -Recurse | Select-String -Pattern "[a-f0-9]{32,64}" -CaseSensitive

βœ… Matches:

5f4dcc3b5aa765d61d8327deb882cf99  # MD5
d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2  # SHA1

πŸ”Ή Search for Database Connection Strings

Get-ChildItem -Path "C:\path\to\folder" -Recurse | Select-String -Pattern "([a-zA-Z_]*\s*=\s*[\"']?[a-z]+:\/\/[a-zA-Z0-9._%-]+:[a-zA-Z0-9%^&*()_+=-]+@[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)" -CaseSensitive

βœ… Matches:

mysql://root:BackDropJ2024DS2024@127.0.0.1/backdrop
postgresql://admin:SuperSecure123@localhost:5432/mydb

πŸ”Ή Search for API Keys and Secrets

Get-ChildItem -Path "C:\path\to\folder" -Recurse | Select-String -Pattern "(api[_\-]?key[=:].*|aws[_\-]?secret[_\-]?access[_\-]?key[=:].*)" -CaseSensitive

βœ… Matches:

api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

πŸ” Bonus: Find Passwords in Registry

πŸ”Ή Search for Stored Credentials in Windows Registry

reg query HKLM /f "password" /t REG_SZ /s
reg query HKCU /f "password" /t REG_SZ /s

βœ… Finds stored passwords in registry keys.


πŸš€ Summary

Feature CMD (findstr) PowerShell (Select-String)
Search for "username:password" βœ… βœ…
Search for Hashes βœ… βœ…
Search for Database Connections βœ… βœ…
Search for API Keys βœ… βœ…
Search in Windows Registry ❌ βœ…

πŸš€ Why Use This?

βœ”οΈ Find hardcoded passwords, API keys, and hashes in config files, logs, and scripts.
βœ”οΈ Useful for pentesting, security audits, and incident response.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published