From 34d4eb3f5fd66b7abe2a74b2d33966ebc1604234 Mon Sep 17 00:00:00 2001 From: Christina Quast Date: Mon, 4 May 2015 17:50:32 +0200 Subject: [PATCH] mitm.py: Intercept phonebook request --- usb_application/constants.py | 12 ++++++++++++ usb_application/mitm.py | 3 +++ 2 files changed, 15 insertions(+) diff --git a/usb_application/constants.py b/usb_application/constants.py index a2c5eb15..154dc2d5 100644 --- a/usb_application/constants.py +++ b/usb_application/constants.py @@ -12,6 +12,18 @@ PHONE_INT = 0x86 CMD_CHANGE_FIDI = array('B', [0xff, 0x00, 0xff]) CHANGE_FIDI = array('B', [0xff, 0xff, 0xff, 0x00, 0xff]) +# Phone book +PHONE_BOOK_REQ = array('B', [0xa0, 0xb2, 0x01, 0x04, 0x1a]) +PHONE_BOOK_RESP = array('B', [0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0xff, 0xff, 0xff, 0xff, 0x09, 0x81, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00]) +PHONE_BOOK_RESP_MITM = array('B', [0x6d, 0x69, 0x74, 0x6d, 0x20, 0x21, 0x21, 0x21, 0xff, 0xff, 0xff, 0xff, 0x09, 0x81, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00]) +PHONE_BOOK_RESP2 = array('B', [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00]) +PHONE_BOOK_RESP_MITM2 = array('B', [0x6d, 0x69, 0x74, 0x6d, 0x20, 0x21, 0x21, 0x21, 0xff, 0xff, 0xff, 0xff, 0x09, 0x81, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0xff, 0xff, 0xff, 0xff, 0x90, 0x00]) + + CMD_SEL_ROOT = array('B', [0xA0, 0xA4, 0x00, 0x00, 0x02, 0x3F, 0x00]) CMD_SEL_FILE = array('B', [0xA0, 0xA4, 0x00, 0x00, 0x02, 0x7F, 0x20]) CMD_GET_DATA = array('B', [0xA0, 0xC0, 0x00, 0x00, 0x16]) diff --git a/usb_application/mitm.py b/usb_application/mitm.py index ea8710e2..4736d6cc 100755 --- a/usb_application/mitm.py +++ b/usb_application/mitm.py @@ -56,6 +56,9 @@ def replace(data): elif data[0] == 0x9F: print("*** Replace return val") # return array('B', [0x60, 0x00]) + elif data == PHONE_BOOK_RESP: + print("*** Replace phone book") + return PHONE_BOOK_RESP_MITM except ValueError: print("*** Value error! ") return data