emailconcealer
Tool to make email address harvesting harder with obfuscation.
Installation
go install codeberg.org/sdassow/emailconcealer@latest
Usage
$ emailconcealer me@example.com
me@elpeaxaemplemail.com
$
Synopsis
emailconcealer [-tag tag] [-class class] email [email ...]
Every given argument is used as an email address.
When called with one address outputs one line with the resulting HTML,
and when called with multiple addresses prefixes every line with the
input email address, a colon, and a space, followed by the resulting HTML.
The options are as follows:
Concept
It is using HTML and CSS to protect email addresses on websites,
inspired by this article.
Two methods for obfuscation are used:
- Put local part of email in HTML tag, add second HTML tag with unrelated string into the address.
- Insert additional characters into first part of the domain.
In order to show the actual address specific characters need to be hidden.
Currently they happen to be the fibonacci sequence.
Example
Looking only at the resulting text from the HTML side of things, an email address like
me@example.com
becomes
me@elpeaxaemplemail.com
without applying the necessary stylesheet.
Stylesheet
The following CSS will show the correct email addresses and is best added
to an external file to increase the effort for harvesters:
/* format email address like normal text */
.email b,
.email i
{
font-style: normal;
font-weight: normal;
}
/* hide specific elements */
.email b:nth-of-type(2),
.email i:nth-of-type(1),
.email i:nth-of-type(2),
.email i:nth-of-type(3),
.email i:nth-of-type(5),
.email i:nth-of-type(8),
.email i:nth-of-type(13),
.email i:nth-of-type(21)
{
display: none;
}
Depending on the length of the resulting string more fibonacci selectors need to be added
until all extra characters are hidden.
Simply add the last two numbers to get the next one (13 + 21 in this example):
.email i:nth-of-type(34)
Integration
To use this module with html/template
use the following on your template object:
tmpl.Funcs(template.FuncMap{
"concealemail": func(email string) template.HTML {
return template.HTML(emailconcealer.ConcealEmail(email))
},
})
And use in the template code like other filters:
<div>Email address: {{ "foo@example.com" | concealemail }}</div>