Browse Source

sysmo_usim: add functionality to show AID of installed apps

Modern SIM cards may come with multiple applications installed (e.g. an
additional ISIM application along with a regular USIM application). In
some debug cases it may be helpful to be able to list those
applications. Lets add some functionality for that.

Related: SYS#4817
master
Philipp Maier 2 years ago
parent
commit
5e9c6d2062
  1. 11
      common.py
  2. 17
      sysmo_usim.py

11
common.py

@ -26,12 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from utils import *
import sys, getopt
COMMON_GETOPTS = "hfa:J:nN:lL:kK:tT:oO:C:sSi"
COMMON_GETOPTS = "hfa:J:nN:lL:kK:tT:oO:C:sSip"
COMMON_GETOPTS_LONG = ["help", "force", "adm1=", "set-imsi", "mnclen",
"set-mnclen", "milenage", "set-milenage", "ki",
"set-ki=", "auth", "set-auth=", "opc", "set-op=",
"set-opc=", "seq-parameters", "reset-seq-parameters"
"iccid"]
"iccid", "aid"]
# Parse common commandline options and keep them as flags
class Common():
@ -56,6 +56,7 @@ class Common():
show_seq_par = False
reset_seq_par = False
show_iccid = False
show_aid = False
def __init__(self, argv, getopts, getopts_long):
@ -108,6 +109,8 @@ class Common():
self.reset_seq_par = True
elif opt in ("-i", "--iccid"):
self.show_iccid = True
elif opt in ("-p", "--aid"):
self.show_aid = True
# Check for ADM1 key
if not self.adm1:
@ -146,6 +149,7 @@ class Common():
print(" -s --seq-parameters ........... Show MILENAGE SEQ/SQN parameters")
print(" -S --reset-seq-parameters ..... Reset MILENAGE SEQ/SQN parameters to default")
print(" -i --iccid .................... Show ICCID")
print(" -p --aid ...................... Show AID list (installed applications)")
self._helptext()
@ -206,4 +210,7 @@ class Common():
if self.show_iccid:
self.sim.show_iccid()
if self.show_aid:
self.sim.show_aid()
print "Done!"

17
sysmo_usim.py

@ -192,3 +192,20 @@ class Sysmo_usim:
print(" * Programming...")
self.sim.update_binary(new_ad)
print("")
# Show installed applications (AIDs)
def show_aid(self):
print("Reading application directory...");
self._init()
self.sim.card.get_AID()
AID = self.sim.card.AID
for a in AID:
if a[0:7] == [0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x02]:
appstr = "USIM"
elif a[0:7] == [0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x04]:
appstr = "ISIM"
else:
appstr = "(unknown)"
print " AID: " + hexdump(a[0:5]) + " " + hexdump(a[5:7]) + " " + hexdump(a[7:]) + " ==> " + appstr
print ""
Loading…
Cancel
Save