Skip to content

Instantly share code, notes, and snippets.

@daedalus
Created January 25, 2017 16:18
Show Gist options
  • Select an option

  • Save daedalus/0c5c14c07cfd0ed345df73ecd57bf8a5 to your computer and use it in GitHub Desktop.

Select an option

Save daedalus/0c5c14c07cfd0ed345df73ecd57bf8a5 to your computer and use it in GitHub Desktop.
import sys
import struct
from binascii import unhexlify, crc32
import urllib2
transaction = str(sys.argv[1])
data = urllib2.urlopen("https://blockchain.info/tx/"+transaction+"?show_adv=true")
dataout = b''
atoutput = False
for line in data:
if 'Input Scripts' in line:
atoutput = True
if '</table>' in line:
atoutput = False
if atoutput:
if len(line) > 100:
chunks = line.split(' ')
for c in chunks:
if 'O' not in c and '\n' not in c and '>' not in c and '<' not in c:
dataout += unhexlify(c.encode('utf8'))
#length = struct.unpack('<L', dataout[0:4])[0]
#checksum = struct.unpack('<L', dataout[4:8])[0]
#dataout = dataout[8:8+length]
print dataout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment