Skip to content

Instantly share code, notes, and snippets.

@arzzen

arzzen/search.sh

Last active Jan 2, 2018
Embed
What would you like to do?
Bash script for search in 1.4bilion text credentials.
#!/bin/bash
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [ "$1" != "" ]; then
letter1=$(echo ${1,,}|cut -b1)
if [[ $letter1 == [a-zA-Z0-9] ]]; then
if [ -f "$dir/data/$letter1" ]; then
cat "$dir/data/$letter1" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
else
letter2=$(echo ${1,,}|cut -b2)
if [[ $letter2 == [a-zA-Z0-9] ]]; then
if [ -f "$dir/data/$letter1/$letter2" ]; then
cat "$dir/data/$letter1/$letter2" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
else
letter3=$(echo ${1,,}|cut -b3)
if [[ $letter3 == [a-zA-Z0-9] ]]; then
if [ -f "$dir/data/$letter1/$letter2/$letter3" ]; then
cat "$dir/data/$letter1/$letter2/$letter3" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
fi
else
if [ -f "$dir/data/$letter1/$letter2/symbols" ]; then
cat "$dir/data/$letter1/$letter2/symbols" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
fi
fi
fi
else
if [ -f "$dir/data/$letter1/symbols" ]; then
cat "$dir/data/$letter1/symbols" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
fi
fi
fi
else
if [ -f "$dir/data/symbols" ]; then
cat "$dir/data/symbols" | awk -F":" '{print $1"||"$2}' | grep -ai "$2$1$3"
fi
fi
else
echo "[*] Example: ./search text [regex_start] [regex_end]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.