Skip to content

Commit 25bf36e

Browse files
v2022.12.2-1930
script to check and convert blockchain hashes that have been improperly extracted
0 parents  commit 25bf36e

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

check_blockchain_hash.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
3+
# script to check blockchain hashes in case they are foobar'd by
4+
# a newb that doesn't know how to extract blockchain wallet hashes
5+
# by cyclone
6+
# v2022.12.2-1930
7+
8+
# variables
9+
output="cyclone_tmp_output"
10+
hash="cyclone_tmp_hash"
11+
input_clean="cyclone_input_clean"
12+
13+
# python2.7 version of blockchain2john.py is in included below and is xz compressed and base64 encoded
14+
echo -n "/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4ArCA6VdABGIQkeKIzPDdw8z/VWX7afH8OoqQzbHokaE
15+
o0M6j4zKHmOtRMbC29mu1DlIhezKOF5Ggg/IKOf+ncIwE5S3uvBY3PrYmpzfS6+epehU5YVRx0RC
16+
ku6V/aP54IJYB9mKyG9Pmap9fZpXJJIJbSayThjEKn/QA8/ctDcu2z5YTfMCIhmbVbTRIYSLYaFw
17+
SY32W2OVOLSWWCoIzuZsznYf7a4xZQwdEbGvqUhnTNGFT3hQKvQ+q2v4zshGs5wSPDxtmXsKQHNJ
18+
NzUeb+WFDymaMCoevVdwrPrrLykWgWSVb5njLuhJ4xjwGlSyj+/FtXOXPxLtPWGvgfI+2GMu4Fxo
19+
+4GGaipPGMRthtfxsNiJuJA2Xfgh9DxXuZWQ8WhpULiSX9GMFK7mcS9/E6ZsKBLS/aAKqIPyBY7f
20+
uADhw5e5m+LMJAOjNAruNfvyafqnaWMuL44gpAU96kccIr697jLL2n31uRMjw+8xbHhm2r+9tn70
21+
1lKZJ7euKmCCsxvZafEl3XfGLhdvqekP36kPhHeQA+LA2OTYXwspEsK5HEAZuG3WmOHXY1qSc/Er
22+
XKzZZDRjd+OfbCnbFXujkD27OuPxraNV5QmaEhF3FIQGMdSXu4M2U8k50h/FRIIsosQlUeLoEySz
23+
1DmnE6iEoH07cTxpkzlw8HdCTuxSoNjiCZ9hbro5RSuck1KdFsoGO9Xv3OLNUYE8PRJwG+j4mC7o
24+
PczgCJ+6f0nVf4mkPLwnCL1Rwawg3FC6gwePnAGt6UaPTLYERQOxQeVhcPCkes71/98sY1XPL70b
25+
AFGHBMlut3D/0zDU4C6QjoWAdH2yU/BWnjNPrjGnC7rpaE9ujMX9FtdUyD6FONMrS/oEhKpb40yH
26+
3pQXC4aHPBm2qr+CHawiKsHTkaDgCYf4XMn/pwlvPTONNkw+2g1bbp+6P1FzvPbHZ1P6fn+GpBVa
27+
L01MrvvRLpBOceiFR58RK0d9pqNG+yrlrt12kdzhbExxRH3W2wtFo3p0doBKJ+zTTG1EKsfanHPG
28+
F787Z+mUEAiLmSvjNj6kIHpU6vW+63vp3v8y7veTheEDVGpxTs+mHbiVrIrxXVAQ3aq33RqsX+te
29+
AVgmxjBGuoLw04MGa5O9gVFBQVgK0ufFTu3Ojlnuyg3qt8/9Odf/HqhZtywINAdDRbFr+Z5k7j/f
30+
icGQPdXFRT1ZDf9kCakfKYSUUbarzUj1LEA5RLHHQDJhwND/P8XBQwK7bVe9n0wLNwezdAAAAAAB
31+
OqkFVqe6qQABwQfDFQAAr+XU1bHEZ/sCAAAAAARZWg==" | base64 -d | xz -d > blockchain2john.py
32+
jtr_blockchain="python2.7 blockchain2john.py --base64 $output"
33+
34+
# check prerequisites
35+
# python2.7
36+
if ! command -v python2.7 -V &> /dev/null
37+
then
38+
clear
39+
echo "Cannot find python2.7. Please make sure it is installed."
40+
exit
41+
fi
42+
43+
# start script
44+
45+
clear
46+
47+
echo "Paste a single blockchain hash to check:"
48+
echo
49+
read input_raw
50+
51+
# parse input to remove invalid characters such as \t, \n, etc...
52+
echo $input_raw | tr -d '\n'| tr -d "\t" | tr -d " " | egrep -i 'blockchain' > $input_clean
53+
54+
# main loop
55+
while true; do
56+
# parse input hash and convert from hex to ascii
57+
cat $input_clean | rev | cut -d$ -f1 | rev | xxd -p -r > $output
58+
# sub loop to check if hash needs converted or not
59+
while true; do
60+
clear
61+
echo "Checking if hash needs converted..."
62+
sleep 0.5
63+
# run sanity check on hash
64+
cat $output | egrep -i '[[:print:]]{40,}' > /dev/null && break
65+
echo
66+
echo "Hash does not need converted."
67+
echo
68+
exit 1
69+
break
70+
done
71+
echo
72+
echo "Hash needs converted!"
73+
sleep 0.5
74+
echo
75+
echo "Converting hash..."
76+
sleep 0.5
77+
echo
78+
# run jtr_blockchain to convert hash
79+
$jtr_blockchain | cut -d: -f2 > $hash
80+
# final sanity check
81+
cat $hash | egrep -i '[[:print:]]{40,}' > /dev/null && cat $hash || echo "Could not convert hash."
82+
echo
83+
break
84+
done
85+
86+
# clean up tmp files
87+
rm $output $hash $input_raw $input_clean blockchain2john.py &> /dev/null

0 commit comments

Comments
 (0)