Hidden Text in JavaScript?

K

karteikarte

hey, i just found this riddle somewhere in the net:


<meta http-equiv="Pragma" content="no-cache">
<script language="JavaScript">
<!--
function nstie(){return false}function
nstns(){if(document.layers){st=document.getSelection();if(st!=""&&st!="
"){window.find(" ")}setTimeout("nstns()",20)}}nstns();document.onselectstart=nstie;ondragstart=nstie;function
nrcie(){return false}function
nrcns(e){if(e.which==2||e.which==3)return
false}if(document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=nrcns}document.oncontextmenu=nrcie;function
nsb(){window.status="";setTimeout("nsb()",10)}nsb();function
np1(){for(wi=0;wi<document.all.lengt68;wi++){if(document.all[wi].style.visibility!="hidden"){document.all[wi].style.visibility="hidden";document.all[wi].id="gwp"}}};function
np2(){for(wi=0;wi<document.all.length;wi++){if(document.all[wi].id=="gwp")document.all[wi].style.visibility=""}};window.onbeforeprint=np1;window.onafterprint=np2;document.ondragstart=new
Function("return false;");document.oncontextmenu=new Function("return
false;");
//-->
</script>
<script language="JavaScript">
<!--
eval(unescape("%66%75%6E%63%74%69%6F%6E%20%61%28%73%29%7B%74%3D%22%01%02%03%04%61%62%63%64%65%66%67%68%69%6A%6B%6C%6D%6E%6F%70%71%72%73%74%75%76%77%78%79%7A%30%31%32%33%34%35%36%37%38%39%20%21%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F%3A%3B%3C%3D%3E%3F%40%5B%5D%5E%5F%60%7B%7C%7D%7E%7F%41%42%43%44%45%46%47%48%49%4A%4B%4C%4D%4E%4F%50%51%52%53%54%55%56%57%58%59%5A%22%3B%6F%3D%6E%65%77%20%53%74%72%69%6
%67%3B%6C%3D%73%2E%6C%65%6E%67%74%68%3B%66%6F%72%20%28%69%3D%30%3B%69%3C%6C%3B%69%2B%2B%29%7B%6E%3D%74%2E%69%6E%64%65%78%4F%66%28%73%2E%63%68%61%72%41%74%28%69%29%29%3B%69%66%28%6E%3D%3D%2D%31%29%7B%6F%2B%3D%73%2E%63%68%61%72%41%74%28%69%29%3B%63%6F%6E%74%69%6E%75%65%7D%69%66%28%6E%3D%3D%30%29%7B%6F%2B%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%31%30%29%3B%63%6F%6E%74%69%6E%75%
5%7D%69%66%28%6E%3D%3D%31%29%7B%6F%2B%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%31%33%29%3B%63%6F%6E%74%69%6E%75%65%7D%69%66%28%6E%3E%31%29%7B%6F%2B%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%6E%2B%33%30%29%7D%7D%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%6F%29%7D"));
//-->
</script>
<html>
<head><meta http-equiv="Expires" content="-1"><title>Riddle: who
knows the answer?</title></head><body bgcolor="black" text="silver"
link="red" alink="red" vlink="red">
<script language="JavaScript">
<!--
a("0|J~TNJGPODJI1=Iso(?JmKCK20KM2<DOCDIOCDNK{BDN{CD~~IADGI{Hm5GGTJPBJOOJ~JDNADI~DOk{I~JKIOCK{BI{HDIOCDN~DM}OJMTm0|Mn2#DIOy0|2/CMDN{I{NTR{Tk{I~{C{M~R{Tm0n|20|Mn2!JJ~GP}F0nKM20n|J~T2");
//-->
</script>
<script language="JavaScript">
<!--
eval(unescape("%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%3D%6E%75%6C%6C%3B"));
//-->
</script>
</html>

can somebody tell me how to find the solution?
i'm not a coder.. so please give me a hint :)
 
R

Richard Cornford

karteikarte wrote:
<script language="JavaScript">
<!--
function nstie(){ ...
<snip>

The first block is the usual clumsy implementation of the "no right
click" script, with selection, dragging, etc thrown in for good
measure:-

| function nstie(){
| return false
| }
| function nstns(){
| if(document.layers){
| st=document.getSelection();
| if(st!=""&&st!=" "){
| window.find(" ")
| }
| setTimeout("nstns()",20)
| }
| }
|
| nstns();
| document.onselectstart=nstie;
| ondragstart=nstie;
|
| function nrcie(){
| return false
| }
| function nrcns(e){
| if(e.which==2||e.which==3)return false
| }
|
| if(document.layers){
| document.captureEvents(Event.MOUSEDOWN);
| document.onmousedown=nrcns
| }
| document.oncontextmenu=nrcie;
|
| function nsb(){
| window.status="";
| setTimeout("nsb()",10)
| }
|
| nsb();
|
| function np1(){
| for(wi=0;wi<document.all.lengt68;wi++){
| if(document.all[wi].style.visibility!="hidden"){
| document.all[wi].style.visibility="hidden";
| document.all[wi].id="gwp"
| }
| }
| };
|
| function np2(){
| for(wi=0;wi<document.all.length;wi++){
| if(document.all[wi].id=="gwp")
| document.all[wi].style.visibility=""
| }
| };
|
| window.onbeforeprint=np1;
| window.onafterprint=np2;
| document.ondragstart=new Function("return false;");
| document.oncontextmenu=new Function("return false;");
</script>
<script language="JavaScript">
<!--

eval(unescape("%66% ... "));

The unescape function changes the - %NN - URL style encoding back into
normal characters, where the character code is equivalent to NN (which
is hex in the encoding). The string returned form unescape is javascript
source code and the - eval - function executes it. The code executed is
the definition of a function called 'a':-

| function a(s){
| t="\x01\x02\x03\x04abcdefghijklmnopqrstuvwxyz0123456789 !#$%&"+
| "'()*+,-./:;<=>?@[]^_`{|}~\x7FABCDEFGHIJKLMNOPQRSTUVWXYZ";
| o=new String;
| l=s.length;
| for (i=0;i<l;i++){
| n=t.indexOf(s.charAt(i));
| if(n==-1){
| o+=s.charAt(i);
| continue
| }
| if(n==0){
| o+=String.fromCharCode(10);
| continue
| }
| if(n==1){
| o+=String.fromCharCode(13);
| continue
| }
| if(n>1){
| o+=String.fromCharCode(n+30)
| }
| }
| document.write(o)
| }
//--> </script>
<html>

It is not a particularly well-formed HTML document as it has a META
element and several SCRIPT elements before the opening HTML tag.
<script language="JavaScript">
<!--
a("0|J~T ... J~T2");

As the previous code defined the function - a - this code can call that
function, passing a string as the argument. The function - a - decodes
the string and - document.write -s it into the page. Producing:-

| <body solution=Xn40eMZo.php>
| <pre>
| Within this page is a hidden filename. All you got to do
| is find it, and open the pagename in this directory.<br />
| Hint: <b>There is an easy way, and a hard way.</b><br />
| Good luck!
| </pre>
| said:
//--> </script> <script language="JavaScript"> <!--
eval(unescape("%64% ... %3B"));
<snip>

This final eval(unescape(" ... ")) executes the code:-

| document.write=null;

- which makes the document.write function unavailable by replacing the
reference to it with a null value.

Presumably the "hidden filename" is; 'Xn40eMZo.php'

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top