Created
December 25, 2023 12:44
-
-
Save OlivierKobialka/9d3c6f90c22ce4b9629c31807b29bb7d to your computer and use it in GitHub Desktop.
Revisions
-
OlivierKobialka created this gist
Dec 25, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,114 @@ # Match Private and Public Keys using Regular Expressions 1. [Ethereum (ETH)](#ethereum) 2. [Bitcoin (BTC)](#bitcoin) 3. [Monero (XMR)](#monero) 4. [PuTTY SSH RSA Key](#putty-ssh-rsa-key) 5. [PuTTY SSH DSA Key](#putty-ssh-dsa-key) 6. [ECDSA Private Key](#ecdsa-private-key) 7. [SSL Certificate](#ssl-certificate) 8. [John the Ripper](#john-the-ripper) 9. [Password etc passwd](#password-etc-passwd) 10. [Password etc shadow](#password-etc-shadow) 11. [JWK](#jwk) 12. [PGP Private](#pgp-private) 13. [SSH DDS Public](#ssh-dds-public) 14. [SSH RSA Public](#ssh-rsa-public) 15. [PKCS7 Encrypted Data](#pkcs7-encrypted-data) 16. [PGP Header](#pgp-header) 17. [PGP Public](#pgp-public) ## Private Keys 🔐 ### Ethereum (ETH) ``` /(^|\b)(0x)?[0-9a-fA-F]{64}(\b|$)/ ``` ### Bitcoin (BTC) ``` /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/g ``` ### Monero (XMR) ``` /4[0-9AB][1-9A-HJ-NP-Za-km-z]{93}$/g ``` ### PuTTY SSH RSA Key ``` /^PuTTY-User-Key-File-2: ssh-rsa\s*Encryption: none(?:.|\s?)*?Private-MAC:$/ ``` ### PuTTY SSH DSA Key ``` /^PuTTY-User-Key-File-2: ssh-dss\s*Encryption: none(?:.|\s?)*?Private-MAC:$/ ``` ### ECDSA Private Key ``` /^-----BEGIN ECDSA PRIVATE KEY-----\s.*,ENCRYPTED(?:.|\s)+?-----END ECDSA PRIVATE KEY-----$/ ``` ### SSL Certificate ``` /^-----BEGIN CERTIFICATE-----(?:.|\n)+?\s-----END CERTIFICATE-----$/ ``` ### John the Ripper ```` /^[J,j]ohn\ [T,t]he\ [R,r]ipper|john-[1-9].[1-9].[1-9]|Many\ salts:|Only\ one\ salt:|openwall.com/john/|List.External:[0-9a-zA-Z]*|Loaded\ [0-9]*\ password hash|guesses:\ \d*\ \ time:\ \d*:\d{2}:\d{2}:\d{2}|john\.pot$/ ```` ### Password etc passwd ``` /^[a-zA-Z0-9\-]+:[x|\*]:\d+:\d+:[a-zA-Z0-9/\- "]*:/[a-zA-Z0-9/\-]*:/[a-zA-Z0-9/\-]+$/ ``` ### Password etc shadow ``` /^[a-zA-Z0-9\-]+:(?:(?:!!?)|(?:\*LOCK\*?)|\*|(?:\*LCK\*?)|(?:\$.*\$.*\$.*?)?):\d*:\d*:\d*:\d*:\d*:\d*:$/ ``` ### JWK ``` /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm ``` ### PGP Private ``` /^(-----BEGIN PGP PRIVATE KEY BLOCK-----).*([a-zA-Z0-9//\n\/\.\:\+\ \=]+).*(-----END PGP PRIVATE KEY BLOCK-----)$/ ``` ## Public Keys 🔑 ### Ethereum Public (ETH) ``` /(^|\b)(0x)?[0-9a-fA-F]{64}(\b|$)/ ``` ### SSH DDS Public ``` /^ssh-dss [0-9A-Za-z+/]+[=]{2}$/ ``` ### SSH RSA Public ``` /^ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3} [^@]+@[^@]+$/ ``` ### PKCS7 Encrypted Data ``` /^(?:Signer|Recipient)Info(?:s)?\ ::=\ \w+|[D|d]igest(?:Encryption)?Algorithm|EncryptedKey\ ::= \w+$/ ``` ### PGP Header ``` /^-{5}(?:BEGIN|END)\ PGP\ MESSAGE-{5}$/ ``` ### PGP Public ``` /^(-----BEGIN PGP PUBLIC KEY BLOCK-----).*([a-zA-Z0-9//\n\/\.\:\+\ \=]+).*(-----END PGP PUBLIC KEY BLOCK-----)$/ ```