Last active
May 18, 2017 15:05
-
-
Save thomascys/5067588fde8172510e0af451bbe98a03 to your computer and use it in GitHub Desktop.
wannacry btc addr reporting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WannaCry BTC address report script | |
# 5/12/17 -- chris_commat_misentropic_commercial | |
sep() { | |
for a in {1..80}; do printf "=" ; done ; echo | |
} | |
filt() { | |
sed 's#<.*">##;s#<.*##' | awk '{print $1}' | |
} | |
ADDRS="115p7UMMngoj1pMvkpHijcRdfJNXj6LrLn 12t9YDPgwueZ9NyMgw519p7AA8isjr6SMw 13AM4VW2dhxYgXeQepoHkHSQuy6NgaEb94" | |
BURL="https://blockchain.info/address" | |
MPRICE="$(curl -s http://www.coindesk.com | grep currency-price-in-header | filt | head -n1)" | |
MPRICE=${MPRICE//\$/};MPRICE=${MPRICE//,/} | |
NTT=0;TRT=0 | |
for addr in $ADDRS | |
do OUTPUT="$(curl -s ${BURL}/${addr})" | |
NT=$(echo "$OUTPUT" | grep n_transactions | filt) | |
TR=$(echo "$OUTPUT" | grep total_received | filt) | |
printf "${addr}:\nTransactions: ${NT} Received: ${TR}BTC\n";sep | |
NTT=$(printf "scale=10\n$NTT + $NT\n"|bc) | |
TRT=$(printf "scale=10\n$TRT + $TR\n"|bc) | |
done | |
printf "Total Transactions: ${NTT}\nTotal BTC Received: ${TRT}BTC\n" | |
printf "Total Est. USD: \$";(printf "scale=10\n${MPRICE}*${TRT}\n"|bc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment