September 24, 2011

ESN to IP converter script


VBScript code to convert Electronic Serial Number to IP Address, useful if you don't know your SM IP address (10 Series) .


Dim iHex(11)
strHex = InputBox("Enter Canopy E S N" & String(4,chr(10)) & "Ex: 0A003EFF04B5", "ESN Converter")
if Len(strHex) = 12 then
Set objRE = New RegExp

With objRE
.Pattern = "[^a-f0-9]"
.IgnoreCase = True
.Global = False
End With


If objRE.Test(strHex) Then
MsgBox("Invalid E S N")
Else
For i=1 To 11 Step 2
iHex("" & i & "") = CLng("&H" & Mid(strHex,i,2))
Next
MsgBox("Canopy IP Address" & String(2,chr(10)) & iHex(1) & ":" & iHex(7) & ":" & iHex(9) & ":" & iHex(11))

End If
Set objRE = Nothing

Else if IsEmpty(strHex) = 0 then MsgBox("Invalid E S N Length")
End if

0 comments:

Post a Comment