Skip to content

Instantly share code, notes, and snippets.

@judotens
Last active December 2, 2023 07:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save judotens/7746769 to your computer and use it in GitHub Desktop.
Save judotens/7746769 to your computer and use it in GitHub Desktop.
Scrape BitCoin private keys from directory.io
#!/bin/bash
# scrape all leaked bitcoin private keys into a tab separated text
# <private key>\t<bitcoin_address>
#
# support autoresume. just add these line into your cron : * * * * bash bitcoinkey.sh
# results stored on keys.txt
if [ ! -f last.page ]; then prev=`echo 0`; else prev=`cat last.page`; fi;
if [ -z $1 ]; then akhir=`echo 10`; else akhir=`echo $1`; fi;
abis=$(($prev+$akhir))
awal=$(($prev+1))
for ((i=$awal;i<=$abis;i++))
do
echo "+ Scrapping page $i"
curl -s "directory.io/$i" > /tmp/tmp.tmp
while read baris;
do
private=`echo $baris | awk -F"<span title" '{print $2}' | awk -F"</span>" '{print $1}' | awk -F"\">" '{print $2}'`
address=`echo $baris | awk -F"<span title" '{print $2}' | awk -F"</span>" '{print $2}' | awk -F"blockchain.info/address/" '{print $2}' | awk -F"\">" '{print $1}'`
echo $private,$address | awk -F"," '{print $1'\t'$2}';
done < /tmp/tmp.tmp;
done;
echo $abis > last.page
cat keys.txt | sort | uniq > keys.tmp
mv keys.tmp keys.txt
@SatoshiNakamotoBitcoins

Simple but in pratice it could be a very effective script!

directory.io is offline at the moment but we can replace that url with a sort like service.

I noticed it struggles with large integer pagenumbers; directory.io or sort like services have at maximum 75 digit pagenumbers (max is 904625697166532776746648320380374280100293470930272690489102837043110636675) so when I alter your script to start scraping for example at page 763835059889048312868517553357516548691778841505234417981029206769278074548 the script will ignore this and start at page + Scrapping page 1265986080766639797 as you can see this is not a 75 digit number.
When I enter this 75 digit number 701556283996480265118067434887086554313910452836155309863048474333562186100 it starts scraping at 6546276832271837557 it seems a random number, but the comparison is that both examples seems to be a 19 digit number.

If we could search for the entire keyspace, your script could be golden.

Like to learn from you, for a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment