Last active
August 19, 2020 17:04
-
-
Save temp3l/d556d9d842259ce5d7fbb0a95957fa01 to your computer and use it in GitHub Desktop.
ripgrep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# brew install ripgrep | |
# 1. You want to find all strings matching "console.log" in your ~/workspace folder. | |
# 2. You dont want to search inside .git or node_modules folders. | |
# 3. Ignore-case but search inside zip-files | |
# quicky: | |
rg 'console\.log' ~/workspace | |
# advanced: | |
rg --search-zip -N --ignore-case --glob='!git/*' --glob='!node_modules/*' 'console\.log' ~/workspace/ | |
# You want to find all strings: | |
# 1. starting with ':' or staring with ';' | |
# 2. containing characters abcdef | |
# 3. exact string length: 33 | |
rg '^[:;]([a-f0-9]{33}$)' ~/workspace | |
# You want to find all ip-adresses containing '192.168.1.1' in your /etc/ folder: | |
rg '192\.168\.1\.1' /etc | |
# find strings starting with '192.168.1.1' | |
rg '^192\.168\.1\.1' /etc | |
# find strings ending with '192.168.1.1' | |
rg '192\.168\.1\.1$' /etc | |
# find strings containing 'console\.log' or '192.168.1.1' from /etc: | |
rg 'console\.log|192\.168\.1\.1' /etc | |
# Find all SHA-256 and MD5-based password hashes starting with: ':$' or '|$' or ';$' | |
rg --search-zip -N --stats --smart-case '[:|;](\$[\$=a-zA-Z0-9/\.]{63}$)|[:|;](\$[\$=a-zA-Z0-9/\.]{33}$)|[:|;]([a-f0-9]{33}$)' /mnt/data | |
# match after ':' or after ';' oder after '|' | |
# only the characters specified inside '[]' | |
# exact group length 33 or 63 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment