Skip to main content

Program SIM cards by importing CSV file

Project description

SIM CSV Script

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.

System Requirements

Installation

Method #1: Source Distribution (.tar.gz file)

Windows

python -m pip install --upgrade {sim_csv_script-VERSION.tar.gz}

Linux

python3 -m pip install --upgrade {sim_csv_script-VERSION.tar.gz}

Method #2: Source Code

  • First, change into the directory that contains setup.py or setup.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 with sudo apt install swig and retry the installation command


COMMAND LINE SCRIPT

Help and Documentation

sim_csv_script -h

List valid field names that can used in CSV file

sim_csv_script --list-field-names

Example Read Single

sim_csv_script {example.csv}

Example Write Single (reading ADM pin from CLI arg)

  • 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}

Example Read Multiple

sim_csv_script {example.csv} --multiple

Filter Script

Windows: substitute python3 with python

  • 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

Example Read Multiple with --filter

sim_csv_script {example.csv} --multiple --filter python3 filter_script.py {arg1}

Example Read Multiple with --filter and --ask-filter-args

sim_csv_script {example.csv} --multiple --filter python3 filter_script.py --ask-filter-args

For Development Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sim_csv_script-1.4.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

sim_csv_script-1.4.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file sim_csv_script-1.4.0.tar.gz.

File metadata

  • Download URL: sim_csv_script-1.4.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.0

File hashes

Hashes for sim_csv_script-1.4.0.tar.gz
Algorithm Hash digest
SHA256 b4cc133b563a56da5c57a789c66fe4dc2409062225f6e8bc13bf953f9ea39f63
MD5 d1f7e310eaa4db1d11e9e38f7da156f0
BLAKE2b-256 22fb67db4b20f2c8bdc6e1d177a8912ed55efeae6ce7aa9609c379f87e0a264e

See more details on using hashes here.

File details

Details for the file sim_csv_script-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: sim_csv_script-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.0

File hashes

Hashes for sim_csv_script-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b161af6f456221cbb79ba400d9f6c8ba6096b3a95cf4932c5e3d440a73fa53c
MD5 5d7a699e36841f9e3b9920a268d5e114
BLAKE2b-256 1f295cfe185cc6a0422b65d6ed254bc07c8331cdb526b3e94783f8bbe55f8f3b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page