From 614e6b2e8971655e60f086a4237eb548a4c140d2 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Fri, 14 Sep 2018 19:22:16 +0800 Subject: fill card table --- r2/print_cards_table.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 r2/print_cards_table.py (limited to 'r2') diff --git a/r2/print_cards_table.py b/r2/print_cards_table.py new file mode 100644 index 0000000..83bcfa3 --- /dev/null +++ b/r2/print_cards_table.py @@ -0,0 +1,22 @@ +import r2pipe +import opencc + +cc = opencc.OpenCC('t2s') +r = r2pipe.open() +data = r.cmdj("xj 240 @ 0x47fdf2") +for i in range(0,30): + addr = data[i*8+0] + (data[i*8+1]<<8) + (data[i*8+2]<<16) + (data[i*8+3]<<24) + _4 = data[i*8+4] + _5 = data[i*8+5] + _6 = data[i*8+6] + _7 = data[i*8+7] + hexs = r.cmdj("xj 10 @ {}".format(addr)) + hexstr = "" + cbytes = bytearray([]) + for i in hexs: + if i == 0: + break + hexstr += f'\\x{i:02x}' + cbytes.append(i) + big5str = cc.convert(cbytes.decode(encoding='big5')) + print("{ " + f'"{hexstr}", {_4}, {_5}, {_6}, {_7}' + ' }, /* ' + big5str + ' */') -- cgit v1.2.3