Files
hacklab/6/CANstrument3/test.py
2026-01-26 23:12:54 +01:00

28 lines
1.1 KiB
Python

import e2e
#cansend cluster1 100#D300C80000000000
#b = bytearray(b"\x01\x00\x07\xAD\x07\x62\x08\x71\x62")
#b = bytearray(b"\x00\x00\x00\x00\x00\x00\x00\x00")
#b = bytearray(b"\x00\x00\x00\xB9\xE6\x6B\x06\x00")
b = bytearray(b"\x00\x0B\x10\x15\xC3\x2A\x4A\x00")
#for i in range(0,255):
# b[0] = i
# print(hex(i), end='')
# print(" ", end='')
#crc: int = e2e.crc.calculate_crc8_h2f(b)
for i in range(0,255):
print(hex(i), end='')
print(" ", end='')
e2e.p02.e2e_p02_protect(b, 7, bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, i, 0x0d, 0x0e, 0x0f, 0x10]), increment_counter=False)
print(b.hex())
#b = bytearray(b"\x00\x0B\x10\x15\xC3\x2A\x4A\x00")
e2e.p02.e2e_p02_protect(b, 7, bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0xd2, 0x0d, 0x0e, 0x0f, 0x10]), increment_counter=False)
print(b.hex())
b = bytearray(b"\x00\x0B\xC8\x00\x00\x00\x00\x00")
e2e.p02.e2e_p02_protect(b, 7, bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0xd2, 0x0d, 0x0e, 0x0f, 0x10]), increment_counter=False)
print(b.hex())