This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/24404 )
Change subject: shell: Add 'status' command to issue STATUS APDU
......................................................................
shell: Add 'status' command to issue STATUS APDU
This can be used to get the FCP of the currently selected file.
Change-Id: I65c97adadd831ca2daa5a0dbb52a37999f8514fd
---
M pySim-shell.py
M pySim/commands.py
M pySim/filesystem.py
3 files changed, 14 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim-shell.py b/pySim-shell.py
index 0069661..edd8112 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -443,6 +443,11 @@
"""Close a logical channel."""
(data, sw) = self._cmd.card._scc.manage_channel(mode='close', lchan_nr=opts.chan_nr)
+ def do_status(self, opts):
+ """Perform the STATUS command."""
+ fcp_dec = self._cmd.rs.status()
+ self._cmd.poutput_json(fcp_dec)
+
option_parser = argparse.ArgumentParser(prog='pySim-shell', description='interactive SIM card shell',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
diff --git a/pySim/commands.py b/pySim/commands.py
index 689cbea..4640fe1 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -359,6 +359,10 @@
ret = {'successful_3g_authentication': data}
return (ret, sw)
+ def status(self):
+ """Execute a STATUS command as per TS 102 221 Section 11.1.2."""
+ return self._tp.send_apdu_checksw('80F20000ff')
+
def deactivate_file(self):
"""Execute DECATIVATE FILE command as per TS 102 221 Section 11.1.14."""
return self._tp.send_apdu_constr_checksw(self.cla_byte, '04', '00', '00', None, None, None)
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 8cdb23e..aaf333b 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -1145,6 +1145,11 @@
return select_resp
+ def status(self):
+ """Request STATUS (current selected file FCP) from card."""
+ (data, sw) = self.card._scc.status()
+ return self.selected_file.decode_select_response(data)
+
def read_binary(self, length:int=None, offset:int=0):
"""Read [part of] a transparent EF binary data.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/24404
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I65c97adadd831ca2daa5a0dbb52a37999f8514fd
Gerrit-Change-Number: 24404
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210525/6273046a/attachment.htm>