Commit ec9894bd authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Use smart card reader to write sim card

parent 6c8644e8
...@@ -2,7 +2,7 @@ program_uicc: program_uicc.c uicc.h milenage.h ...@@ -2,7 +2,7 @@ program_uicc: program_uicc.c uicc.h milenage.h
g++ --std=c++11 -g3 -I. -Wall program_uicc.c -o program_uicc g++ --std=c++11 -g3 -I. -Wall program_uicc.c -o program_uicc
program_uicc_pcsc: program_uicc.c uicc.h milenage.h program_uicc_pcsc: program_uicc.c uicc.h milenage.h
g++ --std=c++11 -g3 -DPCSC -I. -I/usr/include/PCSC -Wall program_uicc.c -L/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux -lccid -o program_uicc_pcsc g++ --std=c++11 -g3 -DPCSC -I. -I/usr/include/PCSC -Wall program_uicc.c -L/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux -Wl,-rpath=/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux -lccid -o program_uicc_pcsc
clean: clean:
rm program_uicc program_uicc_pcsc rm program_uicc program_uicc_pcsc
In order to use smart card read HID omnikey, do
sudo apt install libpcsclite-dev libccid
make program_uicc_pcsc
./write-sim-card XXX
...@@ -6,6 +6,12 @@ if [ -z "$1" ]; then ...@@ -6,6 +6,12 @@ if [ -z "$1" ]; then
echo "Usage: ./write-sim-card ORS_NUMBER [SIM_NUMBER_START]"; echo "Usage: ./write-sim-card ORS_NUMBER [SIM_NUMBER_START]";
exit; exit;
fi fi
usb_device=$(lsusb | grep "Smart Card Reader")
if [ -z "$usb_device" ]; then
echo "No Smart Card Reader found"
exit 1
fi
usb_opt=$(echo $usb_device | sed 's/.* ID //' | sed 's/ .*//' | sed 's#:#/#' )
adm="12345678" adm="12345678"
plmn="00101" plmn="00101"
# Albania # Albania
...@@ -21,10 +27,15 @@ else ...@@ -21,10 +27,15 @@ else
fi fi
let imsinum=$1*10+$imsioffset let imsinum=$1*10+$imsioffset
j=y j=y
echo
echo "Press enter when you have entered the SIM card"
while read j ; do while read j ; do
[[ $j = "q" ]] && exit [[ $j = "q" ]] && exit
i=$(printf "%05d" $imsinum) i=$(printf "%05d" $imsinum)
echo programming imsi: $i echo programming imsi: $i
sudo $SOURCE_DIR/program_uicc --adm ${adm} --iccid 898600611000000$i --imsi ${plmn}00000$i --isdn 06000$i --acc 0001 --key 00112233445566778899AABBCCDDEEFF --opc 000102030405060708090A0B0C0D0E0F -spn "RS-ORS$1-$i" --authenticate --noreadafter $SOURCE_DIR/program_uicc_pcsc --port usb:$usb_opt --adm ${adm} --iccid 898600611000000$i --imsi ${plmn}00000$i --isdn 06000$i --acc 0001 --key 00112233445566778899AABBCCDDEEFF --opc 000102030405060708090A0B0C0D0E0F -spn "RS-ORS$1-$i" --authenticate --noreadafter
let imsinum=$imsinum+1 let imsinum=$imsinum+1
echo
echo "Press enter when you have entered the new SIM card (or 'q' to quit)"
done done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment