aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristina Quast <chrysh.ng+git@gmail.com>2015-05-04 17:50:32 +0200
committerChristina Quast <chrysh.ng+git@gmail.com>2015-05-04 17:50:32 +0200
commit34d4eb3f5fd66b7abe2a74b2d33966ebc1604234 (patch)
tree782effb00e92ebb4500304e4a88594bc86a126a1
parent789a4013b4a1d8877e34255667665fdc7082f82e (diff)
mitm.py: Intercept phonebook request
-rw-r--r--usb_application/constants.py12
-rwxr-xr-xusb_application/mitm.py3
2 files changed, 15 insertions, 0 deletions
diff --git a/usb_application/constants.py b/usb_application/constants.py
index a2c5eb1..154dc2d 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 ea8710e..4736d6c 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