[S] Change in pysim[master]: saip-tool: Add 'extract-loadblock' to dump all applications from eSIM...
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37169?usp=email ) Change subject: saip-tool: Add 'extract-loadblock' to dump all applications from eSIM profile ...................................................................... saip-tool: Add 'extract-loadblock' to dump all applications from eSIM profile This new action can be used to dump all java applications as raw 'load block' (sometimes referred-to as ICJ file) from a profile. Change-Id: I51cffa5ba3ddbea491341d678ec9249d7cf470a5 --- M contrib/saip-tool.py 1 file changed, 29 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/69/37169/1 diff --git a/contrib/saip-tool.py b/contrib/saip-tool.py index 68072fa..a9c56de 100755 --- a/contrib/saip-tool.py +++ b/contrib/saip-tool.py @@ -56,6 +56,9 @@ parser_info = subparsers.add_parser('info', help='Display information about the profile') +parser_eapp = subparsers.add_parser('extract-apps', help='Extract applications as loadblock file') +parser_eapp.add_argument('--output-dir', default='.', help='Output directory (where to store files)') + def do_split(pes: ProfileElementSequence, opts): i = 0 for pe in pes.pe_list: @@ -176,6 +179,18 @@ print("\tInstance AID: %s" % b2h(inst['instanceAID'])) pass +def do_extract_apps(pes:ProfileElementSequence, opts): + pe_hdr_dec = pes.pe_by_type['header'][0].decoded + iccid = b2h(pe_hdr_dec['iccid']) + apps = pes.pe_by_type.get('application', []) + for app_pe in apps: + package_aid = b2h(app_pe.decoded['loadBlock']['loadPackageAID']) + + fname = os.path.join(opts.output_dir, '%s-%s.loadblock' % (iccid, package_aid)) + print("Writing Load Package AID: %s to file %s" % (package_aid, fname)) + with open(fname, 'wb') as f: + f.write(app_pe.decoded['loadBlock']['loadBlockObject']) + if __name__ == '__main__': opts = parser.parse_args() @@ -197,3 +212,5 @@ do_remove_naa(pes, opts) elif opts.command == 'info': do_info(pes, opts) + elif opts.command == 'extract-apps': + do_extract_apps(pes, opts) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/37169?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: I51cffa5ba3ddbea491341d678ec9249d7cf470a5 Gerrit-Change-Number: 37169 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-MessageType: newchange
participants (1)
-
laforge