Advertisement
pastebindigicoin

CHECKADDY.sh by digicoinuser

Mar 24th, 2016
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.82 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. #Vanitygen output file reader/searcher/aggregator
  4. #
  5. #file output is achieved with the following command
  6. #./vanitygen -f addressfind.txt -k -o address.txt
  7. #
  8. #USAGE - ./CHECKADDY.sh "1SEARCHADDRESS" "address_list.txt" /home/custom_addy_dir/
  9. #usage using default DIR showing all addresses - ./CHECKADDY.sh
  10. #usage with SEARCHTERM - ./CHECKADDY.sh "1Digicoin"
  11. #usage define DIR - ./CHECKADDY.sh "1Digicoin" "" /home/bct/vanitygen-master/AFOUNDdir/
  12. #usage using FILE and blank search term - ./CHECKADDY.sh "1Digicoin" address.txt
  13.  
  14. ADDYDIR="/home/bct/vanitygen-master/AFOUNDdir/"
  15. ADDYFILE=""
  16. ADDYFIND=""
  17. ADDY_DUMMYVAR="blank"
  18. ADDY_TMP_FILENAME="tmp_Address_list.txt"
  19. if [ -z "$1" ]                           # Is parameter #1 zero length?
  20. then
  21.         #echo "-Parameter #1 is zero length.-"  # Or no parameter passed.
  22.         ADDY_DUMMYVAR=""
  23. else
  24.         #echo "-Parameter #1 is \"$1\".-"
  25.         ADDYFIND="$1"
  26. fi
  27. if [[ ${ADDYFIND} == ? ]] || [[ ${ADDYFIND} == "help" ]] || [[ ${ADDYFIND} == "?help" ]] || [[ ${ADDYFIND} == "-help" ]] || [[ ${ADDYFIND} == "--help" ]] ; then
  28.         echo "=============================================================="
  29.         echo "Vanitygen Address Output File Search/Read Dir/Aggregate"
  30.         echo "Script filename: 'CHECKADDY.sh' - Script by: digicoinuser"
  31.         echo "=============================================================="
  32.         #echo "Script will search through all vanitygen output files in the specified directory"
  33.         echo "Default dir for Vanitygen output files: '${ADDYDIR}'"
  34.         echo "Default temporary file created in same dir as output files: '${ADDY_TMP_FILENAME}'"
  35.         echo "Default values can be changed in start of script"
  36.         echo " "
  37.         echo "File output from vanitygen is achieved with the following command:"
  38.         echo "./vanitygen -f addressfind.txt -k -o AFOUNDdir/address.txt"
  39.         echo "'addressfind.txt' is the input file (one search term per line) and is set with flag -f"
  40.         echo "'address.txt' is the output file set with the flag -o"
  41.         echo " "
  42.         echo "SCRIPT USAGE:"
  43.         echo "Search entire directory and tally addresses"
  44.         echo "./CHECKADDY.sh"
  45.         echo " "
  46.         echo "Search term for whole directory:"
  47.         echo "./CHECKADDY.sh '1SEARCHADDRESS'"
  48.         echo " "
  49.         echo "Search term & file to search:"
  50.         echo "./CHECKADDY.sh '1SEARCHADDRESS' 'address_list.txt'"
  51.         echo " "
  52.         echo "Using all custom settings:"
  53.         echo "./CHECKADDY.sh '1SEARCHADDRESS' 'address_list.txt' /home/dir/custom_addy_dir/"
  54.         echo " "
  55.         exit
  56. fi
  57. if [ -z "$2" ]                           # Is parameter #2 zero length?
  58. then
  59.         #echo "-Parameter #2 is zero length.-"  # Or no parameter passed.
  60.         ADDY_DUMMYVAR=""
  61. else
  62.         #echo "-Parameter #2 is \"$2\".-"
  63.         ADDYFILE="$2"
  64. fi
  65. if [ -z "$3" ]                           # Is parameter #3 zero length?
  66. then
  67.         #echo "-Parameter #3 is zero length.-"  # Or no parameter passed.
  68.         ADDY_DUMMYVAR=""
  69. else
  70.         #echo "-Parameter #3 is \"$3\".-"
  71.         ADDYDIR="$3"
  72. fi
  73. ADDYFILE_COUNT=${#ADDYFILE}
  74. #echo "ADDYFIND - ${ADDYFIND}"
  75. #echo "ADDYFILE - ${ADDYFILE}"
  76. #echo "ADDYDIR - ${ADDYDIR}"
  77. #echo "ADDYFILE_COUNT - ${ADDYFILE_COUNT}"
  78.  
  79. if [[ ${ADDYFILE_COUNT} > 1 ]] ; then
  80.         #get number of found addresses
  81.         n_addys=$(grep -c "Address: $ADDYFIND" ${ADDYDIR}${ADDYFILE})
  82.         echo "Number of addresses in file: ${n_addys}"
  83.         echo "File Location - ( ${ADDYDIR}${ADDYFILE} )"
  84.         sleep 1.5
  85.         #show output of addresses
  86.         grep "Address: $ADDYFIND" ${ADDYDIR}${ADDYFILE}
  87. else
  88.         FILES="${ADDYDIR}*"
  89.         #shorthand notation if statement below
  90.         [ -f ${ADDYDIR}${ADDY_TMP_FILENAME} ] && rm ${ADDYDIR}${ADDY_TMP_FILENAME}
  91.         for f in $FILES
  92.         do
  93.           echo "Processing $f file..."
  94.           n_addys=$(grep -c "Address: $ADDYFIND" ${f})
  95.           echo "Number of addresses in file: ${n_addys}"
  96.           # take action on each file. $f store current file name
  97.           # cat $f
  98.           grep "Address: $ADDYFIND" ${f} >> ${ADDYDIR}${ADDY_TMP_FILENAME}
  99.         done
  100.  
  101.  
  102.         #get number of found addresses
  103.         n_addys=$(grep -c "Address: $ADDYFIND" ${ADDYDIR}${ADDY_TMP_FILENAME})
  104.         echo "Total number of addresses: ${n_addys}"
  105.         echo "Temp File Location - ( ${ADDYDIR}${ADDY_TMP_FILENAME} )"
  106.         sleep 1.5
  107.         #show output of addresses
  108.         if [[ ${n_addys} -ge 1 ]] ; then
  109.             echo " "
  110.             echo "View results? (${n_addys} found)"
  111.             select yn in "Yes" "No"; do
  112.                 case $yn in
  113.                     Yes ) grep "Address: $ADDYFIND" ${ADDYDIR}${ADDY_TMP_FILENAME}; break;;
  114.                     No ) exit;;
  115.                 esac
  116.             done
  117.         fi
  118. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement