Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 47 lines (32 sloc) 1.734 kb
a98bd8a add a simple test file
Xiangfu Liu authored
1 #!/usr/bin/env python2.7
2
3 from serial import Serial
4 from optparse import OptionParser
5 import binascii
6
7
8 parser = OptionParser()
5b61db1 @xiangfu fix typo
xiangfu authored
9 parser.add_option("-s", "--serial", dest="serial_port", default="/dev/ttyUSB0", help="Serial port")
a98bd8a add a simple test file
Xiangfu Liu authored
10 (options, args) = parser.parse_args()
11
12 ser = Serial(options.serial_port, 115200, 8)
13
524403d add another test to payload.py
Xiangfu Liu authored
14 # This show how Icarus use the block and midstate data
a98bd8a add a simple test file
Xiangfu Liu authored
15 # This will produce nonce 063c5e01 -> debug by using a bogus URL
16 block = "0000000120c8222d0497a7ab44a1a2c7bf39de941c9970b1dc7cdc400000079700000000e88aabe1f353238c668d8a4df9318e614c10c474f8cdf8bc5f6397b946c33d7c4e7242c31a098ea500000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000"
17 midstate = "33c5bf5751ec7f7e056443b5aee3800331432c83f404d9de38b94ecbf907b92d"
18
19 rdata2 = block.decode('hex')[95:63:-1]
20 rmid = midstate.decode('hex')[::-1]
21 payload = rmid + rdata2
22
df21fcc @xiangfu one more payload
xiangfu authored
23 print("Push payload1 to icarus: " + binascii.hexlify(payload))
a98bd8a add a simple test file
Xiangfu Liu authored
24 ser.write(payload)
524403d add another test to payload.py
Xiangfu Liu authored
25
a98bd8a add a simple test file
Xiangfu Liu authored
26 b=ser.read(4)
524403d add another test to payload.py
Xiangfu Liu authored
27 print("Result:(should be: 063c5e01): " + binascii.hexlify(b))
a98bd8a add a simple test file
Xiangfu Liu authored
28
524403d add another test to payload.py
Xiangfu Liu authored
29 # Just another test
30 payload2 = "ce92099c5a80bb81c52990d5c0924c625fd25a535640607d5a4bdf8174e2c8d500000000000000000000000080000000000000000b290c1a42313b4f21b5bcb8"
df21fcc @xiangfu one more payload
xiangfu authored
31 print("Push payload2 to icarus: " + payload2)
524403d add another test to payload.py
Xiangfu Liu authored
32 ser.write(payload2.decode('hex'))
33
34 b=ser.read(4)
35 print("Result:(should be: 8e0b31c5): " + binascii.hexlify(b))
a98bd8a add a simple test file
Xiangfu Liu authored
36
df21fcc @xiangfu one more payload
xiangfu authored
37
38 # Just another test
39 # Block 171874 nonce = (0xa2870100) = 0x000187a2
40 payload3 = "4679ba4ec99876bf4bfe086082b400254df6c356451471139a3afa71e48f544a000000000000000000000000000000000000000087320b1a1426674f2fa722ce"
41 print("Push payload3 to icarus: " + payload3)
42 ser.write(payload3.decode('hex'))
43
44 b=ser.read(4)
5b61db1 @xiangfu fix typo
xiangfu authored
45 print("Result:(should be: 000187a2): " + binascii.hexlify(b))
df21fcc @xiangfu one more payload
xiangfu authored
46
Something went wrong with that request. Please try again.