Project

General

Profile

PySim-prog » History » Version 1

laforge, 10/30/2023 04:08 PM

1 1 laforge
h1. @pySim-prog@
2
3
In general, please make sure to always consult the "User Maual":https://downloads.osmocom.org/docs/latest/pysim/ - it is more authoritative than this rarely maintained  wiki page.
4
5
Furthermore, pySim-prog is a legacy program that only supports a small fraction of the features of [[pySim-shell]].  Please consider using pySim-shell instead.
6
7
h2. Examples
8
9
h3. Program (very few fields of) your SIM card using legacy pySim-prog
10
11
* Enter   @./pySim-prog.py -help@   to get overview of possible options. 
12
13
Similar result should appear: 
14
15
 $ ./pySim-prog.py -help
16
 Usage: pySim-prog.py [options]
17
 Options:
18
   -h, --help            show this help message and exit
19
   -d DEV, --device=DEV  Serial Device for SIM access [default: /dev/ttyUSB0]
20
   -b BAUD, --baud=BAUD  Baudrate used for SIM access [default: 9600]
21
   -p PCSC, --pcsc-device=PCSC
22
                         Which PC/SC reader number for SIM access
23
   -t TYPE, --type=TYPE  Card type (user -t list to view) [default: auto]
24
   -a PIN_ADM, --pin-adm=PIN_ADM
25
                         ADM PIN used for provisioning (overwrites default)
26
   -e, --erase           Erase beforehand [default: False]
27
   -S SOURCE, --source=SOURCE
28
                         Data Source[default: cmdline]
29
   -n NAME, --name=NAME  Operator name [default: Magic]
30
   -c CC, --country=CC   Country code [default: 1]
31
   -x MCC, --mcc=MCC     Mobile Country Code [default: 901]
32
   -y MNC, --mnc=MNC     Mobile Network Code [default: 55]
33
   -m SMSC, --smsc=SMSC  SMSP [default: '00 + country code + 5555']
34
   -M SMSP, --smsp=SMSP  Raw SMSP content in hex [default: auto from SMSC]
35
   -s ID, --iccid=ID     Integrated Circuit Card ID
36
   -i IMSI, --imsi=IMSI  International Mobile Subscriber Identity
37
   -k KI, --ki=KI        Ki (default is to randomize)
38
   -o OPC, --opc=OPC     OPC (default is to randomize)
39
   --op=OP               Set OP to derive OPC from OP and KI
40
   --acc=ACC             Set ACC bits (Access Control Code). not all card types
41
                         are supported
42
   -z STR, --secret=STR  Secret used for ICCID/IMSI autogen
43
   -j NUM, --num=NUM     Card # used for ICCID/IMSI autogen
44
   --batch               Enable batch mode [default: False]
45
   --batch-state=FILE    Optional batch state file
46
   --read-csv=FILE       Read parameters from CSV file rather than command line
47
   --write-csv=FILE      Append generated parameters in CSV file
48
   --write-hlr=FILE      Append generated parameters to OpenBSC HLR sqlite3
49
   --dry-run             Perform a 'dry run', don't actually program the card
50
51
h3. Example of how to program a sysmoSIM-GR1 card 
52
53
The GRcard SIM is a programmable GSM SIM card. It uses a mixture of TS11.11 / ISO7816-4 and proprietary commands for programming.
54
55
In the below example, we are changing the card’s IMSI to 901700000003080 (option -i) and we are specifying a new set of -n NAME (Operator name), -t TYPE (Card type), -c CC (Country code), -x MCC (Mobile Country Code), -y MNC (Mobile Network Code) and -s ID (Integrated Circuit Card ID) values.
56
 
57
 $ ./pySim-prog.py -p 0 -n OpenBSC -t sysmosim-gr1 -i 901700000003080 -c 001 -x 001 -y 02 -s 1791198229180000075
58
 Insert card now (or CTRL-C to cancel)
59
 Generated card parameters :
60
  > Name    : OpenBSC
61
  > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
62
  > ICCID   : 1791198229180000075
63
  > MCC/MNC : 1/2
64
  > IMSI    : 901700000003080
65
  > Ki      : 7edaeb6addbd72d2b2cc6ed7bfecc9c9
66
  > OPC     : 23f075ab9b1a113d4db822d8195ea20c
67
  > ACC     : None
68
 Programming ...
69
 Done !
70
71
h3. Example of how to program a sysmoUSIM-SJS1 card
72
73
(U)SIM cards are Java capable and there is the Globalplatform that specifies standards API. SMS can be addressed directly to the SIM card, the SIM card will get events for network selection and others, it can modify call establishment attempts.
74
75
76
Provisioning of different identities or keys.
77
 
78
If you have a variant of the card-individual ADM1 key of your sysmoUSIM-SJS1 card,  you can change any identity (IMSI, ICCID, MSISDN) stored on the (U)SIM, as well as the private key data (K, OPC).
79
80
In the below example, we are changing the card’s IMSI to 901700000003080 (option -i) and we are specifying a new set of -t TYPE (Card type), - a ADM_PIN (ADM PIN used for provisioning), -x MCC (Mobile Country Code), -y MNC (Mobile Network Code), -s ID (Integrated Circuit Card ID), -o OPC and -k KI (Ki) values.
81
82
 $ ./pySim-prog.py -p 0 -t sysmoUSIM-SJS1 -a 58001006  -x 901 -y 71 -i 901700000010659 -s 8988211000000110000 -o 398153093661279FB1FC74BE07059FEF -k 1D8B2562B992549F20D0F42113EAA6FA
83
 Insert card now (or CTRL-C to cancel)
84
 Generated card parameters :
85
  > Name    : Magic
86
  > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
87
  > ICCID   : 8988211000000110000
88
  > MCC/MNC : 901/71
89
  > IMSI    : 901700000010659
90
  > Ki      : 1D8B2562B992549F20D0F42113EAA6FA
91
  > OPC     : 398153093661279FB1FC74BE07059FEF
92
  > ACC     : None
93
 Programming ...
94
 Done !
95
96
h3. Example of how to program a Magic SIM / SuperSIM 16-in-1 / X-sim card
97
98
The 16-in-1 SIM cards are intended for COMP128v1 based cloning and enable the user to aggregate up to 16 SIM card identities in a single card. This multi-IMSI property is not used in the context of Osmocom.
99
100
Below example shows how we can change the card’s IMSI to 901990000000018 (option -i) and at the same time we are specifying a new set of -x MCC (Mobile Country Code), -y MNC (Mobile Network Code), -s ID (Integrated Circuit Card ID) , -o OPC and -k KI (Ki) values.
101
102
 $ ./pySim-prog.py -p 0 -x 801 -y 71 -i 901990000000018 -s 8988211000000110000 -o 398153093661279FB1FC74BE07059FEF -k 1D8B2562B992549F20D0F42113EAA6FA
103
 Insert card now (or CTRL-C to cancel)
104
 Autodetected card type fakemagicsim
105
 Generated card parameters :
106
  > Name    : Magic
107
  > SMSP    : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
108
  > ICCID   : 8988211000000110000
109
  > MCC/MNC : 801/71
110
  > IMSI    : 901990000000018
111
  > Ki      : 1D8B2562B992549F20D0F42113EAA6FA
112
  > OPC     : 398153093661279FB1FC74BE07059FEF
113
  > ACC     : None
114
 Programming ...
115
 Done !
Add picture from clipboard (Maximum size: 48.8 MB)