OTA PACKET PARSER: Difference between revisions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
<style> | <style> | ||
body { font-family: Arial, sans-serif; padding: 20px; } | body { font-family: Arial, sans-serif; padding: 20px; } | ||
textarea { width: 100%; height: 100px; font-family: monospace; } | textarea { width: 100%; height: 100px; font-family: monospace; margin-bottom: 10px; } | ||
button { | button { | ||
padding: 10px 20px; border-radius: 20px; | padding: 10px 20px; border-radius: 20px; | ||
| Line 21: | Line 21: | ||
<h2>OTA Packet Parser</h2> | <h2>OTA Packet Parser</h2> | ||
<textarea id="hexInput" placeholder="Paste OTA packet hex here..."></textarea><br> | <textarea id="hexInput" placeholder="Paste OTA packet hex here..."></textarea><br> | ||
<button | <button onclick="parseOTAPacket()">Parse OTA Packet</button> | ||
<h3>Parsed Output:</h3> | <h3>Parsed Output:</h3> | ||
| Line 53: | Line 53: | ||
} | } | ||
function parseIMEIFromHex(hex | function parseIMEIFromHex(hex) { | ||
const imeiHex = hex.slice(6, 22); // 8 bytes = 16 hex characters = bits 24–74 | |||
const imeiHex = hex.slice( | |||
let imei = ''; | let imei = ''; | ||
for (let i = 0; i < imeiHex.length; i += 2) { | for (let i = 0; i < imeiHex.length; i += 2) { | ||
const byte = imeiHex.slice(i, i + 2); | const byte = parseInt(imeiHex.slice(i, i + 2), 16); | ||
imei += ((byte >> 4) & 0x0F).toString() + (byte & 0x0F).toString(); | |||
} | } | ||
return imei.replace(/^0+/, ''); | return imei.replace(/^0+/, ''); | ||
| Line 85: | Line 81: | ||
}; | }; | ||
// | // Fields | ||
output("IMEI", parseIMEIFromHex(hex)); | |||
output("IMEI", | |||
output("Packet Type", bitsToInt(getBits(75, 80))); | output("Packet Type", bitsToInt(getBits(75, 80))); | ||
output("OTA Source", bitsToInt(getBits(80, 85))); | output("OTA Source", bitsToInt(getBits(80, 85))); | ||
| Line 125: | Line 119: | ||
output("Response", bitsToAscii(respBits)); | output("Response", bitsToAscii(respBits)); | ||
} | } | ||
</script> | |||
</body> | </body> | ||
</html> | </html> | ||
Revision as of 09:44, 21 July 2025
OTA Packet Parser
Parsed Output:
| Field | Value |
|---|