imei

package
v0.743.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package imei decodes and validates a GSM device identity — the 15-digit IMEI (with its Luhn check digit) and the 16-digit IMEISV (software-version variant). It is the offline complement to the cellular tooling: an IMEI is disclosed in a GSM/LTE Identity Response (the message an IMSI-catcher forces to deanonymise a handset, visible in a gsmtap capture), so an identity read off the air can be validated and broken down here.

Wrap-vs-native judgement

Native. The IMEI structure (8-digit Type Allocation Code + 6-digit serial + 1 Luhn check digit, per 3GPP TS 23.003) and the Luhn algorithm are public, fixed specs — pure arithmetic over a digit string. There is nothing to wrap.

Verifiable / no confidently-wrong output

The Luhn check digit is the verification anchor: it is recomputed from the first 14 digits and compared to the 15th. A mismatch is reported as luhn_valid=false with a note, not asserted as a definitively fake device (a mistyped digit also fails it). The IMEISV form carries a software version in place of the check digit and so is not Luhn-checked — it is labelled as such. The Type Allocation Code is surfaced raw, including its leading Reporting Body Identifier: the TAC-to-manufacturer/model registry (the GSMA database) is large and not public in full, so a manufacturer or model is deliberately NOT guessed.

Covered / deferred

Covered: IMEI vs IMEISV discrimination by length, the Luhn validation, and the structural split (TAC / RBI / serial / check or SVN). Deferred: the TAC-to-device lookup (proprietary GSMA data) and any IMSI/TMSI decoding (different identifiers, no check digit).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Type               string   `json:"type"` // "IMEI" or "IMEISV"
	Number             string   `json:"number"`
	TAC                string   `json:"tac"` // Type Allocation Code (digits 1-8)
	ReportingBodyID    string   `json:"reporting_body_id"`
	SerialNumber       string   `json:"serial_number"`         // digits 9-14
	CheckDigit         string   `json:"check_digit,omitempty"` // IMEI only
	CheckDigitComputed string   `json:"check_digit_computed,omitempty"`
	LuhnValid          bool     `json:"luhn_valid,omitempty"`
	SoftwareVersion    string   `json:"software_version,omitempty"` // IMEISV only
	Notes              []string `json:"notes,omitempty"`
}

Result is the decoded view of a GSM device identity.

func Decode

func Decode(raw string) (*Result, error)

Decode validates and breaks down an IMEI (15 digits) or IMEISV (16 digits).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL