Skip to content

Instantly share code, notes, and snippets.

@atomantic
Forked from judotens/bitcoinkey.sh
Created May 15, 2017 04:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomantic/7398053c8048281c6686104d1c0aec23 to your computer and use it in GitHub Desktop.
Save atomantic/7398053c8048281c6686104d1c0aec23 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
@somlisto
Copy link

somlisto commented Nov 8, 2019

Can you explain how it works I m kinda lost

@atomantic
Copy link
Author

I'm not sure directory.io is even a thing anymore, but it was just dynamically generating keys based on numbers 1-10^77 (all possible keys). This is a pretty inefficient way to mine keys, but the idea on this script was to check the balance on blockchain.info. I don't use this script, just thought it was cute and forked it.

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