Decrypt Javascript source [closed]

2019-03-06 23:52发布

问题:

I have been wrote a javascript code and encrypt it.it is similar to this :

var _0xbf1b = ["\x2F\x70\x61\x67\x65\x73\x2F", "\x69\x6E\x64\x65\x78\x4F\x66", "\x74\x6F\x4C

All Code in JsFiddle

I search in the Internet and SO but no solution help me to decrypt my script.

please help me to decrypt my source code.

thanks

回答1:

By using http://jsbeautifier.org/

You may obtain:

http://jsfiddle.net/VFNVx/

 function getAlarm() {
     try {
         var _0xdca7x2 = window['location'].toString()['toLowerCase']()['indexOf']('/pages/');
         var _0xdca7x3 = window['location'].toString()['substring'](0, _0xdca7x2) + '/pages/Alarm/Alarm.aspx/GetAlarm';
         $['ajax']({
             type: 'POST',
             url: _0xdca7x3,
             data: '{}',
             contentType: 'application/json; charset=utf-8',
             dataType: 'json',
             success: function (_0xdca7x4) {
                 if (_0xdca7x4['d'] != '') {
                     var _0xdca7x5 = _0xdca7x4['d']['split']('_');
                     $('#hidAlarmID')['val'](_0xdca7x5[0]);
                     $('#lblAlarmMessage')['text'](_0xdca7x5[1]);
                     if (parseInt(_0xdca7x5[0]) > 0) {
                         $('#pnlAlarm')['slideDown']();
                     } else {
                         $('#pnlAlarm')['slideUp']();
                     };
                 };
             }
         });
     } catch (e) {};
 };
 $(document)['ready'](function () {
     $('body')['on']('click', '.NotpostBack', function (_0xdca7x6) {
         _0xdca7x6['preventDefault']();
     });
     $('#UpTablnkUserName')['on']('click', function () {
         $('#divTools')['slideUp']();
         $('#divHelp')['slideUp']();
         $('#Specifications')['slideToggle']();
     });
     $('#UpTablnkTools')['on']('click', function () {
         $('#divHelp')['slideUp']();
         $('#Specifications')['slideUp']();
         $('#divTools')['slideToggle']();
     });
     $('#UpTablnkHelp')['on']('click', function () {
         $('#divTools')['slideUp']();
         $('#Specifications')['slideUp']();
         $('#divHelp')['slideToggle']();
     });
     if ($('#lblAlarmMessage')['text']() != '' && parseInt($('#hidAlarmID')['val']()) > 0) {
         $('#pnlAlarm')['slideDown']();
     };
     window['setInterval']('getAlarm()', 300000);
     $('#btnAware')['on']('click', function (_0xdca7x6) {
         try {
             _0xdca7x6['preventDefault']();
             var _0xdca7x2 = window['location'].toString()['toLowerCase']()['indexOf']('/pages/');
             var _0xdca7x3 = window['location'].toString()['substring'](0, _0xdca7x2) + '/pages/Alarm/Alarm.aspx/Aware';
             $['ajax']({
                 type: 'POST',
                 url: _0xdca7x3,
                 data: '{\'MessageID\':\'' + $('#hidAlarmID')['val']() + '\'}',
                 contentType: 'application/json; charset=utf-8',
                 dataType: 'json',
                 success: function (_0xdca7x4) {
                     if (_0xdca7x4['d'] == true) {
                         $('#pnlAlarm')['slideUp']();
                     };
                 }
             });
         } catch (_0xdca7x6) {};
     });
     $('#pnlAlarm')['on']('click', function () {
         $('#pnlAlarm')['slideUp']();
     });
     $('#menuUL li')['on']('mouseenter', function () {
         var _0xdca7x7 = $(this)['position']();
         $(this)['find']('ul')['css']('top', _0xdca7x7['top'] + 28);
         if (jQuery['browser']['version'] == '7.0' || jQuery['browser']['version'] == '8.0') {
             $(this)['find']('ul')['css']('left', _0xdca7x7['left'] - 105 - $(document)['scrollLeft']());
         } else {
             $(this)['find']('ul')['css']('left', _0xdca7x7['left'] - 105);
         };
         $(this)['find']('ul')['css']('top', _0xdca7x7['top'] + 27 - $(document)['scrollTop']());
         $(this)['find']('ul')['css']('position', 'fixed');
         $(this)['find']('ul')['css']('display', 'block');
     });
     $('#menuUL li')['on']('mouseleave', function () {
         $(this)['find']('ul')['css']('display', 'none');
     });
 });


回答2:

This is called obfuscated JavaScript. It's not encrypted, it is just harder to read. You can try JSBeautifier (http://jsbeautifier.org/) to make it more readable.