laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/34944?usp=email )
Change subject: pySim-shell: Use arparser for verify_adm to support --help
......................................................................
pySim-shell: Use arparser for verify_adm to support --help
Let's add a proper argparser instance for the 'verify_adm' command,
avoiding situations where the user types 'verif_adm --help' and then
--help is interpreted as the PIN value, removing one more attempt from
the failed ADM1 counter.
Let's use that opportunity to improve the documentation of the command.
Change-Id: I3321fae66a11efd00c53b66c7890fce84796e658
---
M docs/shell.rst
M pySim-shell.py
2 files changed, 32 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/44/34944/1
diff --git a/docs/shell.rst b/docs/shell.rst
index 7e04792..6da16ec 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -137,10 +137,11 @@
verify_adm
~~~~~~~~~~
-Verify the ADM (Administrator) PIN specified as argument. This is typically needed in order
-to get write/update permissions to most of the files on SIM cards.
-Currently only ADM1 is supported.
+.. argparse::
+ :module: pySim-shell
+ :func: PySimCommands.verify_adm_parser
+
Example (successful):
::
diff --git a/pySim-shell.py b/pySim-shell.py
index c02555f..7aaa234 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -776,11 +776,19 @@
else:
self._cmd.poutput("no description available")
- def do_verify_adm(self, arg):
- """VERIFY the ADM1 PIN"""
- if arg:
+ verify_adm_parser = argparse.ArgumentParser()
+ verify_adm_parser.add_argument('ADM1', nargs='?', type=str,
+ help='ADM1 pin value. If none given, CSV file will be queried')
+
+ @cmd2.with_argparser(verify_adm_parser)
+ def do_verify_adm(self, opts):
+ """Verify the ADM (Administrator) PIN specified as argument. This is typically needed in order
+to get write/update permissions to most of the files on SIM cards.
+
+Currently only ADM1 is supported."""
+ if opts.ADM1:
# use specified ADM-PIN
- pin_adm = sanitize_pin_adm(arg)
+ pin_adm = sanitize_pin_adm(opts.ADM1)
else:
# try to find an ADM-PIN if none is specified
result = card_key_provider_get_field(
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34944?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3321fae66a11efd00c53b66c7890fce84796e658
Gerrit-Change-Number: 34944
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/34942?usp=email )
Change subject: docs: shell: Various documentation updates/extensions
......................................................................
docs: shell: Various documentation updates/extensions
* examples for export, verify_adm, reset, apdu
* explain CSV option for verify_adm
* fix 'tree' example (--help shouldn't be there)
Change-Id: I6ed8d8c5cf268ad3534e988eff9501f388b8d80f
---
M docs/shell.rst
1 file changed, 90 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/42/34942/1
diff --git a/docs/shell.rst b/docs/shell.rst
index 2f99cf5..97a1829 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -101,6 +101,19 @@
all/most files.
+Example:
+::
+
+ pySIM-shell (00:MF)> export --json > /tmp/export.json
+ EXCEPTION of type 'RuntimeError' occurred with message: 'unable to export 50 elementary file(s) and 2 dedicated file(s), also had to stop early due to exception:6e00: ARA-M - Invalid class'
+ To enable full traceback, run the following command: 'set debug true'
+ pySIM-shell (00:MF)>
+
+The exception above is more or less expected. It just means that 50 files which are defined (most likely as
+optional files in some later 3GPP release) were not found on the card, or were invalidated/disabled when
+trying to SELECT them.
+
+
tree
~~~~
Display a tree of the card filesystem. It is important to note that this displays a tree
@@ -110,7 +123,7 @@
Example:
::
- pySIM-shell (00:MF)> tree --help
+ pySIM-shell (00:MF)> tree
EF.DIR 2f00 Application Directory
EF.ICCID 2fe2 ICC Identification
EF.PL 2f05 Preferred Languages
@@ -129,11 +142,62 @@
Currently only ADM1 is supported.
+Example (successful):
+::
+
+ pySIM-shell (00:MF)> verify_adm 11111111
+ pySIM-shell (00:MF)>
+
+In the above case, the ADM was successfully verified. Please make always sure to use the correct ADM1 for the
+specific card you have inserted! If you present a wrong ADM1 value several times consecutively, your card
+ADM1 will likely be permanently locked, meaning you will never be able to reach ADM1 privilege level.
+For sysmoUSIM/ISIM products, three consecutive wrong ADM1 values will lock the ADM1.
+
+Example (erroneous):
+::
+
+ pySIM-shell (00:MF)> verify_adm 1
+ EXCEPTION of type 'RuntimeError' occurred with message: 'Failed to verify chv_no 0x0A with code 0x31FFFFFFFFFFFFFF, 2 tries left.'
+ To enable full traceback, run the following command: 'set debug true'
+
+If you frequently work with the same set of cards that you need to modify using their ADM1, you can put a CSV
+file with those cards ICCID + ADM1 values into a CSV (comma separated value) file at ``~/.osmocom/pysim/card_data.csv``. In this case,
+you can use the ``verify_adm`` command *without specifying an ADM1 value*.
+
+Example (successful):
+
+::
+
+ pySIM-shell (00:MF)> verify_adm
+ found ADM-PIN '11111111' for ICCID '898821190000000512'
+ pySIM-shell (00:MF)>
+
+In this case, the CSV file contained a record for the ICCID of the card (11111111) and that value was used to
+successfully verify ADM1.
+
+
+Example (erroneous):
+::
+
+ pySIM-shell (00:MF)> verify_adm
+ EXCEPTION of type 'ValueError' occurred with message: 'cannot find ADM-PIN for ICCID '898821190000000512''
+ To enable full traceback, run the following command: 'set debug true'
+
+In this case there was no record for the ICCID of the card in the CSV file.
+
reset
~~~~~
Perform card reset and display the card ATR.
+Example:
+::
+
+ pySIM-shell (00:MF)> reset
+ Card ATR: 3b9f96801f878031e073fe211b674a357530350259c4
+ pySIM-shell (00:MF)> reset
+
+
intro
~~~~~
[Re-]Display the introductory banner
@@ -165,6 +229,18 @@
:module: pySim-shell
:func: PysimApp.apdu_cmd_parser
+Example:
+
+::
+
+ pySIM-shell (00:MF)> apdu 00a40400023f00
+ SW: 6700
+
+In the above case the raw APDU hex-string ``00a40400023f00`` was sent to the card, to which it responded with
+status word ``6700``. Keep in mind that pySim-shell has no idea what kind of raw commands you are sending to the
+card, and it hence is unable to synchronize its internal state (such as the currently selected file) with the
+card. The use of this command should hence be constrained to commands that do not have any high-level support
+in pySim-shell yet.
ISO7816 commands
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34942?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I6ed8d8c5cf268ad3534e988eff9501f388b8d80f
Gerrit-Change-Number: 34942
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange
Attention is currently required from: laforge, pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email )
Change subject: add fmtp string to ptmap: allow all possible fmtp
......................................................................
Patch Set 5:
(2 comments)
File include/osmocom/mgcp_client/mgcp_client.h:
https://gerrit.osmocom.org/c/osmo-mgw/+/34900/comment/60561c13_319e5059
PS4, Line 165: * Not all pointers contained in the mgcp_response */
> erm ... no i didn't write this. i started out with dexter's patch, maybe that's where it came from.. […]
Done
File tests/mgcp/mgcp_test.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/34900/comment/3a136ae5_3a508922
PS4, Line 848: fflush(stderr);
> another such something i didn't see, thx
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: If58590bda8627519ff07e0b6f43aa47a274f052b
Gerrit-Change-Number: 34900
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 01 Nov 2023 21:16:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: dexter.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/34404?usp=email )
Change subject: mgcp_client_fsm: allocate struct mgcp_conn_peer dynamically
......................................................................
Patch Set 9:
(4 comments)
This change is ready for review.
File src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/34404/comment/8fbc184f_38afefd0
PS5, Line 692: osmo_strlcpy(cleared_ci.mgcp_ci_str, ci->mgcp_ci_str, sizeof(cleared_ci.mgcp_ci_str));
> mark
Done
https://gerrit.osmocom.org/c/osmo-mgw/+/34404/comment/8074c879_64a30269
PS5, Line 826: .ep = ep,
> mark
Done
https://gerrit.osmocom.org/c/osmo-mgw/+/34404/comment/33b4e5d2_e5b39f31
PS5, Line 1052: *ci = (struct osmo_mgcpc_ep_ci){
> mark
Done
File src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/34404/comment/02fbdf1b_c160c06c
PS7, Line 98: struct mgcp_conn_peer *verb_info;
> since this struct is used only within this .c file scope, there is no need to modify this code. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34404?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I523d0fcb020f7d46323c497a4be9ee00d5f242ba
Gerrit-Change-Number: 34404
Gerrit-PatchSet: 9
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 01 Nov 2023 21:16:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: comment
Attention is currently required from: dexter.
neels has uploaded a new patch set (#8) to the change originally created by dexter. ( https://gerrit.osmocom.org/c/osmo-mgw/+/34350?usp=email )
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
The change is no longer submittable: Verified is unsatisfied now.
Change subject: mgcp_client_fsm: explain member param in struct mgcp_conn_peer better
......................................................................
mgcp_client_fsm: explain member param in struct mgcp_conn_peer better
The struct member param specifies additional codec parameters. Let's
improve its explaination.
Change-Id: Iea4dc1e72fccaa464ce503fae88b5d8a867b1d19
Related: OS#6171
---
M include/osmocom/mgcp_client/mgcp_client_fsm.h
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/50/34350/8
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34350?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Iea4dc1e72fccaa464ce503fae88b5d8a867b1d19
Gerrit-Change-Number: 34350
Gerrit-PatchSet: 8
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: laforge, pespin.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Verified+1 by Jenkins Builder
Change subject: add fmtp string to ptmap: allow all possible fmtp
......................................................................
add fmtp string to ptmap: allow all possible fmtp
Remove the limit of having only one AMR octet-aligned fmtp parameter per
MGCP message. Instead allow any arbitrary fmtp options, one per every
codec.
Deprecate all use of struct mgcp_codec_param. Instead, store and pass
plain fmtp strings.
We need to know fmtp details only for AMR, and only to probe whether it
is octet-aligned. So add a separate fmtp string parser that returns that
information flexibly, as in
if (osmo_mgcp_fmtp_get_int("octet-aligned", 0) == 1) ...
Provide legacy shims that still act correctly for any callers that may
pass the old struct mgcp_codec_param. (I'm not sure if we need to keep
this, but we can always drop it in another patch.)
Adjust one mgcp_test.c: instead of returning only the octet-aligned
parameter, now osmo-mgw keeps and returns all the fmtp parameters that
the user provided. So add the missing "mode-change-capability".
Related: OS#6171
Change-Id: If58590bda8627519ff07e0b6f43aa47a274f052b
---
M include/osmocom/mgcp/Makefile.am
A include/osmocom/mgcp/fmtp.h
M include/osmocom/mgcp/mgcp_codec.h
M include/osmocom/mgcp/mgcp_common.h
M include/osmocom/mgcp/mgcp_network.h
M include/osmocom/mgcp_client/mgcp_client.h
M include/osmocom/mgcp_client/mgcp_client_fsm.h
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/Makefile.am
A src/libosmo-mgcp/fmtp.c
M src/libosmo-mgcp/mgcp_codec.c
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_sdp.c
M tests/mgcp/mgcp_test.c
15 files changed, 270 insertions(+), 105 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/00/34900/5
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: If58590bda8627519ff07e0b6f43aa47a274f052b
Gerrit-Change-Number: 34900
Gerrit-PatchSet: 5
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: laforge, neels, pespin.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/34905?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review+1 by pespin, Code-Review+2 by neels, Verified+1 by Jenkins Builder
The change is no longer submittable: Code-Review and Verified are unsatisfied now.
Change subject: mgcp-client: MGCP response: pass fmtp to caller
......................................................................
mgcp-client: MGCP response: pass fmtp to caller
When receiving MGCP responses, so far libosmo-mgcp-client completely
ignored a=fmtp: parameters (like 'octet-align'). Add fmtp parsing to
pass the fmtp string to the caller as-is.
Since the responses so far never included the octet_aligned flags, do
not bother to parse fmtp to populate the legacy items. New callers
should use the fmtp string.
Change-Id: If8ca5c3880cad9e41b80e9d1c821439b0d7b7e23
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 57 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/05/34905/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34905?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: If8ca5c3880cad9e41b80e9d1c821439b0d7b7e23
Gerrit-Change-Number: 34905
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email )
Change subject: add fmtp string to ptmap: allow all possible fmtp
......................................................................
Patch Set 4:
(2 comments)
File include/osmocom/mgcp_client/mgcp_client.h:
https://gerrit.osmocom.org/c/osmo-mgw/+/34900/comment/d9843f6b_d3a929cb
PS4, Line 165: * Not all pointers contained in the mgcp_response */
> what do you mean with this?
erm ... no i didn't write this. i started out with dexter's patch, maybe that's where it came from...?
what is it trying to say, i guess mgcp_response allocation is not entirely self-contained.
Looking, though, it actually does self-contain all its members, except for the 'sdp' pointer that includes the originally parsed SDP string. So seems to have become unrelated to this patch.
File tests/mgcp/mgcp_test.c:
https://gerrit.osmocom.org/c/osmo-mgw/+/34900/comment/3f2647a6_b3917892
PS4, Line 848: fflush(stderr);
> is this really needed? […]
another such something i didn't see, thx
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/34900?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: If58590bda8627519ff07e0b6f43aa47a274f052b
Gerrit-Change-Number: 34900
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 01 Nov 2023 21:04:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment