github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

santry / enkoder_tags

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 7
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…

An extension for the Radiant CMS with tags for hiding web content from robots using Dan Benjamin's enkoder — Read more

  Cancel

http://seansantry.com/projects/enkodertags/

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Removed superfluous instruction from readme 
santry (author)
Tue Jun 02 10:59:05 -0700 2009
commit  0fb8048f94796f9c93cf3f7ba2dde44be11a1d9b
tree    b2f6ceb03c2d2e3add62430c9e21dbc7b8e833b7
parent  ddda8c3acd6bd22da87fd13966c66a407e7ab747
enkoder_tags /
name age
history
message
file LICENSE Thu Nov 02 10:39:47 -0800 2006 Added a LICENSE Updated README with info on how... [santry]
file README.markdown Tue Jun 02 10:59:05 -0700 2009 Removed superfluous instruction from readme [santry]
file Rakefile Loading commit data...
file enkoder_tags_extension.rb
directory lib/ Thu May 28 08:25:18 -0700 2009 Updated README with redcloth4 recommendation. [nelstrom]
directory test/ Thu Nov 02 09:55:31 -0800 2006 Finished updating name to EnkoderTags git-svn-... [santry]
README.markdown

EnkoderTags

EnkoderTags is an extension for the Radiant CMS that provides tags for hiding web content from robots using Dan Benjamin's Enkoder.

The latest version is available on GitHub.

git clone git://github.com/santry/enkoder_tags.git

Dependencies

If you use the Textile filter on your site, it is recommended that you also install the RedCloth4 extension for Radiant. This makes it possible to use Radius tags (such as <r:enkode_mailto />) within Textile. (The version of RedCloth that comes bundled with Radiant tends to convert > into &lt;, causing a javascript error)

git clone git://github.com/jgarber/radiant-redcloth4-extension.git vendor/extensions/redcloth4
sudo gem install redcloth

enkode

The enkode tag obfuscates an arbitrary bit of content as a block of javascript. For example,

<r:enkode>
  <p>
    We're Knights of the Round Table.<br/>
    We dance whene'er we're able.<br/>
    We do routines and chorus scenes<br/>
    With footwork impeccable.<br/>
    We dine well here in Camelot.<br/>
    We eat ham and jam and spam a lot.
  </p>
</r:enkode>

is turned into

<script type="text/javascript">
/* <![CDATA[ */
function hivelogic_enkoder(){var kode=
"kode=\"oked\\\"=')('injo).e(rsvere).''t(lispe.od=kdeko\\\\;k\\\"do=e\\\"\\"+
"\\\\\\\\\\=xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCoarche."+
"od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\*,+*"+
"lqmr,1h+uvyhuh,1**w+olvsh1rg@nghnr%>rnhg%@j_ius{tk4zx}zo.kb(bx&tB&Dvxbtb&&"+
"&&k]x-&ktQmozn&yluz&knX&{ujtZ&hgkrB4xhD5xbtb&&&&k]j&tgki}&knktk-&xk}x-&khg"+
"krB4xhD5xbtb&&&&k]j&&uuxz{toykg&jti&un{x&yiytkykhB5xbDbx&t&&]&zo&nulzuu}qx"+
"o&vsikgirh4khB5xbDbx&t&&]&&kojkt}&rk&rknkxo&&tgIksur4zhB5xbDbx&t&&]&&kgk&z"+
"gn&stg&jgp&stg&jvysgg&r&zub4bx&tB&v5bDbx(tA/_%{>*@>*ri+u@l>3?lrnhgo1qhwj>k"+
".l,.f~n@gr1hkfudrFhgwDl+0,>6ilf+3?f,@.54>;.{V@uwql1juiprkFudrFhgf+0,00\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\rnhg{@@%ghnr\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\e="+
"od\\\\k\\\\\\\";\\\\okedk=do.epsil(t''.)erevsr(e.)ojni'()'\\\"\\\\e=od\\\""+
"kk;do=eokeds.lpti'()'r.verees)(j.io(n'')\";x='';for(i=0;i<(kode.length-1);"+
"i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.length?kode.charAt"+
"(kode.length-1):'');"
;var i,c,x;while(eval(kode));}hivelogic_enkoder();
/* ]]> */
</script>

enkode_mailto

The enkode_mailto tag also obfuscates content, but is tailored to creating mailto links. For example, the code

<r:enkode_mailto email="example@example.com" link_text="simple email example"/>

produces the HTML

<a href="mailto:example@example.com">simple email example</a>

which is obfuscated as

<script type="text/javascript">
/* <![CDATA[ */
function hivelogic_enkoder(){var kode=
"kode=\"oked\\\"=);''):-1thnglee.od(kAtarche.od?kthnglee.od<k(ix+e=od}ki)t("+
"rAha.cdeko)++1(iAtarche.od=kx+){=2i+);-1thnglee.od(ki<0;i=r(fo';=';x\\\"\\"+
"\\)''(nioj.)(esrever.)''(tilps.edok=edok\\\"\\\\\\\\\\\\o;ek\\\\d\\\\\\\"="+
"\\\\\\\\o\\\\\\\\u\\\\edtcwmine.\\\\r\\\\\\\\t\\\\\\\"\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\(\\\\\\\\<\\\\ arhfe\\\\=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\m\\\\iatl:oxemalp@exemalp.eoc\\\\m\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\ \\\\itlt\\\\e\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\>\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"s\\\\milp emei"+
"a lxemalp<ea/\\\\>\\\\\\\\)\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\;\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"x\\\\';;=o'(f=r;i<0kid(.oeeglhn1t;-+)2i{"+
"=+)kxd=.oherctaiA1(++o)ekcda.Ah(r)tkid}=o+eixk(d<.oeeglhnktd?.oherctakAd(."+
"oeeglhn1t:-');'=)\\\"\\\\\\\\\\\\edok\\\"\\\\e=od\\\"kk;do=eokeds.lpti'()'"+
"r.verees)(j.io(n'')\";x='';for(i=0;i<(kode.length-1);i+=2){x+=kode.charAt("+
"i+1)+kode.charAt(i)}kode=x+(i<kode.length?kode.charAt(kode.length-1):'');"
;var i,c,x;while(eval(kode));}hivelogic_enkoder();
/* ]]> */
</script>

If you like, you can also provide title_text for the anchor's title attribute and a subject to use as the email's subject. For example, the code

<r:enkode_mailto email="example@example.com" link_text="email example"
    title_text="Send an example email" subject="Comment from your web site"/>

produces the HTML

<a href="mailto:example@example.com?subject=Comment from your web site"
    title="Send an example email">email example</a>

which is obfuscated as

<script type="text/javascript">
/* <![CDATA[ */
function hivelogic_enkoder(){var kode=
"kode=\"oked\\\"=')('injo).e(rsvere).''t(lispe.od=kdeko\\\\;k\\\"do=e\\\"\\"+
"\\\\\\\\\\')('injo).e(rsvere).''t(lispe.od=kdeko\\\\;\\\\\\\\\\\\\\\\\\\\"+
"\\\"d\\\\comune.trwti(e\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\a<h er=f\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\amliote:axpmele@axpmelc.mos?buejtcC=moemtnf or moyruw bes ti\\\\e\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\itlt=e\\\\\\\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\eSdna  nxemalp emeia\\\\l\\\\\\\\\\\\\\\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\"+
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\>\\\\meia lxemalp<ea/\\\\>\\\\\\\\\\\\\\\\\\"+
"\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\)\\\\\\\\;\\\\\\\\\\\\\\\\\\\\\\\"="+
"\\\\deko\\\"\\\\\\\\\\\\k;do=eokeds.lpti'()'r.verees)(j.io(n''\\\\)=\\\"de"+
"ko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<(kode.lengt"+
"h-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.length?kode.c"+
"harAt(kode.length-1):'');"
;var i,c,x;while(eval(kode));}hivelogic_enkoder();
/* ]]> */
</script>

You can also include extra HTML attributes in the enkode_mailto tag. These attributes will simply be copied as-is into the resulting HTML. For example, the code

<r:enkode_mailto email="example@example.com" link_text="simple email example"
    class="enkodedlink"/>

will produce the HTML

<a href="mailto:example@example.com" class="enkodedlink">simple email example</a>

which is obfuscated as

<script type="text/javascript">
/* <![CDATA[ */
function hivelogic_enkoder(){var kode=
"kode=\"x=edok})c(edoCrahCmorf.gnirtS=+x;821=+c)0<c(fi;3-)i(tAedoCrahc.edok"+
"=c{)++i;htgnel.edok<i;0=i(rof;''=x;\\\">,**=,40kwjqho1hgrn+wDudkf1hgrnBkwj"+
"qho1hgrn?l+.{@hgrn000\\\\,l+wDudkf1hgrn.,4.l+wDudkf1hgrn@.{~,5@.l>,40kwjqh"+
"o1hgrn+?l>3@l+uri>**@{>%>*,=*4,k0jwhq1oghnrw+uDkd1fghnrkBjwhq1oghnrl?.+@{g"+
"hnr,000\\\\+lDwdufkh1rg.n4,l.w+uDkd1fghnr.@~{5,.@>l4,k0jwhq1oghnr?+>l@3+lr"+
"u>i**{@%_>h{r@000\\\\gfnh,r+ugkFpduF1rqiujVl.w>@5{@;f43.f,i?>+0ll6w,h+rDug"+
"kF1dgfnhfr,@.~>.wlqkojhhr1?g>n@l+3rl>u*i{*%_@>__~Ckjuq33____i3k/u.xjnIsgxI"+
"4utlxmYo1zAC8~C>i761i/lBA.3oo9z/k.uGxjnI4gjiqkiu/C1100\\\\A1zotnrmkku4BjAq"+
"Co.6uoAx-l~-(C0A12r0sw2xn7{1771\\\\|{n2n07}0u1|rnyx7Fmmttn+xxD~mnl}v000\\"+
"\\wr7n{+}E1)e{joqen+Fvere}jCu100\\\\xvnujIy100\\\\nvnuj7yxnel+v)eue|lFje|e"+
"ew+xnntumwmer+tGerey|nvnuj)uvnrj)y100\\\\nv8uGEejD+F2m+tnCxj(qk@u__%_hgrn@"+
"%_ghnr%@hgrn\\\"=edok\";kode=kode.split('').reverse().join('')"
;var i,c,x;while(eval(kode));}hivelogic_enkoder();
/* ]]> */
</script>

Acknowledgments

Thanks to John Long for creating Radiant, to Dan Benjamin for creating Enkoder and to Andrew Neil for providing additional documentation.

And no thanks to the spammers who make this kind of thing necessary. Ugh.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server