有没有 JavaScript 去混淆器(deobfuscator)之类的东西?

发布于 2024-08-04 05:20:23 字数 1539 浏览 9 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

不奢求什么 2024-08-11 05:20:23

试试这个:JS Beautifier

Try this: JS Beautifier

您的好友蓝忘机已上羡 2024-08-11 05:20:23

尝试 http://www.jsnice.org/

我只是偶然发现它,它很棒。它扩展了代码。它具有统计变量重命名功能。例如,如果您有以下代码:

var g = f.originalEvent.targetTouches[0];

那么它会将您的代码变成:

var touches = event.originalEvent.targetTouches[0];

我认为这是很好的猜测。

它变成了这样:

d.slide.hasClass("selected") ? (e.onSlideOpen.call(d.prev.children("div")[0]), q ? (e.rtl && d.slide.position().left > i.w / 2 || d.slide.position().left < i.w / 2) && h.animateSlide.call(d) : t && d.index ? (h.animateGroup(d, !0), h.fitToContent(d.prev)) : d.slide.position().top < i.h / 2 && h.animateSlide.call(d)) : (setTimeout(function() { e.onSlideOpen.call(d.slide.children("div")[0]) }, e.slideSpeed), h.animateGroup(d), t && h.fitToContent(d.slide)), e.autoPlay && (f.stop(), f.play(l.index(j.filter(".selected"))))

if (e.slide.hasClass("selected")) {
    settings.onSlideOpen.call(e.prev.children("div")[0]);
    if (val) {
      if (settings.rtl && e.slide.position().left > box.w / 2 || e.slide.position().left < box.w / 2) {
        self.animateSlide.call(e);
      }
    } else {
      if (isMac && e.index) {
        self.animateGroup(e, true);
        self.fitToContent(e.prev);
      } else {
        if (e.slide.position().top < box.h / 2) {
          self.animateSlide.call(e);
        }
      }
    }
  } else {
    setTimeout(function() {
      settings.onSlideOpen.call(e.slide.children("div")[0]);
    }, settings.slideSpeed);
    self.animateGroup(e);
    if (isMac) {
      self.fitToContent(e.slide);
    }
  }
  if (settings.autoPlay) {
    node.stop();
    node.play(tabs.index(options.filter(".selected")));
  }

正在开发的一个库有几个错误,在花了几个小时尝试破译代码后,发现这一点将为我节省大量时间。

说真的,这个工具用 JS Beautifier 来擦地板。

Try http://www.jsnice.org/

I just stumbled on it and it is great. It expands the code. It has statistical variable renaming. for example, if you have this code:

var g = f.originalEvent.targetTouches[0];

Then it it turns your code into:

var touches = event.originalEvent.targetTouches[0];

Pretty good guess, methinks.

It turned this:

d.slide.hasClass("selected") ? (e.onSlideOpen.call(d.prev.children("div")[0]), q ? (e.rtl && d.slide.position().left > i.w / 2 || d.slide.position().left < i.w / 2) && h.animateSlide.call(d) : t && d.index ? (h.animateGroup(d, !0), h.fitToContent(d.prev)) : d.slide.position().top < i.h / 2 && h.animateSlide.call(d)) : (setTimeout(function() { e.onSlideOpen.call(d.slide.children("div")[0]) }, e.slideSpeed), h.animateGroup(d), t && h.fitToContent(d.slide)), e.autoPlay && (f.stop(), f.play(l.index(j.filter(".selected"))))

Into this:

if (e.slide.hasClass("selected")) {
    settings.onSlideOpen.call(e.prev.children("div")[0]);
    if (val) {
      if (settings.rtl && e.slide.position().left > box.w / 2 || e.slide.position().left < box.w / 2) {
        self.animateSlide.call(e);
      }
    } else {
      if (isMac && e.index) {
        self.animateGroup(e, true);
        self.fitToContent(e.prev);
      } else {
        if (e.slide.position().top < box.h / 2) {
          self.animateSlide.call(e);
        }
      }
    }
  } else {
    setTimeout(function() {
      settings.onSlideOpen.call(e.slide.children("div")[0]);
    }, settings.slideSpeed);
    self.animateGroup(e);
    if (isMac) {
      self.fitToContent(e.slide);
    }
  }
  if (settings.autoPlay) {
    node.stop();
    node.play(tabs.index(options.filter(".selected")));
  }

A library I'm working on has a couple of bugs, and after spending hours trying to decipher the code, finding this is going to save me a bunch of time.

Seriously, this tool wipes the floor with JS Beautifier.

悲欢浪云 2024-08-11 05:20:23

呃,除非存在 minified -> 的映射,否则不可能恢复变量名。可用原始变量名称。否则,我认为该工具的作者可能会因灵异功绩而赢得兰迪奖。

Uhhh, it would be impossible to restore variable names unless there was a mapping of minified -> original variable names available. Otherwise, I think the authors of that tool could win the Randi prize for psychic feats.

橘虞初梦 2024-08-11 05:20:23

您将无法重建方法名称或变量名称。您所能期望的最好的结果是一个简单的 JS 代码格式化程序(如前面提到的那样),然后逐行检查文件的方法,找出每个部分的作用。

也许使用一个好的 JS 重构工具也会让这变得更容易(能够重命名/记录方法)

You will not be able to reconstruct method name or variable names. The best you can hope for is a simple JS code formater (like those previously mentioned), and then to go through the file method by method, line by line, working out what each part does.

Perhaps using a good JS refactoring tool would make this easier as well (being able to rename/document methods)

葬花如无物 2024-08-11 05:20:23

请参阅我们的 SD ECMAScript Formatter,了解可以很好地格式化代码的工具。

编辑:如果您想反转重命名过程,您需要一些东西可以将混淆的名称重命名回原始名称。

从技术上讲,该工具可以做到这一点:SD Thicket ECMAScript Obfuscator

它通过应用您可以精确控制的重命名映射来实现这一点。
通常,您可以在混淆过程中通过选择要混淆的名称和要保留的名称来隐式构造这样的映射,然后混淆器应用该映射来生成混淆的代码。

当您进行混淆时,Thicket 混淆器会生成此映射作为副作用
本质上是一组对的形式(原始名称,混淆名称)
供参考和调试之用。

交换元素给出映射(混淆名称,原始名称)。 Thicket 可以应用该倒排映射从混淆的代码中恢复具有原始名称的代码。 Thicket 混淆器包含格式化程序,可让您使其再次看起来漂亮。

“反转缩小”的问题(正如你说得不好,你试图反转混淆)是你需要地图。由于进行混淆的人不会泄露地图,因此作为混淆代码的接收者,您没有任何可应用的内容。想要成为海盗的人可能必须通过痛苦的逆向工程来重建地图。

“逆转”过程也无法恢复评论。他们永远消失了。

这都是设计使然,所以真正的问题是为什么要寻求逆向混淆?

See our SD ECMAScript Formatter for a tool that will nicely format code.

EDIT: If you want to reverse the renaming process you need something can rename the obfuscated names back to the originals.

This tool can technically do that: SD Thicket ECMAScript Obfuscator.

It does so by applying a renaming map over which you have precise control.
Typically you implicitly construct such a map during the obfuscation process by choosing which names to obfuscate and which to preserve, and the obfuscator applies that map to produce the obfuscated code.

The Thicket obfuscator generates this map as side effect when you obfuscate
in the form essentially of a set of pairs (originalname,obfuscatedname)
for reference and debugging purposes.

Swapping elements gives the map (obfuscatedname,originalname). That inverted map can be applied by Thicket to recover the code with the original names, from the obfuscated code. And the Thicket obfuscator includes the Formatter to let you make it look nice again.

The catch to "reversing minification" (as you put it poorly, you are trying to reverse obfuscation), is that you need the map. Since people doing obfuscation don't give away the map, you, as a recipient of obfuscated code, have nothing to apply. A would-be pirate would have to reconstruct the map presumably by painful reverse engineering.

The "reversing" process also can't recover comments. They're gone forever.

This is all by design, so the real question is why are you looking to reverse obfuscation?

栀子花开つ 2024-08-11 05:20:23

您可以在正则表达式中使用 \b(字边界)功能来查找文件中的单字母变量名称。

for i in "abcdefghij..z"; do
    sed -i "s/\b$i\b/$(random /usr/share/dict/words)/g" somefile.js
done

您还可以在 vim 中使用类似 :%s/\/truesaiyanpower/g 的内容。

You can use the \b (word boundary) feature in regular expressions to find single-letter variable names in a file.

for i in "abcdefghij..z"; do
    sed -i "s/\b$i\b/$(random /usr/share/dict/words)/g" somefile.js
done

You can also use this in vim with something like :%s/\<a\>/truesaiyanpower/g.

笑着哭最痛 2024-08-11 05:20:23

要取消缩小 JavaScript 文件,Unminify 将是最好的!

To unminify JavaScript files, Unminify would be the best!

呆° 2024-08-11 05:20:23

要取消缩小 CSS、HTML 和 JavaScript 文件,您可以使用 UnminifyUnminify JS在线工具!

To unminify CSS, HTML and JavaScript files, you can use the Unminify or Unminify JS online tools!

水中月 2024-08-11 05:20:23

JavaScript 压缩器和 JavaScript 混淆器是两个不同的东西。

Minifier - 从程序中删除注释、不必要的空格和换行符。

混淆器 - 对程序进行修改,更改变量、函数和成员的名称,使程序更难理解。一些混淆器对代码的修改非常激进。

这个 JavaScript 混淆器 会混淆您的代码。

如果您想对代码进行反混淆,请尝试 JavaScript Beautifier。如果发现混淆就会进行反混淆,然后美化代码。

A JavaScript minifier and JavaScript obfuscator are two different things.

Minifier - removes the comments, unnecessary whitespace and newlines from a program.

Obfuscator - make modifications to the program, changing the names of variables, functions, and members, making the program much harder to understand. Some obfuscators are quite aggressive in their modifications to code.

This JavaScript obfuscator will obfuscate your code.

If you want to deobfuscate your code, try JavaScript Beautifier. It will deobfuscate if obfuscation is found and then beautify the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文