Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- #Vanitygen output file reader/searcher/aggregator
- #
- #file output is achieved with the following command
- #./vanitygen -f addressfind.txt -k -o address.txt
- #
- #USAGE - ./CHECKADDY.sh "1SEARCHADDRESS" "address_list.txt" /home/custom_addy_dir/
- #usage using default DIR showing all addresses - ./CHECKADDY.sh
- #usage with SEARCHTERM - ./CHECKADDY.sh "1Digicoin"
- #usage define DIR - ./CHECKADDY.sh "1Digicoin" "" /home/bct/vanitygen-master/AFOUNDdir/
- #usage using FILE and blank search term - ./CHECKADDY.sh "1Digicoin" address.txt
- ADDYDIR="/home/bct/vanitygen-master/AFOUNDdir/"
- ADDYFILE=""
- ADDYFIND=""
- ADDY_DUMMYVAR="blank"
- ADDY_TMP_FILENAME="tmp_Address_list.txt"
- if [ -z "$1" ] # Is parameter #1 zero length?
- then
- #echo "-Parameter #1 is zero length.-" # Or no parameter passed.
- ADDY_DUMMYVAR=""
- else
- #echo "-Parameter #1 is \"$1\".-"
- ADDYFIND="$1"
- fi
- if [[ ${ADDYFIND} == ? ]] || [[ ${ADDYFIND} == "help" ]] || [[ ${ADDYFIND} == "?help" ]] || [[ ${ADDYFIND} == "-help" ]] || [[ ${ADDYFIND} == "--help" ]] ; then
- echo "=============================================================="
- echo "Vanitygen Address Output File Search/Read Dir/Aggregate"
- echo "Script filename: 'CHECKADDY.sh' - Script by: digicoinuser"
- echo "=============================================================="
- #echo "Script will search through all vanitygen output files in the specified directory"
- echo "Default dir for Vanitygen output files: '${ADDYDIR}'"
- echo "Default temporary file created in same dir as output files: '${ADDY_TMP_FILENAME}'"
- echo "Default values can be changed in start of script"
- echo " "
- echo "File output from vanitygen is achieved with the following command:"
- echo "./vanitygen -f addressfind.txt -k -o AFOUNDdir/address.txt"
- echo "'addressfind.txt' is the input file (one search term per line) and is set with flag -f"
- echo "'address.txt' is the output file set with the flag -o"
- echo " "
- echo "SCRIPT USAGE:"
- echo "Search entire directory and tally addresses"
- echo "./CHECKADDY.sh"
- echo " "
- echo "Search term for whole directory:"
- echo "./CHECKADDY.sh '1SEARCHADDRESS'"
- echo " "
- echo "Search term & file to search:"
- echo "./CHECKADDY.sh '1SEARCHADDRESS' 'address_list.txt'"
- echo " "
- echo "Using all custom settings:"
- echo "./CHECKADDY.sh '1SEARCHADDRESS' 'address_list.txt' /home/dir/custom_addy_dir/"
- echo " "
- exit
- fi
- if [ -z "$2" ] # Is parameter #2 zero length?
- then
- #echo "-Parameter #2 is zero length.-" # Or no parameter passed.
- ADDY_DUMMYVAR=""
- else
- #echo "-Parameter #2 is \"$2\".-"
- ADDYFILE="$2"
- fi
- if [ -z "$3" ] # Is parameter #3 zero length?
- then
- #echo "-Parameter #3 is zero length.-" # Or no parameter passed.
- ADDY_DUMMYVAR=""
- else
- #echo "-Parameter #3 is \"$3\".-"
- ADDYDIR="$3"
- fi
- ADDYFILE_COUNT=${#ADDYFILE}
- #echo "ADDYFIND - ${ADDYFIND}"
- #echo "ADDYFILE - ${ADDYFILE}"
- #echo "ADDYDIR - ${ADDYDIR}"
- #echo "ADDYFILE_COUNT - ${ADDYFILE_COUNT}"
- if [[ ${ADDYFILE_COUNT} > 1 ]] ; then
- #get number of found addresses
- n_addys=$(grep -c "Address: $ADDYFIND" ${ADDYDIR}${ADDYFILE})
- echo "Number of addresses in file: ${n_addys}"
- echo "File Location - ( ${ADDYDIR}${ADDYFILE} )"
- sleep 1.5
- #show output of addresses
- grep "Address: $ADDYFIND" ${ADDYDIR}${ADDYFILE}
- else
- FILES="${ADDYDIR}*"
- #shorthand notation if statement below
- [ -f ${ADDYDIR}${ADDY_TMP_FILENAME} ] && rm ${ADDYDIR}${ADDY_TMP_FILENAME}
- for f in $FILES
- do
- echo "Processing $f file..."
- n_addys=$(grep -c "Address: $ADDYFIND" ${f})
- echo "Number of addresses in file: ${n_addys}"
- # take action on each file. $f store current file name
- # cat $f
- grep "Address: $ADDYFIND" ${f} >> ${ADDYDIR}${ADDY_TMP_FILENAME}
- done
- #get number of found addresses
- n_addys=$(grep -c "Address: $ADDYFIND" ${ADDYDIR}${ADDY_TMP_FILENAME})
- echo "Total number of addresses: ${n_addys}"
- echo "Temp File Location - ( ${ADDYDIR}${ADDY_TMP_FILENAME} )"
- sleep 1.5
- #show output of addresses
- if [[ ${n_addys} -ge 1 ]] ; then
- echo " "
- echo "View results? (${n_addys} found)"
- select yn in "Yes" "No"; do
- case $yn in
- Yes ) grep "Address: $ADDYFIND" ${ADDYDIR}${ADDY_TMP_FILENAME}; break;;
- No ) exit;;
- esac
- done
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement