laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/27335 )
Change subject: pySim-shell: Add 'decode_hex' command for transparent + linear EF
......................................................................
pySim-shell: Add 'decode_hex' command for transparent + linear EF
These commands can be used to decode a user-provided hex-string,
instead of decoding the data read from the file. This is useful
for quickly manually decoding some values read from other locations,
such as e.g. copy+pasted from a eSIM profile in ASN.1 value notation.
Change-Id: I81f73bce2c26e3e5dfc7538d223bb2d2483c7fa0
---
M docs/shell.rst
M pySim/filesystem.py
2 files changed, 36 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/docs/shell.rst b/docs/shell.rst
index f24dc93..2c8da84 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -384,6 +384,13 @@
This allows for easy interactive modification of records.
+decode_hex
+~~~~~~~~~~
+.. argparse::
+ :module: pySim.filesystem
+ :func: LinFixedEF.ShellCommands.dec_hex_parser
+
+
Transparent EF commands
-----------------------
@@ -460,6 +467,13 @@
This allows for easy interactive modification of file contents.
+decode_hex
+~~~~~~~~~~
+.. argparse::
+ :module: pySim.filesystem
+ :func: TransparentEF.ShellCommands.dec_hex_parser
+
+
BER-TLV EF commands
-------------------
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index f8b86c5..5bbd57b 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -526,6 +526,17 @@
def __init__(self):
super().__init__()
+ dec_hex_parser = argparse.ArgumentParser()
+ dec_hex_parser.add_argument('--oneline', action='store_true',
+ help='No JSON pretty-printing, dump as a single line')
+ dec_hex_parser.add_argument('HEXSTR', help='Hex-string of encoded data to decode')
+
+ @cmd2.with_argparser(dec_hex_parser)
+ def do_decode_hex(self, opts):
+ """Decode command-line provided hex-string as if it was read from the file."""
+ data = self._cmd.rs.selected_file.decode_hex(opts.HEXSTR)
+ self._cmd.poutput_json(data, opts.oneline)
+
read_bin_parser = argparse.ArgumentParser()
read_bin_parser.add_argument(
'--offset', type=int, default=0, help='Byte offset for start of read')
@@ -738,6 +749,17 @@
def __init__(self, **kwargs):
super().__init__(**kwargs)
+ dec_hex_parser = argparse.ArgumentParser()
+ dec_hex_parser.add_argument('--oneline', action='store_true',
+ help='No JSON pretty-printing, dump as a single line')
+ dec_hex_parser.add_argument('HEXSTR', help='Hex-string of encoded data to decode')
+
+ @cmd2.with_argparser(dec_hex_parser)
+ def do_decode_hex(self, opts):
+ """Decode command-line provided hex-string as if it was read from the file."""
+ data = self._cmd.rs.selected_file.decode_record_hex(opts.HEXSTR)
+ self._cmd.poutput_json(data, opts.oneline)
+
read_rec_parser = argparse.ArgumentParser()
read_rec_parser.add_argument(
'record_nr', type=int, help='Number of record to be read')
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27335
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I81f73bce2c26e3e5dfc7538d223bb2d2483c7fa0
Gerrit-Change-Number: 27335
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: merged
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/27335 )
Change subject: pySim-shell: Add 'decode_hex' command for transparent + linear EF
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/27335
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I81f73bce2c26e3e5dfc7538d223bb2d2483c7fa0
Gerrit-Change-Number: 27335
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 01 Mar 2022 16:48:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: iedemam.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/27081 )
Change subject: New stats for lchan life duration.
......................................................................
Patch Set 12: Code-Review+1
(1 comment)
Patchset:
PS12:
I'd be happy to see this patch moving ahead, but with the unit tests failing, that's of course not an option...
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/27081
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I1b0670c47cb5e0b7776eda89d1e71545ba0e3347
Gerrit-Change-Number: 27081
Gerrit-PatchSet: 12
Gerrit-Owner: iedemam <michael(a)kapsulate.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: iedemam <michael(a)kapsulate.com>
Gerrit-Comment-Date: Tue, 01 Mar 2022 16:36:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment