Extracting Hardware Serial Numbers Over LAN: UPnP, CSTECGI, and SNMP Across Telco Router Vendors
How the BBTech WiFi Router Diagnostic Tool extracts authentic factory serial numbers directly over an Ethernet connection without an external barcode scanner, handling Kaon, Huawei, and TP-Link routers.
The floor bottleneck: thousands of barcode sticker scans
On high-volume telco router refurbishment lines, every returned unit must be checked, tested, and logged. Historically, technicians used handheld optical barcode guns to scan the tiny serial barcode printed on the physical router label sticker.
In production, physical labels present frequent failure modes: stickers are scratched, faded by heat, peeled off by subscribers, or obstructed by mounting brackets. Technicians spent minutes manually squinting at microscopic printed serials or typing 16-character alphanumeric strings by hand. To automate this, we built automated LAN serial extraction directly into the BBTech WiFi Router Diagnostic Tool.
The discovery hierarchy: locating unconfigured routers
Before querying a router for its serial, the computer must find its IP address. When factory-reset routers arrive on the bench, DHCP is frequently disabled or slow to negotiate, leaving the technician's laptop on an APIPA self-assigned address (169.254.x.x).
The diagnostic tool executes a multi-tiered discovery hierarchy without silently mutating global Windows network settings:
- 01Check active default gateway assigned by DHCP
- 02If no gateway, query active Win32 ARP cache via LocalArp P/Invoke (SendARP)
- 03Send SSDP M-SEARCH multicast discovery over UDP port 1900
- 04If on APIPA (169.254.x.x), probe known candidate gateways (192.168.1.254, 192.168.1.1, 192.168.0.1)
- 05Display temporary subnet bridge banner proposing one-click static IP assignment
Vendor-specific extraction protocols
Consumer and ISP routers run diverse proprietary firmware stacks. The diagnostic engine implements model-tailored retrieval handlers:
| Router Vendor / Model | Primary Extraction Channel | Fallback Channel | Expected Format |
|---|---|---|---|
| KAON Broadband (AR2140) | UPnP Device Description XML (/rootDesc.xml) | CSTECGI HTTP RPC (/cgi-bin/cstecgi.cgi) | KAON2140 prefix + 8–12 chars |
| Huawei EchoLife / OptiXstar ONTs | HTTP ASP device info (/deviceinfo.asp, OntSN) | SNMP v2c MIB queries (1.3.6.1.2.1.1.1.0) | HWTC prefix or hex 48575443 |
| TP-Link (EX510, Archer AX20) | UPnP WANIPConnection service XML | Unauthenticated HTTP status API | 13-character alphanumeric string |
For Kaon AR2140 routers, UPnP root description XML exposes the manufacturer serial tag <serialNumber> directly to unauthenticated queries on port 80 or 1900. For Huawei GPON ONTs, parsing unauthenticated javascript variables (var OntSN = 'HWTC...';) in the initial login redirection frame yields the hardware serial before authentication challenges occur.
Strict validation and non-guessing policy
A diagnostic tool on a high-throughput line must never guess. If a query returns a placeholder, recording it corrupts inventory records.
The engine applies a strict validation filter: it rejects MAC addresses (both delimited 00:1B:9E... and raw hex), IP addresses, model strings (AR2140), repeated dummy characters (00000000, XXXXXXXX), sequential numbers (12345678), and generic placeholders (UNKNOWN, N/A). Exact alphanumeric casing is preserved.
Automated test suite and physical validation
The serial extraction engine is verified by **84 automated assertions** across two PowerShell test suites, simulating mock UPnP XML endpoints, HTML payloads, router replacement generation tokens, and credential redaction. It eliminates manual barcode hunting for supported models while preserving complete operator oversight.
Keep reading
What an IT Systems Role Actually Involves
A grounded look at what IT systems work covers day to day, beyond the narrow idea of fixing computers.
Common Problems in Manual Production Tracking With Spreadsheets
The specific ways spreadsheet-based production tracking breaks down in practice, the tell that says it is time to move, and what a replacement has to remove.
Staged CSV Import: Validating Operational Data Before It Is Written
The office already keeps its records in a workbook. Importing that sheet into a production system means matching its headers loosely, reading its dates the way it wrote them, surfacing duplicates before anything is saved, and never letting the client tell the server what a file contains.