Данная функция позволяет декодировать email с веб-страницы, когда на сервере используется Cloudflare Email Protection
Function CloudfareEmailDecode(ByVal txt$) As String ' функция декодирования
On Error Resume Next
If InStr(1, txt, "protection#", vbTextCompare) > 0 Then txt = Split(txt, "protection#")(1)
If InStr(1, txt, """", vbTextCompare) > 0 Then txt = Split(txt, """")(0)
If InStr(1, txt, "'", vbTextCompare) > 0 Then txt = Split(txt, "'")(0)
Dim k As Integer, i As Long, l As Integer
k = Val("&h" & Mid(txt, 1, 2))
For i = 1 To Len(txt) / 2 - 1
l = Val("&h" & Mid(txt, i * 2 + 1, 2))
CloudfareEmailDecode = CloudfareEmailDecode & Chr(l Xor k)
Next
End Function
Sub test_CloudfareEmailDecode() ' пример использования
Debug.Print CloudfareEmailDecode("c9a6afafa0aaace7a4b9b389a4bdbce4a7acbde7bbbc")
Debug.Print CloudfareEmailDecode("543931142127353935313e352e7a373b39")
Debug.Print CloudfareEmailDecode("dfafadb6bdb0ad9fbcb6aba6b3b6b1baf1adaa")
End Sub
- Добавить комментарий
- Задать вопрос разработчику на почту
- 2.108 просмотров