Mayayana

2018-02-16 01:09:21 UTC

I don't know if anyone's interested in this, but

maybe. I don't like to enable script in the browser.

Yet thousands of websites use a specific javascript

to encode email addresses, usually making them

invisible unless one enables script. The decoder

is called decode-email.min.js. It's not just the typical

hex ASCII values. It uses an extra twist, converting

the ASCII values for letters to hex representations

of that number XOR-ed.

I got tired of not being able to find someone's

email, so I wrote a little desktop decoder script.

I also wrote an encoder. The encoder below will

accept ***@somewhere.com53 and return:

35465A58505A5B5075465A5850425D5047501B565A58

That string will be converted back by the decoder.

The 53 is random. It just requires any byte-value

numeric key to do the encoding. The decoder doesn't

need to know it because the encoded string starts

with the key. (H35 = decimal 53)

'----------- begin decoder script ---------------------------

' Script to do the job of email-decode.min.js. This script is used

' on many sites to obfuscate email addresses. The email will be encoded

' as a very long string of characters. Each 2 characters represent a

' hex code, but the first two are a key. That key is then XOR-ed with

' each following pair to get the email characters.

' Example:

' s = "523b3c343d" 'decimal: 82 59 60 52 61

'82 XOR 59 = 105 = i

'82 XOR 60 = 110 = n

'82 XOR 52 = 102 = f

'82 XOR 61 = 111 = o

' s decoded = "info"

s = InputBox("Enter encrypted email address text to decode. This script

works to replace email-decode.min.js, which is used on thousands of

websites.", "Decode email address")

If Len(s) = 0 Then WScript.quit

sRet = InputBox("Decrypted email:", "Decode email address", EmailDecode(s))

WScript.quit

Function EmailDecode(sIn)

Dim iKey, iPos, s2, iVal

iKey = CByte("&H" & Left(sIn, 2)) 'get they XOR key.

iPos = 3

Do While iPos <= Len(sIn)

' get each character pair, treat as hex code and convert to

decimal.

' XOR each with the key value, then treat that as an ASCII

character code and

' convert to character.

s2 = Mid(sIn, iPos, 2)

iVal = cbyte("&H" & s2)

EmailDecode = EmailDecode & Chr(iVal XOR iKey)

iPos = iPos + 2

Loop

End Function

'---------------------- begin encoder script ---------

Dim s, sEmail, sKey, s2, i, iKey, iVal

s = InputBox("Enter email address to encode. Follow that with a 2-digit key

for encoding", "Email address encoder")

If Len(s) = 0 Then WScript.quit

On Error Resume Next

s = Replace(s, " ", "")

sEmail = Left(s, len(s) - 2)

sKey = Right(s, 2)

iKey = cbyte(sKey)

If Err.number <> 0 Then

MsgBox "Error in entering email and encryption key."

WScript.Quit

End If

s2 = Hex(iKey)

For i = 1 to Len(sEmail)

iVal = Asc(Mid(sEmail, i, 1))

iVal = iVal XOR iKey

s2 = s2 & Hex(iVal)

Next

s = InputBox("Encoded email address:", "Encode email address", s2)

WScript.quit

maybe. I don't like to enable script in the browser.

Yet thousands of websites use a specific javascript

to encode email addresses, usually making them

invisible unless one enables script. The decoder

is called decode-email.min.js. It's not just the typical

hex ASCII values. It uses an extra twist, converting

the ASCII values for letters to hex representations

of that number XOR-ed.

I got tired of not being able to find someone's

email, so I wrote a little desktop decoder script.

I also wrote an encoder. The encoder below will

accept ***@somewhere.com53 and return:

35465A58505A5B5075465A5850425D5047501B565A58

That string will be converted back by the decoder.

The 53 is random. It just requires any byte-value

numeric key to do the encoding. The decoder doesn't

need to know it because the encoded string starts

with the key. (H35 = decimal 53)

'----------- begin decoder script ---------------------------

' Script to do the job of email-decode.min.js. This script is used

' on many sites to obfuscate email addresses. The email will be encoded

' as a very long string of characters. Each 2 characters represent a

' hex code, but the first two are a key. That key is then XOR-ed with

' each following pair to get the email characters.

' Example:

' s = "523b3c343d" 'decimal: 82 59 60 52 61

'82 XOR 59 = 105 = i

'82 XOR 60 = 110 = n

'82 XOR 52 = 102 = f

'82 XOR 61 = 111 = o

' s decoded = "info"

s = InputBox("Enter encrypted email address text to decode. This script

works to replace email-decode.min.js, which is used on thousands of

websites.", "Decode email address")

If Len(s) = 0 Then WScript.quit

sRet = InputBox("Decrypted email:", "Decode email address", EmailDecode(s))

WScript.quit

Function EmailDecode(sIn)

Dim iKey, iPos, s2, iVal

iKey = CByte("&H" & Left(sIn, 2)) 'get they XOR key.

iPos = 3

Do While iPos <= Len(sIn)

' get each character pair, treat as hex code and convert to

decimal.

' XOR each with the key value, then treat that as an ASCII

character code and

' convert to character.

s2 = Mid(sIn, iPos, 2)

iVal = cbyte("&H" & s2)

EmailDecode = EmailDecode & Chr(iVal XOR iKey)

iPos = iPos + 2

Loop

End Function

'---------------------- begin encoder script ---------

Dim s, sEmail, sKey, s2, i, iKey, iVal

s = InputBox("Enter email address to encode. Follow that with a 2-digit key

for encoding", "Email address encoder")

If Len(s) = 0 Then WScript.quit

On Error Resume Next

s = Replace(s, " ", "")

sEmail = Left(s, len(s) - 2)

sKey = Right(s, 2)

iKey = cbyte(sKey)

If Err.number <> 0 Then

MsgBox "Error in entering email and encryption key."

WScript.Quit

End If

s2 = Hex(iKey)

For i = 1 to Len(sEmail)

iVal = Asc(Mid(sEmail, i, 1))

iVal = iVal XOR iKey

s2 = s2 & Hex(iVal)

Next

s = InputBox("Encoded email address:", "Encode email address", s2)

WScript.quit