double space a file
sed G
double space a file which already has blank lines in it.
output file should contain no more than one blank line between lines of text.
sed '/^$/d;G'
| function debug() { | |
| if [[ $DEBUG ]] | |
| then | |
| echo ">>> $*" | |
| fi | |
| } | |
| # For any debug message | |
| debug "Trying to find config file" |
| URL=${URL:-http://localhost:8080} |
| # Extract md5 hashes | |
| egrep -oE '(^|[^a-fA-F0-9])[a-fA-F0-9]{32}(1|$)' *.txt | egrep -o '[a-fA-F0-9]{32}' > md5-hashes.txt | |
| # An alternative could be with sed | |
| sed -rn 's/.*[^a-fA-F0-9]([a-fA-F0-9]{32})[^a-fA-F0-9].*/1/p' *.txt > md5-hashes | |
| # Note: The above regexes can be used for SHA1, SHA256 and other unsalted hashes represented in hex. | |
| # The only thing you have to do is change the '{32}' to the corresponding length for your desired hash-type. |
| # Extract valid MySQL-Old hashes | |
| cat *.txt | grep -e "[0-7][0-9a-f]{7}[0-7][0-9a-f]{7}" > mysql-old-hashes.txt | |
| # Extract blowfish hashes | |
| cat *.txt | grep -e "$2a$8$(.){75}" > blowfish-hashes.txt | |
| # Extract Joomla hashes | |
| cat *.txt | egrep -o "([0-9a-zA-Z]{32}):(w{16,32})" > joomla.txt | |
| # Extract VBulletin hashes |
| # Extract e-mails from text files | |
| cat *.txt | grep -E -o "[a-zA-Z0-9.#?$*_-]+@[a-zA-Z0-9.#?$*_-]+.[a-zA-Z0-9.-]+" > e-mails.txt | |
| # Extract HTTP URLs from text files | |
| cat *.txt | grep http | grep -shoP 'http.*?[" >]' > http-urls.txt | |
| # For extracting HTTPS, FTP and other URL format use | |
| cat *.txt | grep -E '(((https|ftp|gopher)|mailto)[.:][^ >" ]*|www.[-a-z0-9.]+)[^ .,; >">):]' > urls.txt | |
| # Note: if grep returns "Binary file (standard input) matches" use the following approaches |
| # Visa | |
| cat *.txt | grep -E -o "4[0-9]{3}[ -]?[0-9]{4}[ -]?[0-9]{4}[ -]?[0-9]{4}" > visa.txt | |
| # MasterCard | |
| cat *.txt | grep -E -o "5[0-9]{3}[ -]?[0-9]{4}[ -]?[0-9]{4}[ -]?[0-9]{4}" > mastercard.txt | |
| # American Express | |
| cat *.txt | grep -E -o "3[47][0-9]{13}" > american-express.txt | |
| # Diners Club |
| cat /dev/urandom | tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' | fold -w 32 | head -n 5 | |
| # cat /dev/urandom | tr -dc 'a-zA-Z0-9._!@#$%^&*()' | fold -w 8 | head -n 500000 > wordlist.txt | |
| # cat /dev/urandom | tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?=' | fold -w 12 | head -n 4 | |
| # cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 | |
| # cat /dev/urandom | base64 | tr -d '[^:alnum:]' | cut -c1-10 | head -2 | |
| # cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 4 | |
| # cat /dev/urandom| tr -dc 'a-zA-Z0-9-_!@#$%^&*()_+{}|:<>?='|fold -w 12| head -n 4| grep -i '[!@#$%^&*()_+{}|:<>?=]' | |
| # < /dev/urandom tr -dc '[:print:]' |fold -w 10| head -n 10 | |
| # tr -cd '[:alnum:]' < /dev/urandom | fold -w30 | head -n2 |
| # Mac to unix | |
| tr '15' '12' < in_file > out_file | |
| # Dos to Unix | |
| dos2unix file.txt | |
| # Unix to Dos | |
| unix2dos file.txt |