473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to decrypt garbled javascript?



I have a js file that is encrypted or garbled, See example below. Does it
need a decrypter or does Javascript know how to deal with it right off?

This js file is causing an error under IE. Any ideas on how to convert it
into human readable Javascript so I can debug it?

sample:

\x3E","\x3C/strong\x3E","\x3C/b\x3E","\x3Cem\x3E","\x3Ci\x3E","\x3C/em\x3E","\x3C/i\x3E","\x3Cbody
contentEditable=true","\x3Cbody
contentEditable=false","\x3Cp\x3E\x3C/p\x3E","\x3Cdiv\x3E\x3C/div\x3E","$1","\x3Chead\x3E\x0A","\x3Cbase
href=\x22","\x22 /\x3E","\x3Cstyle\x3E body
{padding:0px;margin:0px;","}\x3C/style\x3E\x0A","\x3C/head\x3E\x0A","\x3Cbody\x3E\x0A","\x3C/body\x3E\x0A","\x3C/html\x3E","text/html","replace","base","\x3CBASE
href=\x22","\x22
\x3E","EncodeHiddenValue","sthlastval","sthlasttab ","attachEvent","on","addEventListener","detachEve nt","removeEventListener","string","-1","ok","yes","true","BUTTON","initcomplete","stat ectrl","%3b","s:","n:","b:","boolean","number","=" ,"controls","bookmark",".","firstChild","multiline ","ownerDocument","
"," "," "," "," ","
"," ","function","function
anonymous()","}","{","\x26lt;","\x26gt;","\x26quot ;","\x26#39;","\x26#","\x26#160;","UNICODE","_","_ UL_OL_LI_FIELDSET_LEGEND_DIV_P_TABLE_THEAD_TBODY_T FOOT_TR_TD_SELECT_OBJECT_","nodeType","BGSOUND","M ETA","/","scopeName","_SELECT_OPTION_INPUT_FORM_TEXTAREA_ CAPTION_FIELDSET_LEGEND_BR_P_DIV_DIR_UL_OL_MENU_LI _SELECT_TABLE_THEAD_TBODY_TFOOT_TR_TD_TH_OBJECT_PA RAM_","_INPUT_FORM_TEXTAREA_SELECT_OPTION_","start ","loop","#","src","contenteditable","inherit","co lspan","rowspan","
style=\x22","\x3C/scr","ipt\x3E\x0A","IFRAME","\x3E\x3C/iframe
--
John Dalberg
Oct 27 '05 #1
3 23871
John Dalberg wrote:
I have a js file that is encrypted or garbled, See example below. Does it
need a decrypter or does Javascript know how to deal with it right off?

This js file is causing an error under IE. Any ideas on how to convert it
into human readable Javascript so I can debug it?

sample:

\x3E","\x3C/strong\x3E","\x3C/b\x3E","\x3Cem\x3E","\x3Ci\x3E","\x3C/em\x3E","\x3C/i\x3E","\x3Cbody
contentEditable=true","\x3Cbody
contentEditable=false","\x3Cp\x3E\x3C/p\x3E","\x3Cdiv\x3E\x3C/div\x3E","$1","\x3Chead\x3E\x0A","\x3Cbase
href=\x22","\x22 /\x3E","\x3Cstyle\x3E body
{padding:0px;margin:0px;","}\x3C/style\x3E\x0A","\x3C/head\x3E\x0A","\x3Cbody\x3E\x0A","\x3C/body\x3E\x0A","\x3C/html\x3E","text/html","replace","base","\x3CBASE
href=\x22","\x22
\x3E","EncodeHiddenValue","sthlastval","sthlasttab ","attachEvent","on","addEventListener","detachEve nt","removeEventListener","string","-1","ok","yes","true","BUTTON","initcomplete","stat ectrl","%3b","s:","n:","b:","boolean","number","=" ,"controls","bookmark",".","firstChild","multiline ","ownerDocument","
"," "," "," "," ","
"," ","function","function
anonymous()","}","{","\x26lt;","\x26gt;","\x26quot ;","\x26#39;","\x26#","\x26#160;","UNICODE","_","_ UL_OL_LI_FIELDSET_LEGEND_DIV_P_TABLE_THEAD_TBODY_T FOOT_TR_TD_SELECT_OBJECT_","nodeType","BGSOUND","M ETA","/","scopeName","_SELECT_OPTION_INPUT_FORM_TEXTAREA_ CAPTION_FIELDSET_LEGEND_BR_P_DIV_DIR_UL_OL_MENU_LI _SELECT_TABLE_THEAD_TBODY_TFOOT_TR_TD_TH_OBJECT_PA RAM_","_INPUT_FORM_TEXTAREA_SELECT_OPTION_","start ","loop","#","src","contenteditable","inherit","co lspan","rowspan","
style=\x22","\x3C/scr","ipt\x3E\x0A","IFRAME","\x3E\x3C/iframe
--
John Dalberg


The syntax \xXX is a character with the Latin-1 encoding specified by
the two hexadecimal digits XX between 00 and FF. For example, \xA9 is
the hexadecimal sequence for the copyright symbol. So yes, javascript
knows how to handle this. Now for you to understand it, I can think of
two ways at the moment. You can either painstakingly go through and try
to decode it yourself (which is probably the original intent of the
author), or you can use the same program the author used to decrypt it.

Oct 27 '05 #2
John Dalberg wrote:
I have a js file that is encrypted or garbled, See example below. Does it
need a decrypter or does Javascript know how to deal with it right off?

This js file is causing an error under IE. Any ideas on how to convert it
into human readable Javascript so I can debug it?


There is probably a way to do this in one go, here's a quick 'n dirty
effort if all you need it for is a bit of debugging:

<b>Paste code here:</b><br>
<textarea id="iTA" rows="20" cols="100"></textarea><br>
<input type="button" value="Decode..." onclick="
var x = document.getElementById('iTA').value.replace(/\\x/g,'%');
document.getElementById('oTA').value = decodeURIComponent(x);
"><br>
<b>Result:</b><br>
<textarea id="oTA" rows="20" cols="100"></textarea>
It replaces '\x' with '%' so that decodeURIComponent() can deal with
it. Older browsers may not understand decodeURIComponent, if that's
you then use the depreciated unescape() instead (I think they behave a
little differently too).

[...]

Oct 27 '05 #3
RobG wrote:
John Dalberg wrote:
I have a js file that is encrypted or garbled, See example below. Does it
need a decrypter or does Javascript know how to deal with it right off?

This js file is causing an error under IE. Any ideas on how to convert it
into human readable Javascript so I can debug it?


There is probably a way to do this in one go, here's a quick 'n dirty
effort if all you need it for is a bit of debugging:

[...]

I didn't think of it before, but if the page displays fine in some
other browser (which you infer that it does), then you can get the
decrypted source quite simply. Past this into the address bar of the
browser that displayes it correctly (all one line, wrapped for
posting):

javascript:'<code>'+(document.documentElement ||
document.body).innerHTML.replace(/&/g,%22&amp;%22).replace(/</g,
%22&lt;%22).replace(/%20%20/g, %22&nbsp;%20%22).replace(/\n/g,
%22<br>%22)+'<\/code>';

And the decrypted page source is revealed (also shows the futility of
attempting to 'hide' the page source as the author seems to think
they've done).

--
Rob

Oct 28 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: steve | last post by:
Hi, My Windows machine running PHP Version 4.3.4, Apache, mysql, Zend IDE has developed a strange problem whereas the html code coming out of php sometimes gets garbled in unpredicatable ways,...
4
by: Byron | last post by:
Hi, I need to remove some items from a Javascript drop down menu coded by someone else. The menu is contained within a single .js file. I'm not very fluent in javascript, but I know what it...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
0
by: Hannibal111111 | last post by:
I found this code on a site for doing string encryption/decryption. The string will encrypt fine, but I get this error when I try to decrypt. Any idea why? I posted the code below. The error...
9
by: pengypenguin | last post by:
I've made this little example script for a project I'm working on, and the text that gets output seems to be chewed up in IE for Windows. Every other (major) browser has no problem rendering the...
1
by: blbmdsmith | last post by:
Has anyone seen the following error while starting httpd: Starting httpd: httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: API module structure `python_module' in file...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
8
by: rajesh | last post by:
< script language = javascript c =...
3
by: mistral | last post by:
How to decrypt this text, what algorithm used to encode text, how to recreate algorithm? %c3%99%c3%a3%c3%af%c3%b3%c3%94%c3%92%c3%89%c3%81%c3%8c%c3%ae%c3%ba...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.