Idea: Locally scoped variable can have the same mangled name
See original GitHub issueExpected Behavior
Obfuscated code can have multiple locally scoped variable name identical. I know this could be difficult to implement, it is an idea, if someone have the skills to implement this.
It would make de obfuscation much harder
Example:
var a = 2 // can't use 'a' anymore as it is in the top scope
function(b, c) {
return window[b] = c
}
for(var b = 0; b < c; b++) { // notice 'b', 'c' is also in the function, they where in local scope in the previous function
var d = 5+b
}
This would be harder to de obfuscate as a variable name can have multiple purposes.
Current Behavior
Raw code
var myvalue = 2
function(key, value) {
return window[key] = value
}
for(var i = 0; i < myvalue; i++) {
var mycounter = 5+i
}
Obfuscated code
var a = 2
function(b, c) {
return window[b] = c
}
for(var d = 0; d < e; d++) {
var e = 5+d
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Name Mangling - an overview | ScienceDirect Topics
In an all, a procedure can refer to global variables, local variables, and any variable declared in a surrounding lexical scope.
Read more >questions about name mangling in C++ - Stack Overflow
In C++, you can have two functions with the same name as long as they ... Scoping is used to control access to...
Read more >Instance Variable and Local Variable with Same Name
Answer: Yes — the scopes will not overlap so there will be two local variables, one per method, each with the same name....
Read more >Name mangling - Wikipedia
The need for name mangling arises where the language allows different entities to be named with the same identifier as long as they...
Read more >Name mangling (C++ only) - IBM
Name mangling is the encoding of function and variable names into unique names so that linkers can separate common names in the language....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In this branch, I added the new preparing transformer, called
ScopeTransformer
, that addedscope
property to all nodes.Then, in
MangledIdentifierNamesGenerator
identifiers for eachscope
are tried to generate.Much smallest minimal example with bug
Obfuscated code with error: