Eric-Bourry / pssi

PSSI (Python Simple Smartcard Interpreter) is a Python script that provides an abstract layer for smartcard reading. Thanks to it, it is possible to read a smartcard by simply adding its structure in the form of a plugin, without taking care of the communication layer. The tool comes with several plugins, namely SIM, EMV, Navigo and Belgian eID.
GNU General Public License v3.0
22 stars 4 forks source link

PLMNMCC value can be non numeric #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In interpretPLMNMCC() the decoded value code is 'No information'
So the call to int(code[0:3]) will fail since 'No ' is not a numeric value.

What is the expected output?
No crash

What do you see instead?
$ ./pssi.py plugins/sim
PIN code required, please enter it:
--> 1234
Traceback (most recent call last):
  File "./pssi.py", line 108, in <module>
    main()
  File "./pssi.py", line 100, in main
    dumper.startDump()
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/dumper.py", line 35, in startDump
    content = structure_parser.parseCard(card)
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/structure_parser.py", line 338, in parseCard
    card["Content"] = parseCardStruct(connection, plugin.getRootStructure())
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/structure_parser.py", line 215, in parseCardStruct
    entry = parseCardStruct(connection, field[3], data+field[2])
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/structure_parser.py", line 239, in parseCardStruct
    entry = parseCardStruct(connection, field[3], hexdata)
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/structure_parser.py", line 310, in parseCardStruct
    interpretation = interpretFinalField(value, field[4], name)
  File "/Users/rousseau/Documents/sc/pssi/trunk/pssi/structure_parser.py", line 42, in interpretFinalField
    interpretation = interpreterTable[type](value)
  File "plugins/sim/interpreters.py", line 90, in interpretPLMNMCC
    code = int(code[0:3])
ValueError: invalid literal for int() with base 10: 'No '

What version of the product are you using? On what operating system?
SVN
Mac OS X

Please provide any additional information below.
It is not a real SIM card used in a phone.

patch attached

Original issue reported on code.google.com by ludovic....@gmail.com on 11 Nov 2010 at 9:57

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r35.

Original comment by eric.bou...@gmail.com on 11 Nov 2010 at 2:44