Welcome to Osmocom pySim¶
Introduction¶
pySim is a python implementation of various software that helps you with managing subscriber identity cards for cellular networks, so-called SIM cards.
Many Osmocom (Open Source Mobile Communications) projects relate to operating private / custom cellular networks, and provisioning SIM cards for said networks is in many cases a requirement to operate such networks.
To make use of most of pySim’s features, you will need a programmable SIM card, i.e. a card where you are the owner/operator and have sufficient credentials (such as the ADM PIN) in order to write to many if not most of the files on the card.
Such cards are, for example, available from sysmocom, a major contributor to pySim. See https://www.sysmocom.de/products/lab/sysmousim/ for more details.
pySim supports classic GSM SIM cards as well as ETSI UICC with 3GPP USIM and ISIM applications. It is easily extensible, so support for additional files, card applications, etc. can be added easily by any python developer. We do encourage you to submit your contributions to help this collaborative development project.
pySim consists of several parts:
a python library containing plenty of objects and methods that can be used for writing custom programs interfacing with SIM cards.
the [new] pySim-trace APDU trace decoder
the [legacy] pySim-prog and pySim-read tools
Contents:
- pySim-shell
- Video Presentation
- Running pySim-shell
- Usage Examples
- Advanced Topics
- cmd2 basics
- pySim commands
- ISO7816 commands
- TS 102 221 commands
- Linear Fixed EF commands
- Transparent EF commands
- BER-TLV EF commands
- USIM commands
- File-specific commands
- EF.ARR: read_arr_record
- EF.ARR: read_arr_records
- DF.GSM/EF.SST: sst_service_allocate
- DF.GSM/EF.SST: sst_service_activate
- DF.GSM/EF.SST: sst_service_deallocate
- DF.GSM/EF.SST: sst_service_deactivate
- ADF.USIM/EF.EST: est_service_enable
- ADF.USIM/EF.EST: est_service_disable
- EF.IMSI: update_imsi_plmn
- ADF.USIM/EF.UST: ust_service_activate
- ADF.USIM/EF.UST: ust_service_deactivate
- ADF.USIM/EF.UST: ust_service_check
- ADF.ISIM/EF.IST: ist_service_activate
- ADF.ISIM/EF.IST: ist_service_deactivate
- ADF.ISIM/EF.IST: ist_service_check
- UICC Administrative commands
- ARA-M commands
- GlobalPlatform commands
- eUICC ISD-R commands
- cmd2 settable parameters
- pySim-trace
- Legacy tools
- pySim library
- pySim filesystem abstraction
- pySim commands abstraction
- pySim Transport
- pySim construct utilities
BcdAdapter
BitsRFU()
BytesRFU()
GreedyInteger
GsmOrUcs2Adapter
GsmOrUcs2String()
GsmString()
GsmStringAdapter
HexAdapter
InvertAdapter
Ipv4Adapter
Ipv6Adapter
MultiplyAdapter
PlmnAdapter
Rpad
StripTrailerAdapter
Ucs2Adapter
Utf8Adapter
build_construct()
filter_dict()
normalize_construct()
parse_construct()
- pySim TLV utilities
- pySim utility functions
CardCommand
CardCommandSet
DataObject
DataObjectChoice
DataObjectCollection
DataObjectSequence
JsonEncoder
TL0_DataObject
all_subclasses()
auto_int()
b2h()
bertlv_encode_len()
bertlv_encode_tag()
bertlv_parse_len()
bertlv_parse_one()
bertlv_parse_one_rawtag()
bertlv_parse_tag()
bertlv_parse_tag_raw()
bertlv_return_one_rawtlv()
boxed_heading_str()
calculate_luhn()
comprehensiontlv_encode_tag()
comprehensiontlv_parse_one()
comprehensiontlv_parse_tag()
comprehensiontlv_parse_tag_raw()
dec_imsi()
dec_msisdn()
derive_mcc()
derive_milenage_opc()
derive_mnc()
dgi_encode_len()
dgi_parse_len()
enc_imsi()
enc_msisdn()
enc_plmn()
expand_hex()
get_addr_type()
h2b()
h2i()
h2s()
i2h()
i2s()
is_decimal()
is_hex()
is_hexstr()
is_hexstr_or_decimal()
lpad()
mcc_from_imsi()
mnc_from_imsi()
rpad()
s2h()
sanitize_pin_adm()
str_sanitize()
sw_match()
swap_nibbles()
tabulate_str_list()
verify_luhn()
- pySim exceptions
- pySim card_handler
- pySim card_key_provider
- osmo-smdpp