dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/28163 )
Change subject: pySim-shell: make APDU command available on the lowest level
......................................................................
pySim-shell: make APDU command available on the lowest level
The apdu command is used to communicate with the card on the lowest
possible level. Lets make it available even before a card profile (rs)
is avalable. This is especially useful when the card has no files on it,
in this situation pySim-shell will not be able to assign a profile to
the card at all. We can then use the apdu command to equip the card with
the most basic files and start over.
Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
---
M pySim-shell.py
1 file changed, 21 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/63/28163/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 8c70c0c..7b34d64 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -91,7 +91,7 @@
profile = CardProfile.pick(scc)
if profile is None:
print("Unsupported card type!")
- return None, None
+ return None, card
print("Info: Card is of type: %s" % str(profile))
@@ -224,7 +224,10 @@
not self.numeric_path)
self.prompt = 'pySIM-shell (%s)> ' % ('/'.join(path_list))
else:
- self.prompt = 'pySIM-shell (no card)> '
+ if (self.card):
+ self.prompt = 'pySIM-shell (no card profile)> '
+ else:
+ self.prompt = 'pySIM-shell (no card)> '
@cmd2.with_category(CUSTOM_CATEGORY)
def do_intro(self, _):
@@ -241,6 +244,21 @@
rs, card = init_card(sl)
self.equip(card, rs)
+ apdu_cmd_parser = argparse.ArgumentParser()
+ apdu_cmd_parser.add_argument('APDU', type=str, help='APDU as hex string')
+
+ @cmd2.with_argparser(apdu_cmd_parser)
+ def do_apdu(self, opts):
+ """Send a raw APDU to the card, and print SW + Response.
+ DANGEROUS: pySim-shell will not know any card state changes, and
+ not continue to work as expected if you e.g. select a different
+ file."""
+ data, sw = self.card._scc._tp.send_apdu(opts.APDU)
+ if (data):
+ self.poutput("SW: %s, RESP: %s" % (sw, data))
+ else:
+ self.poutput("SW: %s" % sw)
+
class InterceptStderr(list):
def __init__(self):
self._stderr_backup = sys.stderr
@@ -739,18 +757,6 @@
else:
raise ValueError("error: cannot authenticate, no adm-pin!")
- apdu_cmd_parser = argparse.ArgumentParser()
- apdu_cmd_parser.add_argument('APDU', type=str, help='APDU as hex string')
-
- @cmd2.with_argparser(apdu_cmd_parser)
- def do_apdu(self, opts):
- """Send a raw APDU to the card, and print SW + Response.
- DANGEROUS: pySim-shell will not know any card state changes, and
- not continue to work as expected if you e.g. select a different
- file."""
- data, sw = self._cmd.card._scc._tp.send_apdu(opts.APDU)
- self._cmd.poutput("SW: %s %s, RESP: %s" % (sw, self._cmd.rs.interpret_sw(sw), data))
-
@with_default_category('ISO7816 Commands')
class Iso7816Commands(CommandSet):
@@ -996,7 +1002,7 @@
" it should also be noted that some readers may behave strangely when no card")
print(" is inserted.)")
print("")
- app = PysimApp(None, None, sl, ch, opts.script)
+ app = PysimApp(card, None, sl, ch, opts.script)
# If the user supplies an ADM PIN at via commandline args authenticate
# immediately so that the user does not have to use the shell commands
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28163
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
Gerrit-Change-Number: 28163
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: dexter.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/28161
to look at the new patch set (#3).
Change subject: pySim-shell: add export option to add CREATE FILE APDUs
......................................................................
pySim-shell: add export option to add CREATE FILE APDUs
Export currently only exports the contents of the files. When running
the resulting script it is expected that the files already exist. This
is normaly the case. However, when replaying the script on a blank card
the files do not exist yet.
The CREATE FILE parameters are created based on the FCP template that
the card returns when the file is selected. In some cases the returned
FCP template may lacl data that the card needs to create the file
properly. This means that the --create parameter must be used with
caution and possibly manual re-work of the result is necessary.
Change-Id: If529b86062f7c678c9c75f46ce9ca116cea8b47b
---
M pySim-shell.py
1 file changed, 45 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/28161/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28161
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: If529b86062f7c678c9c75f46ce9ca116cea8b47b
Gerrit-Change-Number: 28161
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: pespin.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28156
to look at the new patch set (#5).
Change subject: ggsn: Improve checks around Gy messages
......................................................................
ggsn: Improve checks around Gy messages
Change-Id: I702796f2f941b78da904faa2ffdba4185333bc0d
---
M ggsn_tests/GGSN_Tests.ttcn
M library/DIAMETER_Templates.ttcn
2 files changed, 478 insertions(+), 23 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/56/28156/5
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28156
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I702796f2f941b78da904faa2ffdba4185333bc0d
Gerrit-Change-Number: 28156
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
Attention is currently required from: fixeria.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28153 )
Change subject: ggsn: Properly encode MISDN IE in GTP
......................................................................
Patch Set 2:
(1 comment)
File ggsn_tests/GGSN_Tests.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28153/comment/534e2a99_85ae…
PS2, Line 2211: 1234567890
> Why changing this value?
I just copy-pasted the value everywhere. the exact value doesn't really matter here, we just need to pass something.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28153
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie1b65707d4b08f2201572e1fa44a1f9f985eb096
Gerrit-Change-Number: 28153
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 19 May 2022 12:09:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment