aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2020-03-11 13:11:03 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2020-03-17 11:08:32 +0100
commit5e9c6d20629178ebcf7ce2c01ab1bdf735349009 (patch)
treee0eb56e53b0b819bda6926398e8d420ce9a26279
parent625bc9d3f3c752f60a825fb4ad18833b51bd8089 (diff)
downloadsysmo-usim-tool-5e9c6d20629178ebcf7ce2c01ab1bdf735349009.tar.gz
sysmo-usim-tool-5e9c6d20629178ebcf7ce2c01ab1bdf735349009.tar.bz2
sysmo-usim-tool-5e9c6d20629178ebcf7ce2c01ab1bdf735349009.tar.xz
sysmo-usim-tool-5e9c6d20629178ebcf7ce2c01ab1bdf735349009.zip
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
-rw-r--r--common.py11
-rw-r--r--sysmo_usim.py17
2 files changed, 26 insertions, 2 deletions
diff --git a/common.py b/common.py
index dd9d92b..ce28367 100644
--- a/common.py
+++ b/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!"
diff --git a/sysmo_usim.py b/sysmo_usim.py
index 0d55a8e..137abac 100644
--- a/sysmo_usim.py
+++ b/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 ""