Commit Graph

1086 Commits

Author SHA1 Message Date
Christina Quast ebd0fa9d43 gsmtap.py: Send ATR bytes as test command 2015-05-29 16:42:51 +02:00
Christina Quast 3742ef1cde simtrace.py: Comment to remove test func select_file 2015-05-18 18:31:51 +02:00
Christina Quast 4930ea6032 ccid.py: Removed read_bin command
The code was used as early debug code to read different files from
the SIM card and therefore acquire the IMSI, and other SIM card
specific information.

This only was useful for testing that the firmware worked properly.
Is is not needed for regular use cases.
2015-05-18 17:25:36 +02:00
Christina Quast e0832d6a1f serial_pysim.py: Cleanup: early test code for serial pysim communication
The code changes the config to config number 2 and tries to connect
to the serial CCID reader. This only was useful in the early stage
of the project.
2015-05-18 17:19:45 +02:00
Christina Quast ba486b61ad simtrace.py: remove unused cmd line option
The commands "cmd1", "cmd2", "cmd_poweron", "cmd_poweroff",
"cmd_get_slot_stat", "cmd_get_param" where early test commands,
but have not been used as such in moths.

A programmer, who wants to send commands to the smartcard, should
use the functions of ccid_raw.py (e.g. send_receive_cmd) instead.
2015-05-18 17:16:31 +02:00
Christina Quast 66224b7e1b Removed unused phone.py
The SIM card emulator re-uses the mitm.py code with an implementation
of SIM card requests and answers instead of phone.py.
2015-05-14 18:13:08 +02:00
Christina Quast 427ae3547a sniffer.py: Removed unused find_dev function 2015-05-14 18:12:05 +02:00
Christina Quast 020e5d6a5f mitm.py: Pass device to do_mitm function 2015-05-14 18:11:23 +02:00
Christina Quast f25a760f6e simtrace.py: Cleaned up unused functions 2015-05-14 18:09:47 +02:00
Christina Quast bd5b8bd7f7 usb.c: Corrected grammatical mistake 2015-05-14 17:25:41 +02:00
Christina Quast 5cf676df61 sniffer.py: Removed redundant find_dev function 2015-05-14 17:21:34 +02:00
Christina Quast 425717d08b mitm,sniffer.py: Send APDUs to wireshark 2015-05-14 17:20:55 +02:00
Christina Quast 152e878bfe gsmtap.py: Ported from scapy to socket
With the python module scapy the headers of each layer have to be created
by hand. Furthermore, in order to use it, the program would have to be
started as root.

Using sockets would be the better. The reason for using scapy was, that
it was the first best thing that I found when searching for python
socket communication.
The next step would be to open and close the socket only once instead
of every time an APDU is send to wireshark.
Furthermore, the ATR probably has to be treated differently from APDU packets.
2015-05-14 17:19:28 +02:00
Christina Quast 59dae92398 apdu_split.py: Fixed off by one err in parsing
Parsing failed like in this dump:
('PTS: ', [255, 0])
('PTS: ', [255, 0, 255])
('APDU:', 'c0', 'a0 c0 00 00 16 c0 00 00 00 00 7f 20 02 00 00 00 00 00 09 91 00 17 04 00 00 00 83 8a 90')
ACK
('APDU:', 'a4', '00 a0 a4 00 00 02 7f 20 9f 16')
('APDU:', 'c0', 'a0 c0 00 00 16 c0 00 00 00 00 7f 20 02 00 00 00 00 00 09 91 00 17 04 00 83 8a 83 8a 90')

a0 c0 00 00 16 c0 00 00 00 00 7f 20 02 00 00 00 00 00 09 91 00 17 04 00 00 00 83 8a 90
00 a0 a4 00 00 02 7f 20 9f 16
a0 c0 00 00 16 c0 00 00 00 00 7f 20 02 00 00 00 00 00 09 91 00 17 04 00 83 8a 83 8a 90

So when data was sent, the next packet would always begin with the SW2 byte
(e.g. 00 a0 ..) instead of the instruction byte a0.
The problem was a wrong state change (to APDU_S_DATA instead of APDU_S_SW1)
2015-05-14 16:58:41 +02:00
Christina Quast 20e89af1bf apdu_split.py: Changed buf data type list to array
The data type of incoming and outgoing data should be the same
at all points of the program to make it consistent.
For this program the data type is array.array.
2015-05-14 16:55:38 +02:00
Christina Quast 2a9c063d6b gsmtap.py: gsmtap_send_apdu and test main function
ATRs should probably be treated differently?
Also, is there a performance penalty when using scapy instead of holding a connection open?
2015-05-12 19:31:04 +02:00
Christina Quast b894691841 gsmtap.py: send example msg using scapy
The GSM message appears in wireshark when sniffing on localhost
2015-05-12 16:03:23 +02:00
Christina Quast 96025dbb69 phone.c: removed comments
Removed comment describing the typical first few packets between the
SIM card and phone I used for development and testing:
SuperSIM, Motorola C123
2015-05-08 17:31:14 +02:00
Christina Quast 049772e688 phone.c: Removed comment about wait time extension
Wait time extension commands are not implemented yet.
They are a nice-to-have for the future, since they would enable
the board to work with phones that expect a higher frequency.

With a wait time extension request towards the phone, SIMtrace could
signal the phone to wait for a longer time period while SIMtrace is
still waiting for a response from the SIM card.
2015-05-08 17:19:16 +02:00
Christina Quast 3b544a1217 cciddriverdesc: Atmel bug fix of slot status register
Atmel library mixes up the value for two different messages.
Explanation can be found here:
http://permalink.gmane.org/gmane.comp.mobile.osmocom.simtrace/29

Actually, a better fix for this problem would be to go through the
Atmel code and replace ICC_INSERTED_EVENT with ICC_BS_PRESENT_NOTACTIVATED
where appropriate and in accordance with the Smart Card CCID standard
(and libccid, for this matter).
2015-05-08 16:59:47 +02:00
Christina Quast 3735039b59 firmware, host: Changed vendor and product id
The code used a vendor and product id taken from Atmel example code.
Now it is changed to the vendor and product id, which was also previously
used in the original SIMtrace code.
2015-05-08 16:47:29 +02:00
Christina Quast 14f6399c03 tc_etu.c: Removed, because was never used
Since the host side does the parsing of the packets, (not the firmware,
as it was in the old simtrace version), we do not need to check for expired
max waiting time.
Instead, every byte received from the phone is filled into a ring buffer.
As soon as the USB endpoint to the host is not busy anymore, it is sent
to the host over the respective USB endpoint.
2015-05-08 16:45:28 +02:00
Christina Quast 5f83861b17 mitm.c: Removed unused commented out code 2015-05-08 16:45:28 +02:00
Christina Quast 560ade3239 main.c: Removed TC_Start/_Stop (was commented out)
Removed FIXME comment
Removed TC_Start, TC_Stop function call, which was commented out anyways.
2015-05-08 16:45:28 +02:00
Christina Quast 1b65ad0329 sniffer.c: Removed unused PR macro defnition 2015-05-08 16:45:28 +02:00
Christina Quast 0bf65dc0b6 usb.c: Removed FIXME comment
MITM does not support two interface settings.
The comment mixed up interface configurations and alternative
interface settings.
2015-05-08 16:45:28 +02:00
Christina Quast ae82155866 USBDDriver.c: swaped args to memset 2015-05-08 16:45:15 +02:00
Christina Quast bfd7354c86 usb.c: removed comment, named phone interface of MITM conf
String descriptor #0 always is the language descriptor.

The second USB interface is in the MITM configuration is
the interface to the phone.
2015-05-08 16:00:51 +02:00
Christina Quast 2c68f9c825 Makefile: Removed unused object file target tc_etu 2015-05-08 15:37:57 +02:00
Christina Quast 4a30a3700b Remove PR define, replace with TRACE_DEBUG
The define PR was introduced to switch quickly between TRACE levels
for specific debug print messages.

Now, it all became debug output, since it is not needed in normal
operation.
2015-05-08 15:34:45 +02:00
Christina Quast 9dbf1c90ac main.c: Set green LED when USB is configured 2015-05-06 08:46:32 +02:00
Christina Quast 34d4eb3f5f mitm.py: Intercept phonebook request 2015-05-04 17:50:32 +02:00
Christina Quast 789a4013b4 Added pts parsing 2015-05-04 15:29:07 +02:00
Christina Quast 05ba5232db removed pySim dead link 2015-05-04 15:28:50 +02:00
Christina Quast b6e005cec1 mitm.py: Working pts parsing and answer 2015-05-04 15:28:03 +02:00
Christina Quast 7c5d13401c constants.py: added atr 2015-05-04 15:27:26 +02:00
Christina Quast fafa54b37c sm_emul: ff 00 ff is the ans to ff 00 ff 2015-05-03 18:02:33 +02:00
Christina Quast 08ea861b11 mitm.py: to be removed, hack to answer pts request 2015-05-03 16:34:32 +02:00
Christina Quast 6118146598 sm_emul: send ATR with 0x18 and answer to pts 2015-05-03 16:34:06 +02:00
Christina Quast dace491c65 mitm.py: No ATR replacing 2015-05-03 15:48:09 +02:00
Christina Quast 0d98b9f53f python files: first PTS handling 2015-05-03 14:22:51 +02:00
Christina Quast cb646bc729 command to change fidi send by host 2015-05-03 14:21:26 +02:00
Christina Quast 6246000b3a iso7816_uart.c: Do not compile 2015-05-03 14:18:59 +02:00
Christina Quast 40670422c8 apdu_split.py: Recover from failure in parsing on 0xa0 2015-05-03 12:59:44 +02:00
Christina Quast be235275fa Added not working PTS parsing to host communication 2015-05-02 17:56:32 +02:00
Christina Quast 7a7f98c9f2 ringbuf.c: rbuf peek function 2015-05-02 17:53:13 +02:00
Christina Quast bf12a6f79e iso7816_uart: starting point for pts parsing 2015-05-02 13:22:07 +02:00
Christina Quast 4bec8d8e26 host_communication.c: printf becomes TRACE_DEBUG 2015-04-21 23:03:59 +02:00
Christina Quast ddb1e7be1a cciddriver.c: Removed loop waiting for host on CCID_Read 2015-04-21 23:02:43 +02:00
Christina Quast 46a93672d3 mitm.py: Dirty hack for replacing ATR live 2015-04-21 23:00:52 +02:00