Skip to content

Commit 5fe279a

Browse files
committed
fix: 修复xml提取问题
1 parent e3a0830 commit 5fe279a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

internal/unpack/uxml.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,18 @@ func (p *XmlParser) Parse(option config.WxapkgInfo) error {
261261
codeStr := string(code)
262262
scriptCode := codeStr
263263

264-
scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", 1)
265-
scriptCode = strings.Replace(scriptCode, "var noCss", "var noCss2", -1)
266-
267264
// 防止报错
268-
patch := `var noCss=true;var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};document={};function define(){};function require(){};`
265+
patch := `var noCss=true;var window={};var navigator={};navigator.userAgent="iPhone";window.screen={};
266+
document={getElementsByTagName:()=>{}};function define(){};function require(){};`
269267

270268
// 如果是 html 文件,提取 script 代码
271269
if strings.HasSuffix(frameFile, ".html") {
272270
scriptCode = matchScripts(codeStr)
273271
}
274272

273+
scriptCode = strings.Replace(scriptCode, "var setCssToHead =", "var setCssToHead2 =", 1)
274+
scriptCode = strings.Replace(scriptCode, "var noCss", "var noCss2", -1)
275+
275276
// 正则匹配生成函数
276277
getFuc(scriptCode, gwx)
277278

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func main() {
5050
| |\ \| | | | \ / / /_/ / (_| \__ \ <| | | |
5151
\_| \_/_|_|_| \/ \__,_|\__,_|___/_|\_\_| |_|
5252
53-
Wxapkg Decompiler Tool v2.2.1
53+
Wxapkg Decompiler Tool v2.3.0
5454
`
5555
fmt.Println(banner)
5656

0 commit comments

Comments
 (0)