Skip to content

Commit

Permalink
- fix: incorrect cmd management in raw mode. (#18)
Browse files Browse the repository at this point in the history
- features: ats historical bytes customization
  • Loading branch information
gvinet authored Oct 1, 2020
1 parent 42be19d commit 855c88a
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ def enter_bbio(ser):

uid = bytes.fromhex("DEADBEEF")
print(f"Set UID to {uid.hex()}")
ser.write(b"\04" + b"\04" + uid)
ser.write(b"\x04" + b"\x04" + uid)
resp = ser.read(1)
assert resp[0] == 0x01

sak = b"\x21"
print(f"Set SAK to {sak.hex()}")
ser.write(b"\05" + b"\01" + sak)
ser.write(b"\x05" + b"\x01" + sak)
resp = ser.read(1)
assert resp[0] == 0x01

ats_hist_bytes = bytes("HydraNFC", "ascii")
print(f"Set ATS Historical bytes to {ats_hist_bytes.hex()}")
ser.write(b"\x0B" + bytes([len(ats_hist_bytes)]) + ats_hist_bytes)
resp = ser.read(1)
assert resp[0] == 0x01

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
import serial

port = "/dev/ttyACM2"
port = "/dev/ttyACM1"

ser = serial.Serial(port, timeout=None)

Expand All @@ -35,13 +35,19 @@ def enter_bbio(ser):

uid = bytes.fromhex("DEADBEEF")
print(f"Set UID to {uid.hex()}")
ser.write(b"\04" + b"\04" + uid)
ser.write(b"\x04" + b"\x04" + uid)
resp = ser.read(1)
assert resp[0] == 0x01

sak = b"\x21"
print(f"Set SAK to {sak.hex()}")
ser.write(b"\05" + b"\01" + sak)
ser.write(b"\x05" + b"\x01" + sak)
resp = ser.read(1)
assert resp[0] == 0x01

ats_hist_bytes = bytes("HydraNFC", "ascii")
print(f"Set ATS Historical bytes to {ats_hist_bytes.hex()}")
ser.write(b"\x0B" + bytes([len(ats_hist_bytes)]) + ats_hist_bytes)
resp = ser.read(1)
assert resp[0] == 0x01

Expand Down
1 change: 1 addition & 0 deletions src/hydrabus/hydrabus_bbio.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,6 @@
#define BBIO_NFC_CE_CARD_CMD 0b00001000
#define BBIO_NFC_CE_END_EMULATION 0b00001001
#define BBIO_NFC_CE_START_EMULATION_RAW 0b00001010
#define BBIO_NFC_CE_SET_ATS_HIST_BYTES 0b00001011

int cmd_bbio(t_hydra_console *con);
Loading

0 comments on commit 855c88a

Please sign in to comment.