mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-05-10 16:58:14 +03:00
cosmetic: remove excess linebreaks
We should not use double-line breaks to separate things as it is very difficult to maintain consistence with that scheme.
This commit is contained in:
@@ -1121,15 +1121,12 @@ class Iso7816Commands(CommandSet):
|
|||||||
fcp_dec = self._cmd.lchan.status()
|
fcp_dec = self._cmd.lchan.status()
|
||||||
self._cmd.poutput_json(fcp_dec)
|
self._cmd.poutput_json(fcp_dec)
|
||||||
|
|
||||||
|
|
||||||
class Proact(ProactiveHandler):
|
class Proact(ProactiveHandler):
|
||||||
def receive_fetch(self, pcmd: ProactiveCommand):
|
def receive_fetch(self, pcmd: ProactiveCommand):
|
||||||
# print its parsed representation
|
# print its parsed representation
|
||||||
print(pcmd.decoded)
|
print(pcmd.decoded)
|
||||||
# TODO: implement the basics, such as SMS Sending, ...
|
# TODO: implement the basics, such as SMS Sending, ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
option_parser = argparse.ArgumentParser(description='interactive SIM card shell',
|
option_parser = argparse.ArgumentParser(description='interactive SIM card shell',
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
argparse_add_reader_args(option_parser)
|
argparse_add_reader_args(option_parser)
|
||||||
|
|||||||
@@ -264,7 +264,6 @@ def card_key_provider_register(provider: CardKeyProvider, provider_list=card_key
|
|||||||
raise ValueError("provider is not a card data provider")
|
raise ValueError("provider is not a card data provider")
|
||||||
provider_list.append(provider)
|
provider_list.append(provider)
|
||||||
|
|
||||||
|
|
||||||
def card_key_provider_get(fields: list[str], key: str, value: str, provider_list=card_key_providers) -> Dict[str, str]:
|
def card_key_provider_get(fields: list[str], key: str, value: str, provider_list=card_key_providers) -> Dict[str, str]:
|
||||||
"""Query all registered card data providers for card-individual [key] data.
|
"""Query all registered card data providers for card-individual [key] data.
|
||||||
|
|
||||||
@@ -289,7 +288,6 @@ def card_key_provider_get(fields: list[str], key: str, value: str, provider_list
|
|||||||
|
|
||||||
raise ValueError("Unable to find card key data (key=%s, value=%s, fields=%s)" % (key, value, str(fields)))
|
raise ValueError("Unable to find card key data (key=%s, value=%s, fields=%s)" % (key, value, str(fields)))
|
||||||
|
|
||||||
|
|
||||||
def card_key_provider_get_field(field: str, key: str, value: str, provider_list=card_key_providers) -> str:
|
def card_key_provider_get_field(field: str, key: str, value: str, provider_list=card_key_providers) -> str:
|
||||||
"""Query all registered card data providers for a single field.
|
"""Query all registered card data providers for a single field.
|
||||||
|
|
||||||
|
|||||||
@@ -460,7 +460,6 @@ def decode_select_response(resp_hex: str) -> object:
|
|||||||
# 11.4.2.1
|
# 11.4.2.1
|
||||||
StatusSubset = Enum(Byte, isd=0x80, applications=0x40, files=0x20, files_and_modules=0x10)
|
StatusSubset = Enum(Byte, isd=0x80, applications=0x40, files=0x20, files_and_modules=0x10)
|
||||||
|
|
||||||
|
|
||||||
# Section 11.4.3.1 Table 11-36
|
# Section 11.4.3.1 Table 11-36
|
||||||
class LifeCycleState(BER_TLV_IE, tag=0x9f70):
|
class LifeCycleState(BER_TLV_IE, tag=0x9f70):
|
||||||
_construct = CLifeCycleState
|
_construct = CLifeCycleState
|
||||||
@@ -1010,7 +1009,6 @@ class ADF_SD(CardADF):
|
|||||||
self._cmd.lchan.scc.scp = None
|
self._cmd.lchan.scc.scp = None
|
||||||
self._cmd.update_prompt()
|
self._cmd.update_prompt()
|
||||||
|
|
||||||
|
|
||||||
# Card Application of a Security Domain
|
# Card Application of a Security Domain
|
||||||
class CardApplicationSD(CardApplication):
|
class CardApplicationSD(CardApplication):
|
||||||
__intermediate = True
|
__intermediate = True
|
||||||
@@ -1048,7 +1046,6 @@ class GpCardKeyset:
|
|||||||
return "%s(KVN=%u, ENC=%s, MAC=%s, DEK=%s)" % (self.__class__.__name__,
|
return "%s(KVN=%u, ENC=%s, MAC=%s, DEK=%s)" % (self.__class__.__name__,
|
||||||
self.kvn, b2h(self.enc), b2h(self.mac), b2h(self.dek))
|
self.kvn, b2h(self.enc), b2h(self.mac), b2h(self.dek))
|
||||||
|
|
||||||
|
|
||||||
def compute_kcv_des(key:bytes) -> bytes:
|
def compute_kcv_des(key:bytes) -> bytes:
|
||||||
# GP Card Spec B.6: For a DES key, the key check value is computed by encrypting 8 bytes, each with
|
# GP Card Spec B.6: For a DES key, the key check value is computed by encrypting 8 bytes, each with
|
||||||
# value '00', with the key to be checked and retaining the 3 highest-order bytes of the encrypted
|
# value '00', with the key to be checked and retaining the 3 highest-order bytes of the encrypted
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import argparse
|
|||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
from construct import Construct
|
from construct import Construct
|
||||||
from osmocom.utils import b2h, h2b, i2h, Hexstr
|
from osmocom.utils import b2h, h2b, i2h, Hexstr
|
||||||
|
|
||||||
from pySim.exceptions import *
|
from pySim.exceptions import *
|
||||||
from pySim.utils import SwHexstr, SwMatchstr, ResTuple, sw_match, parse_command_apdu
|
from pySim.utils import SwHexstr, SwMatchstr, ResTuple, sw_match, parse_command_apdu
|
||||||
from pySim.cat import ProactiveCommand, CommandDetails, DeviceIdentities, Result
|
from pySim.cat import ProactiveCommand, CommandDetails, DeviceIdentities, Result
|
||||||
@@ -244,7 +243,6 @@ class LinkBase(abc.ABC):
|
|||||||
raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
|
raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter)
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
||||||
class LinkBaseTpdu(LinkBase):
|
class LinkBaseTpdu(LinkBase):
|
||||||
|
|
||||||
# Use the T=0 TPDU format by default as this is the most commonly used transport protocol.
|
# Use the T=0 TPDU format by default as this is the most commonly used transport protocol.
|
||||||
@@ -373,7 +371,6 @@ def argparse_add_reader_args(arg_parser: argparse.ArgumentParser):
|
|||||||
|
|
||||||
return arg_parser
|
return arg_parser
|
||||||
|
|
||||||
|
|
||||||
def init_reader(opts, **kwargs) -> LinkBase:
|
def init_reader(opts, **kwargs) -> LinkBase:
|
||||||
"""
|
"""
|
||||||
Init card reader driver
|
Init card reader driver
|
||||||
|
|||||||
Reference in New Issue
Block a user