Python script to read and write SIM cards. Fields and values are specified in a CSV file, and optionally a filter script can be supplied as a command line argument for dynamically changing the CSV contents for each card.
- Python 3.6 or later (Python Installation Steps)
Windows
python -m pip install --upgrade {sim_csv_script-VERSION.tar.gz}
Linux
python3 -m pip install --upgrade {sim_csv_script-VERSION.tar.gz}
- First, change into the directory that contains
setup.py
orsetup.cfg
file
Windows
python -m pip install --upgrade -e .
Windows: if you get a "swig.exe" error while running the installation command, you will need to download the swig prebuilt executable (http://www.swig.org/download.html), extract the zip, and add the folder to your PATH. Try running the installation steps again, and if it fails with a "Visual Studio Build Tools" error, then you will need to download https://visualstudio.microsoft.com/visual-cpp-build-tools/, install it, and select the "Desktop development with C++"
Linux
python3 -m pip install --upgrade -e .
Linux: if you get a "swig: not found" error while running the installation command, first ensure that Python 3.6 or later is installed (
python3 --version
). If so, install swig withsudo apt install swig
and retry the installation command
sim_csv_script -h
sim_csv_script --list-field-names
sim_csv_script {example.csv}
- Specify ASCII ADM pin without the leading "0x"
sim_csv_script {example.csv} --write --pin-adm 0x8888888888888888
Example Write Single (reading hexadecimal ADM pin from JSON file with {"IMSI key" : "ADM pin value"})
- Specify ASCII ADM pins without the leading "0x"
sim_csv_script {example.csv} --write --pin-adm-json {IMSI_TO_ADM.json}
sim_csv_script {example.csv} --multiple
Windows: substitute
python3
withpython
-
Provide a filter script (doesn't have to be Python) that reads in a CSV file from STDIN, modifies it, and outputs a new CSV file to STDOUT
-
The filter script should function as a standalone program "
python3 filter_script.py {arg1} < {example.csv}
", and print out the filtered csv file- On Windows, run this in Command Prompt because Powershell does not have the "<" operator
- In theory if standalone program works, copy and paste everything before the "<" as the
--filter
. (e.g. "--filter python3 filter_script.py {arg1}
")
-
Filter script must exit with a 0 return code to indicate Success.
- Any other return code will be treated as failure
-
If each card needs different filter script arguments, specify
--ask-filter-args
.- User will be prompted for input, which will be appended to end of
--filter
- User will be prompted for input, which will be appended to end of
sim_csv_script {example.csv} --multiple --filter python3 filter_script.py {arg1}
sim_csv_script {example.csv} --multiple --filter python3 filter_script.py --ask-filter-args