IT박스

웹 사이트에서 전자 메일 주소를 난독 처리하는 가장 좋은 방법은 무엇입니까?

itboxs 2020. 6. 30. 20:59
반응형

웹 사이트에서 전자 메일 주소를 난독 처리하는 가장 좋은 방법은 무엇입니까?


지난 며칠 동안 개인 웹 사이트를 업데이트하는 데 시간을 보냈습니다. 내 개인 웹 사이트의 URL은 (내 이름). (내 성) .com이며, 성은 다소 이례적이며 도메인 이름을 선택할 수있을만큼 운이 좋았습니다. 내 이메일 주소는 (내 이름) @ (내 성) .com입니다. 실제로 추측 할 때 그리 어렵지 않습니다.

어쨌든, mailto : 링크를 내 웹 사이트에 통합하여 사람들이 저에게 연락 할 수 있도록하고 싶습니다. 그리고 내 전자 메일 주소를 추측하기가 어렵지 않지만 웹 사이트를 전자 메일 주소 패턴으로 크롤링하여 데이터베이스에 추가하는 스팸 봇이 수집하지는 않습니다.

링크 형식으로 전자 메일 주소를 난독 처리하는 가장 좋은 방법은 무엇입니까? 내가 아는 방법은 다음과 같습니다.

<a href="mailto:x@y.com">e-mail me</a>

작동하지만 웹 사이트가 Google을 방문하자마자 스팸 봇이 쉽게 전자 메일 주소를 선택하므로 스팸을 피할 수 있습니다.

<img src="images/e-mail.png" />

방문자가 전자 메일을 보내기 위해 전자 메일을 클릭 할 수 없을뿐만 아니라 더 스마트 한 스팸봇이 이미지에 포함 된 문자를 감지 할 수 있기 때문에 이는 바람직하지 않습니다.

나는 완벽한 해결책이 없을 것임을 알고 있지만 모든 사람들이 가장 잘 생각한 것이 궁금합니다. 내 웹 사이트에서 이미 많은 톤을 사용하므로 필요한 경우 JavaScript를 사용하려고합니다.


나는 문자를 HTML 엔티티 ( 이와 같은 것으로) 로 인코딩합니다 . JS를 활성화 할 필요가 없으며 대부분의 스팸을 중지 한 것으로 보입니다. 나는 똑똑한 봇이 여전히 그것을 수확한다고 생각하지만 아무런 문제가 없었습니다.


개인적으로 이메일 주소를 숨기는 것을 포기했습니다. 난독 처리에 대한 걱정보다 더 나은 스팸 필터링 솔루션을 찾는 것이 더 쉽다는 것을 알게되었습니다. 주소를 난독 처리하는 가장 좋은 방법을 찾으려고 며칠을 보낼 수 있으며 한 사람이 주소를 스패머에게 판매하기 만하면 모든 작업이 쓸모가 없습니다.


현재 허용되는 솔루션은 사용자가 이메일을 보낼 수있는 연락처 양식을 작성하는 것입니다. 그 사이트에서 스팸을 많이받는 경우 (내 사이트에 없음) 적절한 보안을 위해 보안 문자를 추가 할 수 있으며 그 시점에서 "매우 낮은 성과"에서 멀어 질 것입니다.

문제는 사용자가 클릭하여 To : 필드에 이메일 클라이언트를 열 수있는 링크를 제공하면 컴퓨터가 페이지에서 이메일 주소를 해독 할 수 있다는 것입니다. 스팸 봇.


당신은 이것이 당신의 개인 웹 사이트를위한 것이라고 언급했습니다. 내 개인 사이트 (예 : bobsomers.com)에는 다음과 같은 단락이 있습니다.

새 사이트가 운영되기 전에 연락을 취하는 가장 좋은 방법은 이메일을 보내는 것입니다. 내 이메일 주소는이 웹 사이트의 이름입니다. 당신이 그 힌트에서 그것을 알아낼 수 없다면 글쎄, 당신은 내 주소를 알아내는 것보다 더 많은 도전을 이메일을 찾을 수 있습니다.

내가 항상 합법적 인 이메일을받을 때 사람들은 그것을 잘 알아낼 수있을 것 같습니다. 때로는 최상의 솔루션으로 코드를 작성할 필요가 없습니다. :)


reCAPTCHA 는 간단한 이메일 난독 처리 서비스를 제공 합니다. 계정을 설정할 필요가 없으며 즉시 사용할 수 있습니다. 서비스를 링크 또는 팝업으로 사용할 수 있습니다.

보안 문자가 해결되면 이메일 주소가 href / mailto로 표시되므로 이메일 클라이언트가 브라우저를 사용하도록 구성한 사용자가 클릭 / 팔로우 할 수 있습니다.


분명히 CSS를 사용하여 텍스트 방향을 변경하면 효과가 있습니다. 이 링크에는 다른 난독 화 방법에 대한 테스트도 있습니다.

무엇을 사용하든 불가피하게 패배 할 것입니다. 기본 목표는 사용자의 성가심을 피하는 것입니다.


href앵커 를 난독 처리하는 간단한 방법 은 앵커를 base64로 인코딩하는 것입니다.

> btoa('mailto:email@example.com')
< "bWFpbHRvOmVtYWlsQGV4YW1wbGUuY29t"

그런 다음 하드 코딩 된 것을 포함하십시오.

<a href="javascript:window.location.href=atob('bWFpbHRvOmVtYWlsQGV4YW1wbGUuY29t')">E-Mail</a>

또는 PHP에서 동적으로 서버 측 :

<a href="javascript:window.location.href=atob('<?= base64_encode("mailto:email@example.com") ?>')">E-Mail</a>

문자열 복귀와 함께 사용하면 꽤 스팸을 저장할 수 있습니다.

<a href="javascript:window.location.href=atob('<?= base64_encode("mailto:email@example.com") ?>')" style="unicode-bidi: bidi-override; direction: rtl;"><?= strrev("email@example.com") ?></a>

전자 메일 수집기가 사람들이 전자 메일을 난독 처리하는 방법을 찾는 첫 번째 장소이므로 여기에서 난독 처리 기술을 사용하지 마십시오. 사이트에 전자 메일 주소를 표시해야하는 경우 다른 사람의 방법을 그대로 복사하지 마십시오. 다른 사이트에서 사용하지 않은 독특한 방식으로 그것을 난독 처리하여 수확기가 사이트를 방문하기 전에 수확기에게 알려지지 않도록하십시오.


Google 코드 및 그룹에서 Google이하는 것처럼 할 수 있습니다. 이메일과 클릭 가능한 부분 ( "...")을 표시합니다. 을 클릭하면 이메일을 알고 싶다는 것을 나타내며 보안 문자를 입력하라는 메시지가 표시됩니다. 그 후 이메일 (및 기타)이 표시됩니다.


광산은 실제로 간단합니다.

<h3 id="email">hello@gmail.com</h3><!-- add a fake email -->


    $(document).ready(function(){
//my email in reverse :)
            var s = 'moc.elibomajninbew@htiek';
            var e = s.split("").reverse().join("");
            $('#email').html('<a href="mailto:'+e+'">'+e+'</a>');
    });

JavaScript 난독 화를 사용하고 예를 들어보십시오.

http://www.jottings.com/obfuscator/


내가 관리하는 한 웹 사이트는 스팸봇을 막기위한 다소 간단한 JavaScript 수단을 사용합니다.

이메일 링크는 JS 함수를 호출합니다.

sendEmail (이름, 도메인) {
    location.href = 'mailto :'+ 이름 + '@'+ 도메인;
}

JS를 활성화 한 사용자 만 링크를 볼 수 있도록하려면 다음과 같이 작성하십시오.

writeEmailLink 함수 (실명, 이름, 도메인) {
    document.write ( '<a href = "javascript : sendEmail (\' '
      + 이름 + '\', \ ''+ 도메인 + '\') "> ');
    document.write (realName);
    document.write ( '</a>');
}   

하나의 JS 함수를 사용하여 다른 것을 호출하는 링크를 작성한다는 것은 두 개의 보호 계층이 있음을 의미합니다.


위의 포스터에서 말했듯jottings 웹 사이트의 JavaScript 난독 처리도 사용 합니다.

웹 페이지는 개선 될 수있는 일부 JavaScript를 생성합니다. mailto:텍스트 문자열에있는 명확하고 (이 자리와이 문자열의 혼란을 제거 할 수있는)하지만, 하나는 양식의 jottings.com 웹 페이지의 이메일 주소로 입력하면 로봇에 의해 식별 mailto:addr@site.tld대신에 addr@site.tld다음 텍스트를 제거mailto:생성 된 JavaScript에서 갑자기 웹 사이트가 가득 찬 임의의 JavaScript 인 전자 메일과 전혀 관련이없는 것처럼 보이는 JavaScript가 갑자기 있습니다. 링크 텍스트를 제거하여이 기능을 한층 더 향상시킬 수 있습니다. 필자는 상당히 불분명 한 글꼴로 된 전자 메일 주소 이미지로 교체했습니다. 그런 다음 jottings.com의이 메소드가 널리 사용되는 경우, 출력 JavaScript에서 변수 이름을 무작위 화하여 로봇이 생성 된 JavaScript 코드의 인스턴스를 찾기가 어려워졌습니다.

분명히 이러한 개선 중 일부는 jotting 자체에 대한 메커니즘에 내장 될 수 있으며, 코드가 공개적으로 사용 가능하기 때문에 비교적 쉽습니다.

예를 들어 이것을 좀 더 명확하게 만들 수 있습니다. 나는 모호하게 위의 링크에서 Jottings 난독을 사용 mailto:foo@bar.com(I 문자열을 입력하여 jottings 웹 사이트의 원래 의도에 부정하고 노트 mailto:foo@bar.com대신 foo@bar.com이 자바 스크립트로 전환하는 jottings, "내게 이메일 보내기"텍스트를)

<script type="text/javascript" language="javascript">
<!--
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
{ coded = "3A1OTJ:rJJ@VAK.GJ3"
  key = "J0K94NR2SXLupIGqVwt8EZlhznemfaPjs7QvTB6iOyWYo3rAk5FHMdxCg1cDbU"
  shift=coded.length
  link=""
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i)
      link += (ltr)
    }
    else { 
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length
      link += (key.charAt(ltr))
    }
  }
document.write("<a href='mailto:"+link+"'>Send Me Email</a>")
}
//-->
</script><noscript>Sorry, you need Javascript on to email me.</noscript>

다시 가져 와서 편집기에 붙여 넣고 다음을 수행하십시오.

  1. 제거 mailto:
  2. 내 이메일 주소 이미지에 대한 링크 텍스트를 포인터로 바꿉니다.
  3. 모든 변수의 이름을 바꿉니다
  4. "noscript"섹션을 이메일 주소 이미지에 대한 다른 링크로 바꿉니다.

나는 이것으로 끝납니다 :

<script type="text/javascript" language="javascript">
<!--
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption kkeoy feature by Andrew Moulden, Site Engineering Ltd
// This kudzu is freeware provided these four comment lines remain intact
// A wizard to generate this kudzu is at http://www.jottings.com/obfuscator/
{ kudzu = "3A1OTJ:rJJ@VAK.GJ3"
  kkeoy = "J0K94NR2SXLupIGqVwt8EZlhznemfaPjs7QvTB6iOyWYo3rAk5FHMdxCg1cDbU"
  shift=kudzu.length
  klonk=""
  for (variter=0; variter<kudzu.length; variter++) {
    if (kkeoy.indexOf(kudzu.charAt(variter))==-1) {
      lutu = kudzu.charAt(variter)
      klonk += (lutu)
    }
    else {
      lutu = (kkeoy.indexOf(kudzu.charAt(variter))-shift+kkeoy.length) % kkeoy.length
      klonk += (kkeoy.charAt(lutu))
    }
  }
document.write("<a href='"+klonk+"'><img src='contactaddressimage.png' alt='Send Me Email' border='0' height='62' width='240'></a>")
}
//-->
</script>
<noscript>
    <img src="contactaddressimage.png" border="0" height="62" width="240">
    <font face="Arial" size="3"><br>&nbsp;</font></p>
</noscript>

나는 이것이 잘 작동하지 않습니다. 페이지로드가 완료되면 이메일 주소를 그대로두고 AJAX 호출을 사용하여로드 할 수 없습니다. 스팸 봇이 변경된 HTML을 선택할 수 있는지 또는 다른 HTTP 트래픽을 수신하여 전자 메일 주소를 선택하여 전자 메일 주소를 선택하거나 페이지를 처음 수신했을 때 페이지를 스캔하는 것이 영리한지 확실하지 않습니다.


한 사람이 한 페이지에 전자 메일 주소를 표시하는 9 가지 방법을 테스트 한 다음 자신의 블로그에 결과 를 게시했습니다.

그의 세 가지 가장 좋은 방법은 다음과 같습니다.

  1. CSS로 코드 방향 변경
  2. CSS 표시 사용
  3. ROT13 암호화

주의 사항-이것은 2 년 전에 게시되었습니다. 스팸 봇이 더 똑똑해 졌을 수 있습니다.


PHP로 작업하면 자동으로 수행하는 무료 스크립트를 얻을 수 있습니다. "Private Daddy"라고하며 자체 온라인 오디오 스트리밍 서비스에 사용합니다. 한 줄의 코드로 상자에서 작동합니다 ... 여기에서 가져올 수 있습니다


또 다른 방법은 JavaScript 프레임 워크를 사용하고 데이터 / 모델을 HTML 요소에 바인딩하는 것입니다. AngularJS의 경우 HTML 요소는 다음과 같이 작성됩니다.

<a href="mailto:{{contactEmail}}"><span>{{contactEmail}}</span></a>

보간 {{data}} 바인딩은 실제 이메일 값이 포함 된 범위 변수를 사용합니다. 또한 다음과 같이 전자 메일의 디코딩을 처리하는 필터를 사용할 수도 있습니다.

<a href="mailto:{{contactEmail | decode}}"><span>{{contactEmail | decode}}</span></a>

이점은 HTML 작성 방식에 있습니다. 단점은 스크립팅 지원이 필요하다는 것입니다.

또 다른 접근법.


Ajax 통화 솔루션

모든 로봇이 매일 더 지능적이기 때문에 웹 사이트에 양식을 작성하고 전자 메일 주소를 표시하지 않는 것이 가장 좋습니다.하지만 웹 사이트에 전자 메일 주소를 표시 해야하는 경우 웹 사이트에서 ajax 전화로 만들 수 있습니다 클릭하고 클릭하십시오.

HTML

<a class="obfmail" href="#" rel="info">click here to show email address</a>

또는

<a class="obfmail" href="#" rel="info">
    <img src="img/click-to-show-email.jpg">
</a>

jQuery

$(document).one'click', '.obfmail', function(e) {
    e.preventDefault();
    a = $(this);
    addr = a.attr('rel');
    $.ajax({
        data: { 
            email: addr
        },
        url : "/a/getemail",
        type: "POST",
        dataType: 'json',
        success: function(data) {
            a.html(data.addr);
            a.attr('href', 'mailto:' + data.addr);
        }
    });
});

PHP

if($_POST['email']) {
    ...
    return json_encode(array(
        code     => '200',
        response => 'success',
        addr     => 'info@domain.ltd'
    ));
}

더 보안을 위해, 당신은 변경할 수 있습니다 .on에 의해 .one이 같은 $(document).one('click', '.obfmail', function(e) {당신이 아약스 통화 데이터로 전달할 것을 토큰을 생성 또는 PHP와도 일이 같은 아약스 기능의 하나의 호출을 적용합니다 :

html : <a class="obfmail" href="#" rel="info" token="w3487ghdr6rc">

jquery :

...
addr = a.attr('rel');
tkn  = a.attr('token');
$.ajax({
    data: { 
        email: addr,
        token: tkn
    }, ...

.

반환 된 이메일 주소도 인코딩하거나 뒤집을 수 있습니다.

.

전화 번호에서도 잘 작동합니다!


Honestly, your problem may be moot if you asked the question of whether or not a mailto is really what you want to use. A lot of people who use web mail, for example, or do not have the proper mail client setup in their browser are not going to benefit from a mailto. You are exposing your email address for a function that isn't going to work for a large portion of your users.

What you could do instead is use a form to send the e-mail behind the scenes so that the e-mail address is hidden and you don't have to worry about the poor saps who won't benefit from a mailto.


If you say on your site that "My e-mail address is (my first name)@(my last name).com.", and your first name and last name are pretty darn obvious, that seems to be the best spam protection you're going to get.


If anyone's using Rails, they can use the actionview-encoded_mail_to gem. (https://github.com/reed/actionview-encoded_mail_to)

There are a few options:

:encode - This key will accept the strings "javascript" or "hex". Passing "javascript" will dynamically create and encode the mailto link then eval it into the DOM of the page. This method will not show the link on the page if the user has JavaScript disabled. Passing "hex" will hex encode the email_address before outputting the mailto link.

:replace_at - When the link name isn't provided, the email_address is used for the link label. You can use this option to obfuscate the email_address by substituting the @ sign with the string given as the value.

:replace_dot - When the link name isn't provided, the email_address is used for the link label. You can use this option to obfuscate the email_address by substituting the . in the email with the string given as the value.


<!-- Multi-Email Obfuscator  -->
<!-- step 1: &#064; = @  -->
<!-- step 2: a scrap element  -->
<!-- step 3: ROT13 encode for .com  -->
info<!-- step 1 -->&#064;<!-- step 2 --><b style="display:none">my</b>domain<!-- step 3 --><script>document.write(".pbz".replace(/[a-zA-Z]/g,function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));</script>

Using JQuery, but can easily be ported to plain JS if needed. Will take the following HTML block. This example I provided is also for tel: links for phone calls.

<a class="obfuscate" 
 href="mailto:archie...trajano...net">
 archie...trajano...net
</a>
<a class="obfuscate"
 href="tel:+One FourOneSix-EightFiveSix-SixSixFiveFive">
 FourOneSix-EightFiveSix-SixSixFiveFive
</a>

and convert it to the proper links using Javascript.

$(".obfuscate").each(function () {

$(this).html($(this).html()
.replace("...", "@").replace(/\.\.\./g, ".")
.replace(/One/g, "1")
.replace(/Two/g, "2")
.replace(/Three/g, "3")
.replace(/Four/g, "4")
.replace(/Five/g, "5")
.replace(/Six/g, "6")
.replace(/Seven/g, "7")
.replace(/Eight/g, "8")
.replace(/Nine/g, "9")
.replace(/Zero/g, "0"))

$(this).attr("href", $(this).attr("href")
.replace("...", "@").replace(/\.\.\./g, ".")
.replace(/One/g, "1")
.replace(/Two/g, "2")
.replace(/Three/g, "3")
.replace(/Four/g, "4")
.replace(/Five/g, "5")
.replace(/Six/g, "6")
.replace(/Seven/g, "7")
.replace(/Eight/g, "8")
.replace(/Nine/g, "9")
.replace(/Zero/g, "0"))

})

I documented it in more detail here https://trajano.net/2017/01/obfuscating-mailto-links/

The de/obfuscation algorithm is pretty simple so its not too taxing to write either (no need for base64 parsing)


Cloudflare is now offering free email obfuscation service. This might be an option if you use Cloudlfare.


Since this solution is not mentioned anywhere, but works well for me:

I do this:

  • create a mailto link with fake email. I like admin@localhost.localdomain for obvious reasons: Spammer might spam his own botnet when using this address unchecked.

  • cypher real email address and put it in an unrelated but findable hidden span or whatever element you like. Obviously to obfuscate the email and hide it from the harvester. Depending on your project structure, you might even want to put it in a JS or Session variable.

  • create a click handler for these links after a second that decyphers and write the correct email address into the fake mailto link not preventing defaults. I do not think that crawlers click on mailto links, but if they would, they probaby won't wait a second, while a human being would have to be extremly fast to click a link in the first second after pageload.

Now you have a fully functional but obfuscated, honeypoted and timesecured mailto link.

Working example php file:

<html>
<head>
<title>E-Mail Obfuscating</title>
</head>
<body>
<?php
$email = "example@email.org";
echo "<a class='emailLink' href='mailto:admin@localhost.localdomain' >Send me an e-mail!</a>"
    ."<span style='display:none' data-hash='" . base64_encode($email) . "' />";
?>
<script>
<!--
var emailLinks = document.getElementsByClassName("emailLink");
setTimeout(function() {
    for(var i=0; i <emailLinks.length; ++i){
        emailLinks[i].addEventListener("click", function(){
            let encodedEmail = this.nextSibling.getAttribute('data-hash');
            let decodedEmail = atob(encodedEmail);
            this.href = "mailto:" + decodedEmail;
            this.text = decodedEmail;
        });
    }
}, 1000);

-->
</script>
</body>
</html>

May the code be with you.


What if creating a link "Contact me" pointing to a directory protected by a password? Of course, you have to give the pass to access.

"Contact me" > ••••••••••• > contact/index.html

Once accessed, the contact/index.html page reveals the email, a mailto for instance.


I use a PHP function to generate some javascript to output the email on page load. Note that you don't need PHP to generate the JS at runtime, you can generate the JS once locally and then include the static JS in your page.

You can also use the linked function with this snippet below to automatically obfuscate email addresses in some given HTML (where $processedContent is the HTML):

 $emailMatches = array();
 $matchCount = preg_match_all('/(?:[a-zA-Z0-9_\.\-])+\@(?:(?:[a-zA-Z0-9\-])+\.)+(?:[a-zA-Z0-9]{2,4})+/', $processedContent, $emailMatches);

 if($matchCount > 0) {
    $emailMatches = $emailMatches[0];

    foreach($emailMatches as $email) {
    $replacement = createJSMailLink($email);

    $processedContent = str_replace($email, createJSMailLink($email), $processedContent);
 }

Check this out.

The 'Enkoder Form' will encrypt your Email address and convert the result to a self evaluating JavaScript, hiding it from Email-harvesting robots which crawl the web looking for exposed addresses. Your address will be displayed correctly by web-browsers, but will be virtually indecipherable to Email harvesting robots.

참고URL : https://stackoverflow.com/questions/748780/best-way-to-obfuscate-an-e-mail-address-on-a-website

반응형