Coder Social home page Coder Social logo

iotconnectivity / kiopcgenerator Goto Github PK

View Code? Open in Web Editor NEW
35.0 6.0 14.0 43 KB

Ki/OPc USIM card keys geneartion. This script will produce Ki/eKi/OPc triplets given the Op and Transport keys.

License: GNU Lesser General Public License v3.0

Python 100.00%
simcard smartcard sim sims usims ki opc telecoms gsm

kiopcgenerator's People

Contributors

fontanon avatar mahfuz110244 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kiopcgenerator's Issues

Centos 7.2 with Python 2.7: ImportError: No module named card.utils

Hi,

I am trying to use it on CentOS Linux release 7.2.1511 and I get the follwoing error:
[root@APPServer kiopcgenerator]# kiopcgen
Traceback (most recent call last):
File "/usr/bin/kiopcgen", line 4, in
import('pkg_resources').run_script('kiopcgenerator==0.1.2', 'kiopcgen')
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/usr/lib/python2.7/site-packages/kiopcgenerator-0.1.2-py2.7.egg/EGG-INFO/scripts/kiopcgen", line 14, in

File "build/bdist.linux-x86_64/egg/kiopcgenerator/init.py", line 9, in
File "build/bdist.linux-x86_64/egg/kiopcgenerator/lib.py", line 17, in
ImportError: No module named card.utils

Python version is 2.7.5 and this are the logs for the instalation:
[root@APPServer kiopcgenerator]# python setup.py install
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'setup_requies'
warnings.warn(msg)
running install
running bdist_egg
running egg_info
creating kiopcgenerator.egg-info
writing requirements to kiopcgenerator.egg-info/requires.txt
writing kiopcgenerator.egg-info/PKG-INFO
writing top-level names to kiopcgenerator.egg-info/top_level.txt
writing dependency_links to kiopcgenerator.egg-info/dependency_links.txt
writing manifest file 'kiopcgenerator.egg-info/SOURCES.txt'
reading manifest file 'kiopcgenerator.egg-info/SOURCES.txt'
writing manifest file 'kiopcgenerator.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/kiopcgenerator
copying kiopcgenerator/lib.py -> build/lib/kiopcgenerator
copying kiopcgenerator/init.py -> build/lib/kiopcgenerator
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/kiopcgenerator
copying build/lib/kiopcgenerator/lib.py -> build/bdist.linux-x86_64/egg/kiopcgenerator
copying build/lib/kiopcgenerator/init.py -> build/bdist.linux-x86_64/egg/kiopcgenerator
byte-compiling build/bdist.linux-x86_64/egg/kiopcgenerator/lib.py to lib.pyc
byte-compiling build/bdist.linux-x86_64/egg/kiopcgenerator/init.py to init.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-2.7
copying and adjusting kiopcgen -> build/scripts-2.7
changing mode of build/scripts-2.7/kiopcgen from 644 to 755
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/kiopcgen -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/kiopcgen to 755
copying kiopcgenerator.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kiopcgenerator.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kiopcgenerator.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kiopcgenerator.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kiopcgenerator.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/kiopcgenerator-0.1.2-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing kiopcgenerator-0.1.2-py2.7.egg
Copying kiopcgenerator-0.1.2-py2.7.egg to /usr/lib/python2.7/site-packages
Adding kiopcgenerator 0.1.2 to easy-install.pth file
Installing kiopcgen script to /usr/bin

Installed /usr/lib/python2.7/site-packages/kiopcgenerator-0.1.2-py2.7.egg
Processing dependencies for kiopcgenerator==0.1.2
Searching for card==0.0.1
Best match: card 0.0.1
Processing card-0.0.1-py2.7.egg
card 0.0.1 is already the active version in easy-install.pth

Using /usr/lib/python2.7/site-packages/card-0.0.1-py2.7.egg
Searching for pycrypto==2.6.1
Best match: pycrypto 2.6.1
Processing pycrypto-2.6.1-py2.7-linux-x86_64.egg
pycrypto 2.6.1 is already the active version in easy-install.pth

Using /usr/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-x86_64.egg
Finished processing dependencies for kiopcgenerator==0.1.2

I tried also using repository and the same issue:
[root@APPServer ~]# pip install git+https://github.com/PodgroupConnectivity/kiopcgenerator#egg=kiopcgenerator
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting kiopcgenerator
Cloning https://github.com/PodgroupConnectivity/kiopcgenerator to /tmp/pip-install-8bSiRB/kiopcgenerator
Running command git clone -q https://github.com/PodgroupConnectivity/kiopcgenerator /tmp/pip-install-8bSiRB/kiopcgenerator
Requirement already satisfied: pycrypto in /usr/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-x86_64.egg (from kiopcgenerator) (2.6.1)
Requirement already satisfied: card@ git+https://github.com/PodgroupConnectivity/card.git@b8eb2c70eaad754a631a9fcbd1ce0dba4b58a662#egg=card-0.3.1 from git+https://github.com/PodgroupConnectivity/card.git@b8eb2c70eaad754a631a9fcbd1ce0dba4b58a662#egg=card-0.3.1 in /usr/lib/python2.7/site-packages/card-0.0.1-py2.7.egg (from kiopcgenerator) (0.0.1)
Building wheels for collected packages: kiopcgenerator
Building wheel for kiopcgenerator (setup.py) ... done
Created wheel for kiopcgenerator: filename=kiopcgenerator-0.1.2-py2-none-any.whl size=8247 sha256=130954e72ef2402a5958633122a0a5617cc8d053a357ff1de1a1f39fd9f4ae3a
Stored in directory: /tmp/pip-ephem-wheel-cache-4szNSW/wheels/c3/f0/64/7c584b05b7721fc5ed9b0f5d3cc701aa6975721864264b28ca
Successfully built kiopcgenerator
Installing collected packages: kiopcgenerator
Successfully installed kiopcgenerator-0.1.2
[root@APPServer ~]# ki
kill killall5 kiopcgen
[root@APPServer ~]# kiopcgen
Traceback (most recent call last):
File "/usr/bin/kiopcgen", line 14, in
import kiopcgenerator
File "/usr/lib/python2.7/site-packages/kiopcgenerator/init.py", line 9, in
from lib import gen_ki, gen_eki, gen_opc, gen_opc_eki
File "/usr/lib/python2.7/site-packages/kiopcgenerator/lib.py", line 17, in
from card.utils import stringToByte, byteToString
ImportError: No module named card.utils
[root@APPServer ~]#

The installation is not working

sunny@sunny-XPS-15-9510:~$ sudo pip3 install git+https://github.com/PodgroupConnectivity/kiopcgenerator#egg=kiopcgenerator
[sudo] password for sunny:
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
sunny@sunny-XPS-15-9510:~$

def calc_opc_hex(self, k_hex, op_hex=None): causes an issue for some reason

I have found the above causes a problem with OPC generation. If I define a OP i.e. -o in the command line, I have fond the EoR creates and OPC using this value as if it isn't been passed in. I hacked the lib in my version, this is just a note for others. I edited the declaration and remove the assignment =0 i.e. def calc_opc_hex(self, k_hex, op_hex): ...

Hope it helps.

BR
Jerry

Add case with encrypted KI

I realized case when we have only ecrypted Ki.
first we need to decrypt Ki by K4, after that we can calculate OPC.

I can create pull request with this case

Traceback error

Dear Community,

When running the kiopc generator I am getting the following error. Please let me know what is the issue.


Traceback (most recent call last):
File "/home/ubu18_oai/.local/bin/kiopcgen", line 14, in
import kiopcgenerator
File "/home/ubu18_oai/.local/lib/python2.7/site-packages/kiopcgenerator/init.py", line 9, in
from .lib import *
File "/home/ubu18_oai/.local/lib/python2.7/site-packages/kiopcgenerator/lib.py", line 42
print(f'[DBG]calc_opc_hex: op({len(op)}) KI({len(ki)}) IV({len(iv)})')
^
SyntaxError: invalid syntax

Any help from you would be deeply appreciated. Please provide your insights.

WR,
Gokul

kiopcgen not working

I followed every step in the instruction, but when I tried to run the program and got the following error. Could you kindly help resolve this issue?
nano@nano-EPC:~/kiopcgenerator$ kiopcgen -o D7DECB1F50404CC29ECBF989FE73AFC5 -t 2257CC6E9746434B89F346F0276CCAEC
Traceback (most recent call last):
File "/usr/local/bin/kiopcgen", line 4, in
import('pkg_resources').run_script('kiopcgenerator==0.1.4', 'kiopcgen')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1429, in run_script
.format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/kiopcgen' not found in metadata at '/home/nano/.local/lib/python2.7/site-packages/kiopcgenerator-0.1.4.egg-info'

Algorithm Question

What algorithm type, rotations and constants does this use to generate OPc, Ki from OP? Is it Mileage?

kiopcgen -h kiopcgen command not working

viavi@viavi_dell:/kiopcgenerator-master$ kiopcgen -h
Traceback (most recent call last):
File "/usr/local/bin/kiopcgen", line 4, in
import('pkg_resources').run_script('kiopcgenerator==0.1.4', 'kiopcgen')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1429, in run_script
.format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/kiopcgen' not found in metadata at '/home/viavi/.local/lib/python2.7/site-packages/kiopcgenerator-0.1.4.egg-info'
viavi@viavi_dell:
/kiopcgenerator-master$ kiopcgen
Traceback (most recent call last):
File "/usr/local/bin/kiopcgen", line 4, in
import('pkg_resources').run_script('kiopcgenerator==0.1.4', 'kiopcgen')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1429, in run_script
.format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/kiopcgen' not found in metadata at '/home/viavi/.local/lib/python2.7/site-packages/kiopcgenerator-0.1.4.egg-info'
viavi@viavi_dell:/kiopcgenerator-master$ sudo kiopcgen -h
Traceback (most recent call last):
File "/usr/local/bin/kiopcgen", line 4, in
import('pkg_resources').run_script('kiopcgenerator==0.1.4', 'kiopcgen')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1429, in run_script
.format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/kiopcgen' not found in metadata at '/home/viavi/.local/lib/python2.7/site-packages/kiopcgenerator-0.1.4.egg-info'
viavi@viavi_dell:
/kiopcgenerator-master$ cd /home/viavi/.local/lib/python2.7/site-packages/
viavi@viavi_dell:/.local/lib/python2.7/site-packages$ ls -ltr
total 16
drwxrwxr-x 2 viavi viavi 4096 Jul 18 13:18 kiopcgenerator
drwxrwxr-x 2 viavi viavi 4096 Jul 18 13:18 kiopcgenerator-0.1.4.egg-info
drwxrwxr-x 12 viavi viavi 4096 Jul 18 13:23 Crypto
drwxrwxr-x 2 viavi viavi 4096 Jul 18 13:23 pycryptodome-3.9.9.dist-info
viavi@viavi_dell:
/.local/lib/python2.7/site-packages$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.