Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35908 > unrolled thread

Help understanding Javascript code

Started byPraveen <praveen.bochetty@gmail.com>
First post2018-12-20 19:38 -0800
Last post2018-12-22 12:51 +0100
Articles 11 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Help understanding Javascript code Praveen <praveen.bochetty@gmail.com> - 2018-12-20 19:38 -0800
    Re: Help understanding Javascript code Andrew Poulos <ap_prog@hotmail.com> - 2018-12-21 15:08 +1100
    Re: Help understanding Javascript code Praveen <praveen.bochetty@gmail.com> - 2018-12-21 07:12 -0800
    Re: Help understanding Javascript code Praveen <praveen.bochetty@gmail.com> - 2018-12-21 07:12 -0800
      Re: Help understanding Javascript code Luuk <luuk@invalid.lan> - 2018-12-21 17:04 +0100
        Re: Help understanding Javascript code Luuk <luuk@invalid.lan> - 2018-12-21 17:06 +0100
          Re: Help understanding Javascript code Praveen <praveen.bochetty@gmail.com> - 2018-12-21 14:17 -0800
        Re: Help understanding Javascript code JJ <jj4public@vfemail.net> - 2018-12-22 06:01 +0700
          Re: Help understanding Javascript code Luuk <luuk@invalid.lan> - 2018-12-22 10:02 +0100
        Re: Help understanding Javascript code "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-12-22 12:44 +0100
          Re: Help understanding Javascript code Luuk <luuk@invalid.lan> - 2018-12-22 12:51 +0100

#35908 — Help understanding Javascript code

FromPraveen <praveen.bochetty@gmail.com>
Date2018-12-20 19:38 -0800
SubjectHelp understanding Javascript code
Message-ID<c97e5105-9290-445d-b8c6-9ac398542189@googlegroups.com>
Need help understanding this Javascript code. Is there any tool that can decode or visualize the flow?

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))

[toc] | [next] | [standalone]


#35910

FromAndrew Poulos <ap_prog@hotmail.com>
Date2018-12-21 15:08 +1100
Message-ID<iZqdnS1xuenG-oHBnZ2dnUU7-eOdnZ2d@westnet.com.au>
In reply to#35908
On 21/12/2018 2:38 pm, Praveen wrote:
> eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))

I used <https://www.strictly-software.com/unpack-javascript> to give me 
this:

function verifyInviteCode(code) {
	var formData = {
		"code": code
	};
	$.ajax({
		type: "POST",
		dataType: "json",
		data: formData,
		url: '/api/invite/verify',
		success: function (response) {
			console.log(response)
		},
		error: function (response) {
			console.log(response)
		}
	})
}
function makeInviteCode() {
	$.ajax({
		type: "POST",
		dataType: "json",
		url: '/api/invite/how/to/generate',
		success: function (response) {
			console.log(response)
		},
		error: function (response) {
			console.log(response)
		}
	})
}


Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#35915

FromPraveen <praveen.bochetty@gmail.com>
Date2018-12-21 07:12 -0800
Message-ID<b12053e6-4ec1-4484-b00d-aa365b3eb6ba@googlegroups.com>
In reply to#35908
On Thursday, December 20, 2018 at 10:39:01 PM UTC-5, Praveen wrote:
> Need help understanding this Javascript code. Is there any tool that can decode or visualize the flow?
> 
> eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))

Thank you so much Andrew. Pardon my ignorance here, how do we know that this code is packed and needs an unpacker? Is it because of this indicator "function(p,a,c,k,e,d)"?

[toc] | [prev] | [next] | [standalone]


#35916

FromPraveen <praveen.bochetty@gmail.com>
Date2018-12-21 07:12 -0800
Message-ID<58e0556f-d520-4ede-ac32-0af43f200d46@googlegroups.com>
In reply to#35908
On Thursday, December 20, 2018 at 10:39:01 PM UTC-5, Praveen wrote:
> Need help understanding this Javascript code. Is there any tool that can decode or visualize the flow?
> 
> eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))

Thank you so much Andrew. Pardon my ignorance here, how do we know that this code is packed and needs an unpacker? Is it because of this indicator "function(p,a,c,k,e,d)"?

[toc] | [prev] | [next] | [standalone]


#35917

FromLuuk <luuk@invalid.lan>
Date2018-12-21 17:04 +0100
Message-ID<5c1d0eef$0$22356$e4fe514c@news.xs4all.nl>
In reply to#35916
On 21-12-2018 16:12, Praveen wrote:
> On Thursday, December 20, 2018 at 10:39:01 PM UTC-5, Praveen wrote:
>> Need help understanding this Javascript code. Is there any tool that can decode or visualize the flow?
>>
>> eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))
> 
> Thank you so much Andrew. Pardon my ignorance here, how do we know that this code is packed and needs an unpacker? Is it because of this indicator "function(p,a,c,k,e,d)"?
> 

Basically all 'packed' code is valid Javascript, so determining if code 
is 'packed', or not, will always be hard.

A 'good' Javascript will not, or should not, use variables with just one 
letter, this is therefore the first clue that this code is packed.

But, without reading the page, you maybe want to read this on StackOverflow:
https://stackoverflow.com/questions/21423397/what-does-the-custom-functionp-a-c-k-e-d-used-for 

[toc] | [prev] | [next] | [standalone]


#35918

FromLuuk <luuk@invalid.lan>
Date2018-12-21 17:06 +0100
Message-ID<5c1d0f7a$0$22356$e4fe514c@news.xs4all.nl>
In reply to#35917
On 21-12-2018 17:04, Luuk wrote:
> On 21-12-2018 16:12, Praveen wrote:
>> On Thursday, December 20, 2018 at 10:39:01 PM UTC-5, Praveen wrote:
>>> Need help understanding this Javascript code. Is there any tool that 
>>> can decode or visualize the flow?
>>>
>>> eval(function(p,a,c,k,e,d){e=function(c){return 
>>> c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return 
>>> d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new 
>>> RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 
>>> 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 
>>> j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{})) 
>>>
>>
>> Thank you so much Andrew. Pardon my ignorance here, how do we know 
>> that this code is packed and needs an unpacker? Is it because of this 
>> indicator "function(p,a,c,k,e,d)"?
>>
> 
> Basically all 'packed' code is valid Javascript, so determining if code 
> is 'packed', or not, will always be hard.
> 
> A 'good' Javascript will not, or should not, use variables with just one 
> letter, this is therefore the first clue that this code is packed.
> 
> But, without reading the page, you maybe want to read this on 
> StackOverflow:
> https://stackoverflow.com/questions/21423397/what-does-the-custom-functionp-a-c-k-e-d-used-for 
> 
> 

typo:
But, without *me* reading the page, you maybe want to read this on 
StackOverflow

;)

[toc] | [prev] | [next] | [standalone]


#35919

FromPraveen <praveen.bochetty@gmail.com>
Date2018-12-21 14:17 -0800
Message-ID<1571cf3e-3a21-4ec3-8405-991f82d6c81e@googlegroups.com>
In reply to#35918
On Friday, December 21, 2018 at 11:06:35 AM UTC-5, Luuk wrote:
> On 21-12-2018 17:04, Luuk wrote:
> > On 21-12-2018 16:12, Praveen wrote:
> >> On Thursday, December 20, 2018 at 10:39:01 PM UTC-5, Praveen wrote:
> >>> Need help understanding this Javascript code. Is there any tool that 
> >>> can decode or visualize the flow?
> >>>
> >>> eval(function(p,a,c,k,e,d){e=function(c){return 
> >>> c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return 
> >>> d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new 
> >>> RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 
> >>> 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 
> >>> j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{})) 
> >>>
> >>
> >> Thank you so much Andrew. Pardon my ignorance here, how do we know 
> >> that this code is packed and needs an unpacker? Is it because of this 
> >> indicator "function(p,a,c,k,e,d)"?
> >>
> > 
> > Basically all 'packed' code is valid Javascript, so determining if code 
> > is 'packed', or not, will always be hard.
> > 
> > A 'good' Javascript will not, or should not, use variables with just one 
> > letter, this is therefore the first clue that this code is packed.
> > 
> > But, without reading the page, you maybe want to read this on 
> > StackOverflow:
> > https://stackoverflow.com/questions/21423397/what-does-the-custom-functionp-a-c-k-e-d-used-for 
> > 
> > 
> 
> typo:
> But, without *me* reading the page, you maybe want to read this on 
> StackOverflow
> 
> ;)

Makes sense - Thanks Luuk

[toc] | [prev] | [next] | [standalone]


#35922

FromJJ <jj4public@vfemail.net>
Date2018-12-22 06:01 +0700
Message-ID<yewrgtei2mq5$.hgpuqsrvrc5k.dlg@40tude.net>
In reply to#35917
On Fri, 21 Dec 2018 17:04:05 +0100, Luuk wrote:
> 
> Basically all 'packed' code is valid Javascript, so determining if code 
> is 'packed', or not, will always be hard.
> 
> A 'good' Javascript will not, or should not, use variables with just one 
> letter, this is therefore the first clue that this code is packed.

IMO, it's more like obfuscated, rather than packed. As long as only
whitespaces are removed and no variable/function names are shortened to the
point that they're meaningless, and/or the code is refactored without adding
unnecessary/indirect code, it'd be code packing. Any more than that would be
code obfuscation - even if it would result to a shorter code.

[toc] | [prev] | [next] | [standalone]


#35923

FromLuuk <luuk@invalid.lan>
Date2018-12-22 10:02 +0100
Message-ID<5c1dfd9d$0$22338$e4fe514c@news.xs4all.nl>
In reply to#35922
On 22-12-2018 00:01, JJ wrote:
> On Fri, 21 Dec 2018 17:04:05 +0100, Luuk wrote:
>>
>> Basically all 'packed' code is valid Javascript, so determining if code
>> is 'packed', or not, will always be hard.
>>
>> A 'good' Javascript will not, or should not, use variables with just one
>> letter, this is therefore the first clue that this code is packed.
> 
> IMO, it's more like obfuscated, rather than packed. As long as only
> whitespaces are removed and no variable/function names are shortened to the
> point that they're meaningless, and/or the code is refactored without adding
> unnecessary/indirect code, it'd be code packing. Any more than that would be
> code obfuscation - even if it would result to a shorter code.
> 

Obfuscated or packed has different goals.

The (orriginal?) goals was to minimize network traffic, which only makes 
sence if you have a-lot-of hits.

[toc] | [prev] | [next] | [standalone]


#35926

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-12-22 12:44 +0100
Message-ID<XnsA9C0818847508eejj99@194.109.6.166>
In reply to#35917
Luuk <luuk@invalid.lan> wrote on 21 Dec 2018 in comp.lang.javascript:

> A 'good' Javascript will not, or should not, use variables with just one 
> letter, this is therefore the first clue that this code is packed.

What is "a" Javascript, and how can it be good or bad?

Probably, Luuk, you meant:

"A 'good' Javascript script will not, ..."

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#35927

FromLuuk <luuk@invalid.lan>
Date2018-12-22 12:51 +0100
Message-ID<5c1e254e$0$22364$e4fe514c@news.xs4all.nl>
In reply to#35926
On 22-12-2018 12:44, Evertjan. wrote:
> Luuk <luuk@invalid.lan> wrote on 21 Dec 2018 in comp.lang.javascript:
> 
>> A 'good' Javascript will not, or should not, use variables with just one
>> letter, this is therefore the first clue that this code is packed.
> 
> What is "a" Javascript, and how can it be good or bad?
> 
> Probably, Luuk, you meant:
> 
> "A 'good' Javascript script will not, ..."
> 

;)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web