Jump to content

modifying a function,


blueman378

Recommended Posts

hi guys, im working on decoding some code, so i found this script here which will decode the basic eval(unescape(",

 

but the thing is the eval is this: eval(hp_d11(unescape("

 

heres the functoin called hp_d11()

 

function hp_d11(s){
var o="",
ar=new Array(),
os="",ic=0;
for(i=0;i<s.length;i++){
c=s.charCodeAt(i);
if(c<128)c=c^2;os+=String.fromCharCode(c);
if(os.length>80){
ar[ic++]=os;os=""
	}
	}
o=ar.join("")+os;
return o}"));

 

and heres the function to encrpy/decrypt with the default eval,

<html>
  <head>
    <title>Unescape Encoder/Decoder</title>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <script language="javascript">
      var encN=1;

      function decodeTxt(s){
      var s1=unescape(s.substr(0,s.length-1));
      var t='';
      for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1));
      return unescape(t);
      }

      function encodeTxt(s){
      s=escape(s);
      var ta=new Array();
      for(i=0;i<s.length;i++)ta[i]=s.charCodeAt(i)+encN;
      return ""+escape(eval("String.fromCharCode("+ta+")"))+encN;
      }


      function escapeTxt(os){
      var ns='';
      var t;
      var chr='';
      var cc='';
      var tn='';
      for(i=0;i<256;i++){
      tn=i.toString(16);
      if(tn.length<2)tn="0"+tn;
      cc+=tn;
      chr+=unescape('%'+tn);
      }
      cc=cc.toUpperCase();
      os.replace(String.fromCharCode(13)+'',"%13");
      for(q=0;q<os.length;q++){
      t=os.substr(q,1);
      for(i=0;i<chr.length;i++){
      if(t==chr.substr(i,1)){
      t=t.replace(chr.substr(i,1),"%"+cc.substr(i*2,2));
      i=chr.length;
      }}
      ns+=t;
      }
      return ns;
      }
      function unescapeTxt(s){
      return unescape(s);
      }
      function wF(s){
      document.write(decodeTxt(s));
      }
    </script>
  </head>
  <body bgcolor="#FFFFFF" alink="#C0C0C0" link="#C0C0C0" vlink="#C0C0C0">
    <font color=#000000 size="5">
      <br>
      <center>
        <form name="fA">
          Decoded
          <br>
          <textarea id="f1" cols=50 rows=10 wrap="off"></textarea>
          <br><br>
          <input type="button" width="50%" value="Encode" onclick="document.fA.c1.value=escapeTxt(document.fA.f1.value)"> 

   
          <input type="button" value="Decode" onclick="document.fA.f1.value=unescapeTxt(document.fA.c1.value)">
          <br><br>Encoded
          <br>
          <textarea id="c1" cols=50 rows=10></textarea>
          <br><br>
          <font color=#000000 size="3">
            This can be used with the unescape( ); function in JavaScript.
          </font>
        </form>
      </center>
    </font>
  </body>
</html>

 

can someone help me merge these two so that i can decode using that function instead of the original

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.