Difference between revisions of "PySIM"
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Image:Smartcard-writer-bludrive2.png|right|200px|thumb|Smartcard Writer Bludrive II]] | |
− | pySIM | + | pySIM adalah SIM card management tool, yang mampu untuk membuat, mengedit, men-delete, backup dan restore phonebook & SMS records. |
− | |||
− | + | SIM card di handphone adalah smartcard sederhana. Kita dapat mem-program SIM card menggunakan smartcard writer. Pada dasarnya smartcard writer ada 2 jenis, yaitu: | |
− | + | * USB Serial device. Di UNIX akan terdeteksi sebagai /dev, seperti /dev/ttyUSB0. Contoh 16-in-1 Magic SIM. | |
− | + | * PC/SC device. Device ini berhubungan melalui PC/SC driver dan tidak akan terlihat sebagai /dev. Jenis ini lebih banyak. Bluedrive II yang digunakan oleh RangeNetworks adalah jenis ini. | |
− | |||
− | |||
− | + | Untuk melihat apakah smartcard writer terdeteksi dengan baik kita dapat menulis | |
− | |||
− | + | lsusb | |
+ | Hasilnya kira-kira | ||
+ | |||
+ | Bus 003 Device 002: ID 1b0e:1078 BLUTRONICS S.r.l. BLUDRIVE II CCID | ||
+ | |||
+ | |||
+ | ==Penggunaan Bludrive II== | ||
+ | |||
+ | * Orientasi card harus benar, dengan kontak metal mengarah ke atas di dalam bludrive II. | ||
+ | * Jika SIM card dimasukan secara benar, LED akan menyala menjadi merah sekitar 10 detik kemudian akan menjadi hijau kembali. | ||
+ | * Jika SIM card tidak dimasukan secara benar, LED akan flashing merah sekitar satu detik kemudian akan terus menerus merah sampai SIM card di ambil. | ||
+ | |||
+ | ==Instalasi pySim== | ||
+ | |||
+ | |||
+ | Untuk mendukung operasi smartcard writer kita perlu menginstalasi | ||
+ | |||
+ | sudo apt-get install libudev1 libpcsclite1 libccid python-pyscard | ||
+ | |||
+ | Setelah semua di instalasi, kita dapat memprogram SIM card dengan pysim. | ||
+ | Gunakan opsi: | ||
+ | |||
+ | * -p untuk menentukan PC/SC interface (biasanya "-p 0"), | ||
+ | * untuk Range GR-Card blank SIM kita menset tipe card sebagai "-t grcardsim". | ||
+ | |||
+ | Contoh: | ||
+ | |||
+ | openbts@UnitC:~/pysim$ ./pySim-prog.py -p 0 -n OpenBTS -c 1 -x 001 -y 01 -j 4 -t grcardsim | ||
+ | Failed to load symbol for: SCardCancelTransaction, /usr/local/lib/libpcsclite.so.1: undefined symbol: SCardCancelTransaction! | ||
+ | Insert card now (or CTRL-C to cancel) | ||
+ | Generated card parameters : | ||
+ | > Name : OpenBTS | ||
+ | > SMSP : 0015555 | ||
+ | > ICCID : 89010010100000000004 | ||
+ | > MCC/MNC : 1/1 | ||
+ | > IMSI : 001010000000004 | ||
+ | > Ki : bc9aecfabe1f81f1f85d09370f5a6f51 | ||
+ | |||
+ | Programming ... | ||
+ | Done ! | ||
+ | |||
+ | Untuk memancing kadang kala kita perlu masuk ke shell OpenBTS dan menjalankan | ||
+ | |||
+ | /var/cgi-bin/range/pySim_prog.py -p 0 -n OpenBTS -c 1 -x 510 -y 42 -j 4 -t grcardsim --imsi-prefix 51042 | ||
+ | |||
+ | |||
+ | |||
+ | Other comments on pysim: | ||
+ | |||
+ | The "undefined symbol" warning does not appear to be a problem, so ignore it. | ||
+ | If you get the error message | ||
+ | |||
+ | smartcard.Exceptions.CardConnectionExc | ||
+ | eption: Unable to connect with protocol: T0 or T1. Card is unpowered | ||
+ | |||
+ | that means the SIM is in the drive upside down or backwards. | ||
==Lebih Detail== | ==Lebih Detail== | ||
Line 57: | Line 108: | ||
# Run A3/A8 | # Run A3/A8 | ||
print sc.run_gsm('00112233445566778899aabbccddeeff') | print sc.run_gsm('00112233445566778899aabbccddeeff') | ||
+ | |||
+ | |||
+ | |||
+ | ==Tipe SIM Card== | ||
+ | |||
+ | Tampaknya ada beberapa tipe SIM Card | ||
+ | |||
+ | FakeMagicSim, SuperSim, MagicSim, GrcardSim, SysmoSIMgr1, SysmoUSIMgr1 | ||
+ | |||
+ | Ini digunakan | ||
+ | |||
+ | ./pySim-prog.py -p 0 -n OpenBTS -c 1 -x 001 -y 01 -j 4 -t grcardsim | ||
+ | |||
+ | ==SIM Programming FAQ== | ||
+ | |||
+ | * Q: Should all the sims have the same Ki ? Or is recomended that each sim has its own Ki? | ||
+ | * A: Every SIM needs a unique and random Ki. PySIM will generate a random Ki by default. | ||
+ | |||
+ | * Q: What is the use of the "Name" in the sim? | ||
+ | * A: It is the "short name" for your phone company. It should be 8 characters or less to be displayed properly on most phones. | ||
+ | |||
+ | * Q: What is the "SMSP"? | ||
+ | * A: "Short Message Service Parameters". Take a look at GSM 11.11 Section 10.5.6, attached. The default values provided by PySIM are OK if you don't want to worry with these. | ||
+ | |||
+ | * Q: Why do all generated sims have "89" as the starting value of the ICCID? | ||
+ | * A: Take a look at http://en.wikipedia.org/wiki/Subscriber_Identity_Module#ICCID for an explanation of the ICCID fields. The "89" prefix is used for all SIMs. The next 2-3 digits are from the E.164 country code. | ||
+ | |||
Latest revision as of 16:41, 2 February 2016
pySIM adalah SIM card management tool, yang mampu untuk membuat, mengedit, men-delete, backup dan restore phonebook & SMS records.
SIM card di handphone adalah smartcard sederhana. Kita dapat mem-program SIM card menggunakan smartcard writer. Pada dasarnya smartcard writer ada 2 jenis, yaitu:
- USB Serial device. Di UNIX akan terdeteksi sebagai /dev, seperti /dev/ttyUSB0. Contoh 16-in-1 Magic SIM.
- PC/SC device. Device ini berhubungan melalui PC/SC driver dan tidak akan terlihat sebagai /dev. Jenis ini lebih banyak. Bluedrive II yang digunakan oleh RangeNetworks adalah jenis ini.
Untuk melihat apakah smartcard writer terdeteksi dengan baik kita dapat menulis
lsusb
Hasilnya kira-kira
Bus 003 Device 002: ID 1b0e:1078 BLUTRONICS S.r.l. BLUDRIVE II CCID
Penggunaan Bludrive II
- Orientasi card harus benar, dengan kontak metal mengarah ke atas di dalam bludrive II.
- Jika SIM card dimasukan secara benar, LED akan menyala menjadi merah sekitar 10 detik kemudian akan menjadi hijau kembali.
- Jika SIM card tidak dimasukan secara benar, LED akan flashing merah sekitar satu detik kemudian akan terus menerus merah sampai SIM card di ambil.
Instalasi pySim
Untuk mendukung operasi smartcard writer kita perlu menginstalasi
sudo apt-get install libudev1 libpcsclite1 libccid python-pyscard
Setelah semua di instalasi, kita dapat memprogram SIM card dengan pysim. Gunakan opsi:
- -p untuk menentukan PC/SC interface (biasanya "-p 0"),
- untuk Range GR-Card blank SIM kita menset tipe card sebagai "-t grcardsim".
Contoh:
openbts@UnitC:~/pysim$ ./pySim-prog.py -p 0 -n OpenBTS -c 1 -x 001 -y 01 -j 4 -t grcardsim Failed to load symbol for: SCardCancelTransaction, /usr/local/lib/libpcsclite.so.1: undefined symbol: SCardCancelTransaction! Insert card now (or CTRL-C to cancel) Generated card parameters : > Name : OpenBTS > SMSP : 0015555 > ICCID : 89010010100000000004 > MCC/MNC : 1/1 > IMSI : 001010000000004 > Ki : bc9aecfabe1f81f1f85d09370f5a6f51 Programming ... Done !
Untuk memancing kadang kala kita perlu masuk ke shell OpenBTS dan menjalankan
/var/cgi-bin/range/pySim_prog.py -p 0 -n OpenBTS -c 1 -x 510 -y 42 -j 4 -t grcardsim --imsi-prefix 51042
Other comments on pysim:
The "undefined symbol" warning does not appear to be a problem, so ignore it. If you get the error message
smartcard.Exceptions.CardConnectionExc
eption: Unable to connect with protocol: T0 or T1. Card is unpowered
that means the SIM is in the drive upside down or backwards.
Lebih Detail
This utility allows to : Program customizable SIMs. Two modes are possible:
- one where you specify every parameter manually :
./pySim-prog.py -n 26C3 -c 49 -x 262 -y 42 -i <IMSI> -s <ICCID>
- one where they are generated from some minimal set :
./pySim-prog.py -n 26C3 -c 49 -x 262 -y 42 -z <random_string_of_choice> -j <card_num>
With <random_string_of_choice> and <card_num>, the soft will generate 'predictable' IMSI and ICCID, so make sure you choose them so as not to conflict with anyone. (for eg. your name as <random_string_of_choice> and 0 1 2 ... for <card num>).
You also need to enter some parameters to select the device :
-t TYPE : type of card (supersim, magicsim, fakemagicsim or try 'auto') -d DEV : Serial port device (default /dev/ttyUSB0) -b BAUD : Baudrate (default 9600)
- Interact with SIMs from a python interactive shell (ipython for eg :)
from pySim.transport.serial import SerialSimLink from pySim.commands import SimCardCommands
sl = SerialSimLink(device='/dev/ttyUSB0', baudrate=9600) sc = SimCardCommands(sl)
sl.wait_for_card()
# Print IMSI print sc.read_binary(['3f00', '7f20', '6f07'])
# Run A3/A8 print sc.run_gsm('00112233445566778899aabbccddeeff')
Tipe SIM Card
Tampaknya ada beberapa tipe SIM Card
FakeMagicSim, SuperSim, MagicSim, GrcardSim, SysmoSIMgr1, SysmoUSIMgr1
Ini digunakan
./pySim-prog.py -p 0 -n OpenBTS -c 1 -x 001 -y 01 -j 4 -t grcardsim
SIM Programming FAQ
- Q: Should all the sims have the same Ki ? Or is recomended that each sim has its own Ki?
- A: Every SIM needs a unique and random Ki. PySIM will generate a random Ki by default.
- Q: What is the use of the "Name" in the sim?
- A: It is the "short name" for your phone company. It should be 8 characters or less to be displayed properly on most phones.
- Q: What is the "SMSP"?
- A: "Short Message Service Parameters". Take a look at GSM 11.11 Section 10.5.6, attached. The default values provided by PySIM are OK if you don't want to worry with these.
- Q: Why do all generated sims have "89" as the starting value of the ICCID?
- A: Take a look at http://en.wikipedia.org/wiki/Subscriber_Identity_Module#ICCID for an explanation of the ICCID fields. The "89" prefix is used for all SIMs. The next 2-3 digits are from the E.164 country code.