Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

JavaScript obfuscation method based on syntax tree AST editing

A syntax tree and editing technology, applied in the field of JavaScript obfuscation, to achieve the effect of improving protection, increasing the difficulty of cracking, and increasing the difficulty

Pending Publication Date: 2022-03-29
胡云锋
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0008] Although "code obfuscation" is safer and more flexible than the other two, it still has major disadvantages
Common code obfuscation is obfuscated by methods such as renaming local variables, constant replacement, and simple string transcoding, but strings such as attribute values ​​and object method names / attribute names still appear in the code, which is easy for experienced attackers Guess the code and the functions involved to crack it

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • JavaScript obfuscation method based on syntax tree AST editing
  • JavaScript obfuscation method based on syntax tree AST editing
  • JavaScript obfuscation method based on syntax tree AST editing

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0059] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention.

[0060] The invention provides a JavaScript obfuscation method realized based on syntax tree AST editing, comprising the following steps:

[0061] S1. Analyze and generate AST syntax tree: compress JavaScript source code to remove redundant code, analyze and generate AST syntax tree;

[0062] S2. Edit and transform the syntax: traverse the AST syntax tree, and edit and transform the syntax in it;

[0063] S3. Create an array arrayA, and extract the character string of the AST syntax tree, and convert it into a data dictionary of a two-dimensional array through a specific algorithm;

[0064] S4. Create a decoding method, and randomly insert the decoding method and the...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

A JavaScript obfuscation method based on syntax tree AST editing comprises the following steps that JavaScript source codes are compressed to remove redundant codes, and an AST syntax tree is generated through analysis; traversing the AST syntax tree, and editing and converting the grammar in the AST syntax tree; creating an array array A, extracting a character string of the AST syntax tree, and converting the character string into a data dictionary of a two-dimensional array through a specific algorithm; a decoding method is created, and the decoding method and the random redundancy method are randomly inserted into the array A in the previous step; creating a self-execution method funtionF, transmitting the parameters of the two-dimensional array array A as arguments into the self-execution method funtionF, and combining the decoding method with the self-execution method funtionF to generate a new AST syntax tree; all character string nodes in the original AST syntax tree are converted into a decoding method Function H; the original AST syntax tree is inserted into the new AST syntax tree to replace all digits and variables, and the new AST syntax tree of a brand new structure is obtained; the new AST syntax tree is restored into the JavaScript code, and after blank space line feed compression is removed, the JavaScript code is output to obtain an obfuscated code.

Description

technical field [0001] The invention relates to the technical field of computer and communication, in particular to a JavaScript obfuscation method implemented based on syntax tree AST editing. Background technique [0002] JavaScript is a programming language that runs on web browsers. It is mainly added to websites built using HTML (Hyper Text Markup Language) and CSS (Cascading Style Sheets). The role of page dynamic effects. For example, the effect of the carousel image displayed on the webpage and the prompt information displayed after the wrong content is entered on the consulting platform. In addition, when purchasing products on the mall website, JavaScript is also required for using the shopping cart and cost estimation. So even if it’s not obvious, it’s still a language that coders use a lot, and JavaScript is the most important programming language for front-end web development. [0003] In the early days of web (World Wide Web, global wide area network, also k...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F8/41
CPCG06F8/434G06F8/42
Inventor 胡云锋
Owner 胡云锋
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products