Hidden Text in JavaScript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • karteikarte

    #1

    Hidden Text in JavaScript?

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


    <meta http-equiv="Pragma" content="no-cache">
    <script language="JavaS cript">
    <!--
    function nstie(){return false}function
    nstns(){if(docu ment.layers){st =document.getSe lection();if(st !=""&&st!="
    "){window.find( " ")}setTimeout(" nstns()",20)}}n stns();document .onselectstart= nstie;ondragsta rt=nstie;functi on
    nrcie(){return false}function
    nrcns(e){if(e.w hich==2||e.whic h==3)return
    false}if(docume nt.layers){docu ment.captureEve nts(Event.MOUSE DOWN);document. onmousedown=nrc ns}document.onc ontextmenu=nrci e;function
    nsb(){window.st atus="";setTime out("nsb()",10) }nsb();function
    np1(){for(wi=0; wi<document.all .lengt68;wi++){ if(document.all[wi].style.visibili ty!="hidden"){d ocument.all[wi].style.visibili ty="hidden";doc ument.all[wi].id="gwp"}}};fu nction
    np2(){for(wi=0; wi<document.all .length;wi++){i f(document.all[wi].id=="gwp")docu ment.all[wi].style.visibili ty=""}};window. onbeforeprint=n p1;window.onaft erprint=np2;doc ument.ondragsta rt=new
    Function("retur n false;");docume nt.oncontextmen u=new Function("retur n
    false;");
    //-->
    </script>
    <script language="JavaS cript">
    <!--
    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%6 E%3D%3D%31%29%7 B%6F%2B%3D%53%7 4%72%69%6E%67%2 E%66%72%6F%6D%4 3%68%61%72%43%6 F%64%65%28%31%3 3%29%3B%63%6F%6 E%74%69%6E%75%6 5%7D%69%66%28%6 E%3E%31%29%7B%6 F%2B%3D%53%74%7 2%69%6E%67%2E%6 6%72%6F%6D%43%6 8%61%72%43%6F%6 4%65%28%6E%2B%3 3%30%29%7D%7D%6 4%6F%63%75%6D%6 5%6E%74%2E%77%7 2%69%74%65%28%6 F%29%7D"));
    //-->
    </script>
    <html>
    <head><meta http-equiv="Expires" content="-1"><title>Riddl e: who
    knows the answer?</title></head><body bgcolor="black" text="silver"
    link="red" alink="red" vlink="red">
    <script language="JavaS cript">
    <!--
    a("0|J~TNJGPOD JI1=Iso(?JmKCK 20KM2 <DOCDIOCD NK{BDN{CD~ ~IADGI{Hm5 GGTJPBJOOJ~ JDNADI ~DOk{I~JKI OCK{BI{HDI OCDN~DM}OJMT m0|Mn2 #DIOy0|2/CMDN{I{NT R{Tk{I~{C{M ~R{Tm0n|20|Mn 2!JJ~G P}F0nKM 20n|J~T2");
    //-->
    </script>
    <script language="JavaS cript">
    <!--
    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 :-)
  • Richard Cornford

    #2
    Re: Hidden Text in JavaScript?

    karteikarte wrote:
    <snip>[color=blue]
    > <script language="JavaS cript">
    > <!--
    > function nstie(){ ...[/color]
    <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.lay ers){
    | st=document.get Selection();
    | if(st!=""&&st!= " "){
    | window.find(" ")
    | }
    | setTimeout("nst ns()",20)
    | }
    | }
    |
    | nstns();
    | document.onsele ctstart=nstie;
    | ondragstart=nst ie;
    |
    | function nrcie(){
    | return false
    | }
    | function nrcns(e){
    | if(e.which==2|| e.which==3)retu rn false
    | }
    |
    | if(document.lay ers){
    | document.captur eEvents(Event.M OUSEDOWN);
    | document.onmous edown=nrcns
    | }
    | document.oncont extmenu=nrcie;
    |
    | function nsb(){
    | window.status=" ";
    | setTimeout("nsb ()",10)
    | }
    |
    | nsb();
    |
    | function np1(){
    | for(wi=0;wi<doc ument.all.lengt 68;wi++){
    | if(document.all[wi].style.visibili ty!="hidden"){
    | document.all[wi].style.visibili ty="hidden";
    | document.all[wi].id="gwp"
    | }
    | }
    | };
    |
    | function np2(){
    | for(wi=0;wi<doc ument.all.lengt h;wi++){
    | if(document.all[wi].id=="gwp")
    | document.all[wi].style.visibili ty=""
    | }
    | };
    |
    | window.onbefore print=np1;
    | window.onafterp rint=np2;
    | document.ondrag start=new Function("retur n false;");
    | document.oncont extmenu=new Function("retur n false;");
    [color=blue]
    > </script>
    > <script language="JavaS cript">
    > <!--
    >
    > eval(unescape(" %66% ... "));[/color]

    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 \x04abcdefghijk lmnopqrstuvwxyz 0123456789 !#$%&"+
    | "'()*+,-./:;<=>?@[]^_`{|}~\x7FABCD EFGHIJKLMNOPQRS TUVWXYZ";
    | o=new String;
    | l=s.length;
    | for (i=0;i<l;i++){
    | n=t.indexOf(s.c harAt(i));
    | if(n==-1){
    | o+=s.charAt(i);
    | continue
    | }
    | if(n==0){
    | o+=String.fromC harCode(10);
    | continue
    | }
    | if(n==1){
    | o+=String.fromC harCode(13);
    | continue
    | }
    | if(n>1){
    | o+=String.fromC harCode(n+30)
    | }
    | }
    | document.write( o)
    | }
    [color=blue]
    > //--> </script>
    > <html>[/color]

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

    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=Xn40eM Zo.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>
    | </body>
    [color=blue]
    > //--> </script> <script language="JavaS cript"> <!--
    > eval(unescape(" %64% ... %3B"));[/color]
    <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.


    Comment

    • Andrew Thompson

      #3
      Re: Hidden Text in JavaScript?

      On 27 Sep 2004 03:01:00 -0700, karteikarte wrote:
      [color=blue]
      > hey, i just found this riddle[/color]

      Not so much a riddle as..
      [color=blue]
      > ..somewhere in the net:..[/color]

      *
      [color=blue]
      > <script language="JavaS cript">
      > <!--[/color]

      ...another broken script.
      [color=blue]
      > can somebody tell me how to find the solution?
      > i'm not a coder.. so please give me a hint :-)[/color]

      Let's see a working version in-place, who's
      passsword/protection/whatever are you trying
      to circumvent?

      * What is the URL of this 'somewhere in the net'?

      --
      Andrew Thompson
      http://www.PhySci.org/codes/ Web & IT Help
      http://www.PhySci.org/ Open-source software suite
      http://www.1point1C.org/ Science & Technology
      http://www.lensescapes.com/ Images that escape the mundane

      Comment

      Working...