Wednesday, November 2, 2016

IMEI processing in Python

IMEI processing in Python


Today I used one of our systems (made by our command) and entered new device configuration. Our system blocked my input and said me that my input is incorrect.

I was surprised because I forgot about these checking. Then I remembered that few time I made class for IMEI processing.

I hope that it can be useful for someone else. So, you can use in your projects.


 

You can find source here: https://github.com/JFF-Bohdan/pyimei


This class can make IMEI validation, processing both string and number representation of IMEI. And also can generate fake IMEI and fake IMEI sequences.

This source code is a result of my investigations about IMEI validation and processing and compiles pieces of source code found by me in Internet.

Complete example can be found in file test.py 

Example output:

IMEI: '356938035643809' is valid
IMEI: '490154203237518' is valid
IMEI: '356938035643809' is valid
IMEI '358065019104263' is NOT valid
IMEI '357805023984941' is NOT valid
IMEI '356938035643801' is NOT valid
Generating independent FAKE imeis...
        fake IMEI[1] = 5024134832663410
        fake IMEI[2] = 3450839040461431
        fake IMEI[3] = 7936225128534031
        fake IMEI[4] = 4996190596077442
        fake IMEI[5] = 4886510570114408
Generating sequental FAKE imeis:
start IMEI: 1277348215303464
        fake IMEI[1] = 1277348215303474
        fake IMEI[2] = 1277348215303484
        fake IMEI[3] = 1277348215303494
        fake IMEI[4] = 1277348215303501
        fake IMEI[5] = 1277348215303511
DONE


Here I validated some IMEIs for correction then generated independent IMEIs and sequental IMEIs.


Hope you like it.

Enjoy!

No comments:

Post a Comment