cards: rename class "Card" to "SimCard"

There are the classes IsimCard and UsimCard, which inheret from Card,
which is the base class for a normal non ISIM/USIM simcard. Card also
has methods in it that are related to simcards, so it is not just any
"Card", it is a SimCard and should be called that way.

Change-Id: I2077ded44bc2297b8d478c5bd1895951b494efcc
This commit is contained in:
Philipp Maier
2021-05-05 16:14:00 +02:00
committed by laforge
parent f201166999
commit bb73e516cb
3 changed files with 11 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map
from pySim.commands import SimCardCommands from pySim.commands import SimCardCommands
from pySim.transport import init_reader, argparse_add_reader_args from pySim.transport import init_reader, argparse_add_reader_args
from pySim.cards import card_detect, Card, UsimCard, IsimCard from pySim.cards import card_detect, SimCard, UsimCard, IsimCard
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn
from pySim.utils import format_xplmn_w_act, dec_st from pySim.utils import format_xplmn_w_act, dec_st
from pySim.utils import h2s, format_ePDGSelection from pySim.utils import h2s, format_ePDGSelection
@@ -75,7 +75,7 @@ if __name__ == '__main__':
print("Reading ...") print("Reading ...")
# Initialize Card object by auto detecting the card # Initialize Card object by auto detecting the card
card = card_detect("auto", scc) or Card(scc) card = card_detect("auto", scc) or SimCard(scc)
# Read all AIDs on the UICC # Read all AIDs on the UICC
card.read_aids() card.read_aids()

View File

@@ -37,7 +37,7 @@ from pySim.ts_31_103 import EF_IST_map, EF_ISIM_ADF_map
from pySim.exceptions import * from pySim.exceptions import *
from pySim.commands import SimCardCommands from pySim.commands import SimCardCommands
from pySim.transport import init_reader, ApduTracer, argparse_add_reader_args from pySim.transport import init_reader, ApduTracer, argparse_add_reader_args
from pySim.cards import card_detect, Card from pySim.cards import card_detect, SimCard
from pySim.utils import h2b, swap_nibbles, rpad, b2h, h2s, JsonEncoder, bertlv_parse_one from pySim.utils import h2b, swap_nibbles, rpad, b2h, h2s, JsonEncoder, bertlv_parse_one
from pySim.utils import dec_st, sanitize_pin_adm, tabulate_str_list, is_hex, boxed_heading_str from pySim.utils import dec_st, sanitize_pin_adm, tabulate_str_list, is_hex, boxed_heading_str
from pySim.card_handler import card_handler from pySim.card_handler import card_handler

View File

@@ -50,7 +50,7 @@ def format_addr(addr:str, addr_type:str) -> str:
res += "\t%s # %s\n" % (addr_hex, addr) res += "\t%s # %s\n" % (addr_hex, addr)
return res return res
class Card(object): class SimCard(object):
name = 'SIM' name = 'SIM'
@@ -310,7 +310,7 @@ class Card(object):
len = self._scc.record_size(ef) len = self._scc.record_size(ef)
self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True) self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True)
class UsimCard(Card): class UsimCard(SimCard):
name = 'USIM' name = 'USIM'
@@ -388,7 +388,7 @@ class UsimCard(Card):
(res, sw) = self._scc.update_binary(EF_USIM_ADF_map['UST'], content) (res, sw) = self._scc.update_binary(EF_USIM_ADF_map['UST'], content)
return sw return sw
class IsimCard(Card): class IsimCard(SimCard):
name = 'ISIM' name = 'ISIM'
@@ -516,7 +516,7 @@ class IsimCard(Card):
uiari_recs += "UICC IARI: Can't read, response code = %s\n" % (sw) uiari_recs += "UICC IARI: Can't read, response code = %s\n" % (sw)
return uiari_recs return uiari_recs
class MagicSimBase(abc.ABC, Card): class MagicSimBase(abc.ABC, SimCard):
""" """
Theses cards uses several record based EFs to store the provider infos, Theses cards uses several record based EFs to store the provider infos,
each possible provider uses a specific record number in each EF. The each possible provider uses a specific record number in each EF. The
@@ -664,7 +664,7 @@ class MagicSim(MagicSimBase):
_ki_file = '6f1b' _ki_file = '6f1b'
class FakeMagicSim(Card): class FakeMagicSim(SimCard):
""" """
Theses cards have a record based EF 3f00/000c that contains the provider Theses cards have a record based EF 3f00/000c that contains the provider
information. See the program method for its format. The records go from information. See the program method for its format. The records go from
@@ -731,7 +731,7 @@ class FakeMagicSim(Card):
self._scc.update_record('000c', 1+i, entry) self._scc.update_record('000c', 1+i, entry)
class GrcardSim(Card): class GrcardSim(SimCard):
""" """
Greencard (grcard.cn) HZCOS GSM SIM Greencard (grcard.cn) HZCOS GSM SIM
These cards have a much more regular ISO 7816-4 / TS 11.11 structure, These cards have a much more regular ISO 7816-4 / TS 11.11 structure,
@@ -834,7 +834,7 @@ class SysmoUSIMgr1(UsimCard):
data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par) data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par)
class SysmoSIMgr2(Card): class SysmoSIMgr2(SimCard):
""" """
sysmocom sysmoSIM-GR2 sysmocom sysmoSIM-GR2
""" """
@@ -1157,7 +1157,7 @@ class FairwavesSIM(UsimCard):
if sw != '9000': if sw != '9000':
print("Programming ACC failed with code %s"%sw) print("Programming ACC failed with code %s"%sw)
class OpenCellsSim(Card): class OpenCellsSim(SimCard):
""" """
OpenCellsSim OpenCellsSim