npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

imei_gencheck

v4.0.0

Published

Uses tacdb.osmocom.org TAC DB for generating and checking IMEIs and searching for TAC info.

Downloads

37

Readme

imei_gencheck

An IMEI generator and checker written for NodeJS using NPM. Uses a DB from tacdb.osmocom.org. The module exposes a class IMEI_GenCheck(sure You name it on requiring), which is to be used for constructing an actual object providing the features You can find below. Basically, the object has features for IMEI generating and checking; exposes a comfortable interface to the TAC DB, allowing to search through it. But to actually use the DB this way, You'll need to invoke loadDB() method and wait for the returned Promise to resolve with the count of rows loaded into the DB property. Enough of intro, just behold usage examples down there.

Install

To use this, NPM is needed. Read about it whereever ya willing. Usually npm install imei_gencheck must be enough. This won't depend (i hope) on anything but:

"devDependencies": {
  "chai": "^4.1.1",
  "mocha": "^3.5.0"
},
"dependencies": {
  "async": "^2.5.0",
  "checkdigit": "^1.1.1",
  "csv-parse": "^1.2.1"
}

"devDependencies" are kinda optional. You don't need them unless wanna check tested features working.

Usage

To just randomize an IMEI:

    const IMEI_GenCheck = require("imei_gencheck");
    const imeigc = new IMEI_GenCheck();

    console.log( // Should give the 15-digit id real fast
        imeigc.randomIMEI_fullRandom()
);

(this is likely to give an actually non-existent number) Here is the code to get the gencheck DB up:

    const IMEI_GenCheck = require("imei_gencheck");
    const imeigc = new IMEI_GenCheck();

    imeigc.loadDB()
    .then(rowsCount=>{
        console.log(rowsCount); // Sure no actual need for this, just a way to test that all gone well.
    });
    console.log(
      // Fully randomize an IMEI using a random TAC. Takes like zero time so not async.
      imeigc.randomIMEI_TACfromDB()
    );
    imeigc.randomTACInfoWithNames("Apple", "iPhone 7 Plus")
    .then(tacinfo=>{ // This involves a search in DB (which i didn't optimize (yet?) at all), so it's async:
        console.log(
            imeigc.randomIMEIwithTAC(tacinfo.tac) // Should be 35381208xxxxxxx
        );
    });

And with the 3.1 here came a possibility to search by fields set: findTACInfoByFields

const searchObj = {name1: "Nokia", aka:"1112b"};
const strictSearch = false; // Searching with string's indexOf() method
// FALSE is the default value. With TRUE the search will use === operator
// (will perform toLowerCase() anyway tho)

imeigc.loadDB()
.then(rowcount  => imeigc.findTACInfoByFields(searchObj, strictSearch))
.then(foundTACs => console.log(foundTACs.length));

Data

In the folder "data" there is the DB used by the code. When it gets loaded, it is put into an array

    imeigc.DB

And here is how the data from each .csv row is stored in the objects inside the array:

    let newTACinfo = {
        "tac":          line[0],
        "name1":        line[1],
        "name2":        line[2],
        "comment":      line[3],
        "gsmarena1":    line[5],
        "gsmarena2":    line[6],
        "aka":          line[7],
        "type":         ""      // Yep, there is no Type in the DB so far.
    };

To load from some other .csv file (which is now supported through a constructor parameter), You'll need to arrange the data accordingly or to change that code in index.js.

Features

You can read the tests code in the file inside "test" directory. It pretty much sums up the possibilities and provides usage examples.

As of 4.0 (Not very much new from 1.0.0, though not compatible with that already): Not an image of Yaktocat!