unminify
Version 2.0.0
一個小項目,可以撤消JavaScript構建工具對JavaScript做出的可怕的幾件事。除了撤消大多數縮小外,它還逆轉了野外使用的一些愚蠢但令人驚訝的“混淆”技術。
我可能會嘗試一下,例如,我發現的這片javascript隨機。
npm install -g unminify
或在不通過npx安裝的情況下使用它(自npm 5.2.0以來可用)
npx unminify [...args]
unminify /path/to/file.js
--safety可以根據用戶的要求安全保證來啟用/禁用轉換。有關更多詳細信息,請參閱安全級文檔。 --safety的價值可能是uselesssafe (默認)mostly-safeunsafewildly-unsafe--additional-transform零次或更多次,每個次接下來是通往模塊提供AST變換的路徑;函數信號表明未通過返回其輸入來應用轉換 let { unminifySource } = require ( 'unminify' ) ;
let sourceText = '/* a minified/"obfuscated" JavaScript program */' ;
console . log ( unminify ( sourceText ) ) ;
// or, with options
console . log ( unminifySource ( sourceText , {
safety : unminify . safetyLevels . UNSAFE ,
additionalTransforms : [ function ( ast ) { /* ... */ } ] ,
} ) ) ;如果您已經有了一棵Shift樹,則可以使用unminifyTree避免使用Codegen和Reparse成本。
let { parseScript } = require ( 'shift-parser' ) ;
let { unminifyTree } = require ( 'unminify' ) ;
let sourceText = '/* a minified/"obfuscated" JavaScript program */' ;
let tree = parseScript ( sourceText ) ;
let unminifiedTree = unminifyTree ( tree ) ; Copyright 2017 Shape Security, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.