首页
社区
课程
招聘
[未解决,已结帖] [求助]论坛有没有大佬研究js栈式虚拟机 求逆向原理和过程 1000.00雪花
发表于: 2020-10-5 17:38 5758

[未解决,已结帖] [求助]论坛有没有大佬研究js栈式虚拟机 求逆向原理和过程 1000.00雪花

2020-10-5 17:38
5758

某鹅厂的的一个js栈式虚拟机 链接地址
有点类似论坛 StriveMario 大佬写的 [原创] 给"某音"的js虚拟机写一个编译器
自己捣鼓了半天也没研究出个啥 主要是不懂这些堆栈怎么还原成代码的
丢浏览器执行就发现增加了下面这些方法 (可能不全中途报错了 没执行完

寻求论坛大佬弄个类似上面的编译器 把里面 __TENCENT_CHAOS_VM 执行的部分还原成可读的代码

js虚拟机

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
function __TENCENT_CHAOS_VM(n, t, o, p, e) {
    if (n > 120731)
        throw "version is too low (require " + n + ", current 120731)";
    e = e || [[this], [{}]];
    for (var u = [], i = null, h = ([function() {
        return !0
    }
    , function() {}
    , function() {
        e.length = o[t++]
    }
    , function() {
        e.push(o[t++])
    }
    , function() {
        e.pop()
    }
    , function() {
        var n = o[t++]
          , p = e[e.length - 2 - n];
        e[e.length - 2 - n] = e.pop(),
        e.push(p)
    }
    , function() {
        e.push(e[e.length - 1])
    }
    , function() {
        e.push([e.pop(), e.pop()].reverse())
    }
    , function() {
        e.push([p, e.pop()])
    }
    , function() {
        e.push([e.pop()])
    }
    , function() {
        var n = e.pop();
        e.push(n[0][n[1]])
    }
    , function() {
        e.push(e[e.pop()[0]][0])
    }
    , function() {
        var n = e[e.length - 2];
        n[0][n[1]] = e[e.length - 1]
    }
    , function() {
        e[e[e.length - 2][0]][0] = e[e.length - 1]
    }
    , function() {
        var n = e.pop()
          , t = e.pop();
        e.push([t[0][t[1]], n])
    }
    , function() {
        var n = e.pop();
        e.push([e[e.pop()][0], n])
    }
    , function() {
        var n = e.pop();
        e.push(delete n[0][n[1]])
    }
    , function() {
        var n = [];
        for (var t in e.pop())
            n.push(t);
        e.push(n)
    }
    , function() {
        e[e.length - 1].length ? e.push(e[e.length - 1].shift(), !0) : e.push(void 0, !1)
    }
    , function() {
        var n = e[e.length - 2]
          , t = Object.getOwnPropertyDescriptor(n[0], n[1]) || {
            configurable: !0,
            enumerable: !0
        };
        t.get = e[e.length - 1],
        Object.defineProperty(n[0], n[1], t)
    }
    , function() {
        var n = e[e.length - 2]
          , t = Object.getOwnPropertyDescriptor(n[0], n[1]) || {
            configurable: !0,
            enumerable: !0
        };
        t.set = e[e.length - 1],
        Object.defineProperty(n[0], n[1], t)
    }
    , function() {
        t = o[t++]
    }
    , function() {
        var n = o[t++];
        e[e.length - 1] && (t = n)
    }
    , function() {
        throw e[e.length - 1]
    }
    , function() {
        var n = o[t++]
          , u = n ? e.slice(-n) : [];
        e.length -= n,
        e.push(e.pop().apply(p, u))
    }
    , function() {
        var n = o[t++]
          , p = n ? e.slice(-n) : [];
        e.length -= n;
        var u = e.pop();
        e.push(u[0][u[1]].apply(u[0], p))
    }
    , function() {
        var n = o[t++]
          , p = n ? e.slice(-n) : [];
        e.length -= n,
        p.unshift(null),
        e.push(new (Function.prototype.bind.apply(e.pop(), p)))
    }
    , function() {
        var n = o[t++]
          , p = n ? e.slice(-n) : [];
        e.length -= n,
        p.unshift(null);
        var u = e.pop();
        e.push(new (Function.prototype.bind.apply(u[0][u[1]], p)))
    }
    , function() {
        e.push(!e.pop())
    }
    , function() {
        e.push(~e.pop())
    }
    , function() {
        e.push(_typeof(e.pop()))
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] == e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] === e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] > e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] >= e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] << e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] >> e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] >>> e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] + e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] - e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] * e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] / e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] % e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] | e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] & e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] ^ e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2]in e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2]instanceof e.pop()
    }
    , function() {
        e[e[e.length - 1][0]] = void 0 === e[e[e.length - 1][0]] ? [] : e[e[e.length - 1][0]]
    }
    , function() {
        for (var u = o[t++], i = [], h = o[t++], f = o[t++], l = [], c = 0; c < h; c++)
            i[o[t++]] = e[o[t++]];
        for (var r = 0; r < f; r++)
            l[r] = o[t++];
        e.push(function t() {
            var e = i.slice(0);
            e[0] = [this],
            e[1] = [arguments],
            e[2] = [t];
            for (var h = 0; h < l.length && h < arguments.length; h++)
                l[h] > 0 && (e[l[h]] = [arguments[h]]);
            return __TENCENT_CHAOS_VM(n, u, o, p, e)
        })
    }
    , function() {
        u.push([o[t++], e.length, o[t++]])
    }
    , function() {
        u.pop()
    }
    , function() {
        return !!i
    }
    , function() {
        i = null
    }
    , function() {
        e[e.length - 1] += String.fromCharCode(o[t++])
    }
    , function() {
        e.push("")
    }
    , function() {
        e.push(void 0)
    }
    , function() {
        e.push(null)
    }
    , function() {
        e.push(!0)
    }
    , function() {
        e.push(!1)
    }
    , function() {
        e.length -= o[t++]
    }
    , function() {
        e[e.length - 1] = o[t++]
    }
    , function() {
        var n = e.pop()
          , t = e[e.length - 1];
        t[0][t[1]] = e[n[0]][0]
    }
    , function() {
        var n = e.pop()
          , t = e[e.length - 1];
        t[0][t[1]] = n[0][n[1]]
    }
    , function() {
        var n = e.pop()
          , t = e[e.length - 1];
        e[t[0]][0] = e[n[0]][0]
    }
    , function() {
        var n = e.pop()
          , t = e[e.length - 1];
        e[t[0]][0] = n[0][n[1]]
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] < e.pop()
    }
    , function() {
        e[e.length - 2] = e[e.length - 2] <= e.pop()
    }
    ]); ; )
        try {
            for (; !h[o[t++]](); )
                ;
            if (i)
                throw i;
            return e.pop()
        } catch (n) {
            var f = u.pop();
            //console.log(f, u);
            if (void 0 === f)
                throw n;
            i = n,
            t = f[0],
            e.length = f[1],
            f[2] && (e[f[2]][0] = i)
        }
}
function _typeof(n) {
    "@babel/helpers - typeof";
    return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(n) {
        return typeof n
    }
    : function(n) {
        return n && "function" == typeof Symbol && n.constructor === Symbol && n !== Symbol.prototype ? "symbol" : typeof n
    }
    )(n)
}
!function(n) {
    ("object" == ("undefined" == typeof exports ? "undefined" : _typeof(exports)) && "undefined" != typeof module ? exports : window).__TENCENT_CHAOS_VM = n
}(__TENCENT_CHAOS_VM);

执行的代码 太长删了一部分 完整的看附件

1
__TENCENT_CHAOS_VM(120731, 0, [2, 8, 3, 2, 9, 48, 61, 3, 9, 48, 61, 4, 9, 48, 61, 5, 9, 48, 61, 6, 9, 48, 61, 7 太长... 1, 4, 56, 0], window);

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

最后于 2020-10-6 13:34 被mcpan编辑 ,原因:
上传的附件:
收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 6964
活跃值: (3241)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
一个简单的编译器前端,根据生成的语法树,转成不同的后端代码。
如果你有编译器开发的经验,应该很简单。
2020-10-13 08:31
0
雪    币: 191
活跃值: (176)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
yufb 一个简单的编译器前端,根据生成的语法树,转成不同的后端代码。 如果你有编译器开发的经验,应该很简单。
有成品吗?
2020-10-13 11:17
0
游客
登录 | 注册 方可回帖
返回
//