11 ms·
Reverse Engineering One Line of JavaScript
- zspitzer 9y agoI'd forgotten that setInterval will evaluate a string
- dynamoa 9y agoIsn't this called un-obfuscating rather than reverse engineering?
- ouid 9y agoare those concepts really that different?
- rf15 9y agoreverse engineering is usually about trying to understand a partially/mostly concealed system/interface, while for this case everything is already visible, but hard to understand.
- asherkin 9y agoBy that definition, analyzing compiled native code would be "un-obfuscating". IMO, deobfuscation is a subset of reverse engineering - which at a push I would define as "taking a program from the form it is distributed into a preferred form for modification/understanding".
- nimchimpsky 9y agoIt's JavaScript we can call it whatever ... reverse transpilation. I bet there are a myriad frameworks to do it aswell. Deobsufucizer.js Reverse-sj.io
- zaptheimpaler 9y agohttps://github.com/beautify-web/js-beautify https://github.com/beautify-web/js-beautify
- Dirlewanger 9y agoSeriously. I didn't think the article was going to be just prettifying a 1 liner by hand. Looking back, it's actually cringe-y that he calls this reverse engineering. You know what real reverse engineering is? Figuring out the code from the output image only.
- voltagex_ 9y agoHold on - would you say unpacking something packed by e.g. UPX by hand (silly example) wouldn't be reverse engineering? This is just unpacking a packed program, which definitely is reverse engineering.
- christophilus 9y agoI'd say it fits Wikipedia's definition of reverse engineering pretty well: "The process often involves disassembling something ... and analyzing its components and workings in detail."
- cyberferret 9y agoNice. But it does highlight a trend in modern programming languages such as Ruby etc. where these one line shorthand methods are used to such an extent these days that new programmers to the project have to spend an inordinate amount of time reverse engineering some of these shortcuts to make sense of program flow and understand the program in their heads. Take the simple, quick initialiser: foo ||= 1 Instead of the more verbose if foo.nil? foo = 1 end Undoubtedly, the first line is a much cooler version, but like skinny jeans was once cool - getting in and out of them far outweighed the cool factor.
- methyl 9y agoI can't agree, if you are a Ruby programmer you immediately know what's going on in the first line and it's definitely more readable - you see it at a glance instead of having to scan three lines.
- onion2k 9y agoif you are a Ruby programmer cyberferret explicitly said it's a good idea to avoid shorthand methods because new programmers don't understand them, and you're making the argument that they're OK because experienced programmers will understand them. The essence of your argument is that if you've used the language enough to know what the or-equals statement means then you'll know what it means. I'm not convinced that's a good reason.
- vortico 9y agoFor that specific example though, it's so common in the colloquial Ruby language that all normal Ruby programmers should learn and use it. If you're just taking about readability, the time saved skimming during your career is worth the time spent learning the idiom once in your life.
- joshumax 9y agoCyberferrit said new programmers to the project, not specifically new to the language or programming itself. Working on emulation software I commonly run across snippets such as `res = !!iRegisterVal` which results in some C newbies scratching their heads as to why a useless double negation would be there. But for more seasoned developers its intent can pretty easily recognized...
- thinkMOAR 9y agoNeat, enjoyable read for the friday afternoon. Q: Whats that math/graphing app you have screenshots of?