Skip to content

Instantly share code, notes, and snippets.

@trent2
Last active February 22, 2022 06:47
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save trent2/4f1198a173019103478cbefbcaf4c744 to your computer and use it in GitHub Desktop.
Save trent2/4f1198a173019103478cbefbcaf4c744 to your computer and use it in GitHub Desktop.
Unobfuscate SPIEGEL plus articles with greasemonkey
// ==UserScript==
// @name unobfuscate spiegel plus
// @namespace obfuscate
// @include http://www.spiegel.de/*
// @version 1
// @grant none
// ==/UserScript==
if(document.getElementsByClassName('obfuscated-content')[0] != undefined) {
document.getElementsByClassName('obfuscated-content')[0].setAttribute("class", "");
var elems = document.getElementsByClassName('obfuscated'), t, or, c, i, cc;
for(i in elems) {
or = elems[i].innerHTML;
t = "";
inElement = false;
openTag = -1;
isATag = false;
closingTag = false;
dontTranslate = false;
if(or != undefined)
for(c=0; c<or.length; ++c) {
if(openTag>-1)
openTag++;
cc = or.charCodeAt(c);
if(cc == 60) { // "<"
dontTranslate = true;
inElement = true;
openTag = 0;
}
if(cc>33 && !dontTranslate) {
switch(cc) {
case 180: t += ";"; break;
case 178: t += "!"; break;
case 177: t += "&"; break;
default:
t += String.fromCharCode(cc-1);
}
}
else
t += or.charAt(c);
if(openTag==1 && cc == 97) // <a ...
isATag = true;
if(openTag==1 && cc == 47) // "</"
closingTag = true;
if(inElement && cc == 62) { // "<...>"
dontTranslate = isATag && !closingTag;
isATag = false;
inElement = closingTag = false;
openTag = -1;
}
}
elems[i].innerHTML = t;
}
}
@sindbad103
Copy link

Funktioniert auch heute noch einwandfrei. Vielen Dank.

@trent2
Copy link
Author

trent2 commented May 28, 2018

Ab heute nicht mehr :-)

@N00B2
Copy link

N00B2 commented Feb 21, 2022

Is there any option left?

@trent2
Copy link
Author

trent2 commented Feb 21, 2022

What kind of option?
About four years ago, Spiegel online changed the way Spiegel plus pages are displayed. Before, they send all content of the articel to the user, pretty lamely encrypted (rather obfuscated) for those not logged in, very easily to decypher.
From then on 95% of the article's text is not send to the web client at all if you're not logged in as a paying user, not even obfuscated or encrypted. This (old) script is purely running on your client, i.e. probably your web browser. You cannot decrypt anything from nothing.

@N00B2
Copy link

N00B2 commented Feb 22, 2022

Makes sense, those fuckers...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment