diff --git a/card/utils.py b/card/utils.py index 028e918..f018cef 100644 --- a/card/utils.py +++ b/card/utils.py @@ -351,7 +351,7 @@ def write_dict(dict, fd): rec = dict[k] if isinstance(rec, list) and \ len(rec) == [isinstance(i, int) for i in rec].count(True): - rec = ''.join(['[', ', '.join(map(hex, rec)), ']']) + rec = ''.join(['[', ', '.join(list(map(hex, rec))), ']']) fd.write('%s: %s\n' % (k, rec)) def make_graph(FS, master_name='(0x3F, 0x00)\nMF'): diff --git a/common.py b/common.py index e2d15f8..330d9ed 100644 --- a/common.py +++ b/common.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/simcard.py b/simcard.py index 4d8b7fe..50cdef7 100644 --- a/simcard.py +++ b/simcard.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/sysmo-isim-tool.sja2.py b/sysmo-isim-tool.sja2.py index 280fed2..ff62000 100755 --- a/sysmo-isim-tool.sja2.py +++ b/sysmo-isim-tool.sja2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/sysmo-usim-tool.sjs1.py b/sysmo-usim-tool.sjs1.py index 10c1e91..ebe0137 100755 --- a/sysmo-usim-tool.sjs1.py +++ b/sysmo-usim-tool.sjs1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/sysmo_isim_sja2.py b/sysmo_isim_sja2.py index 49ed2ad..037f34c 100644 --- a/sysmo_isim_sja2.py +++ b/sysmo_isim_sja2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/sysmo_usim.py b/sysmo_usim.py index 287b7cf..414038d 100644 --- a/sysmo_usim.py +++ b/sysmo_usim.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/sysmo_usim_sjs1.py b/sysmo_usim_sjs1.py index efa30a6..01777e0 100644 --- a/sysmo_usim_sjs1.py +++ b/sysmo_usim_sjs1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ diff --git a/utils.py b/utils.py index 311b8d2..1185a0f 100644 --- a/utils.py +++ b/utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @@ -52,9 +52,9 @@ def ascii_to_list(string): # Convert an ascii hex string to numeric list def asciihex_to_list(string): - string = string.translate(None, ':') + string = string.translate(str.maketrans('','',':')) try: - return map(ord, string.decode("hex")) + return list(map(ord,''.join(['%c' % b for b in bytearray.fromhex(string)]))) except: print("Warning: Invalid hex string -- ignored!") return []