-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.txt
121 lines (108 loc) · 2.63 KB
/
output.txt
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
ORIGINAL
------------------------------------------------------------------------------
const acorn = require("acorn");
var a = "something else";
const something = "anything else";
var arr = new Array();
arr[0] = 1;
arr[1] = 2;
var str = "malicious code";
eval(str);
function callThisFunction(a, b) {
return a + b;
}
callThisFunction(1, 23);
let r = callThisFunction(5, 8);
let flag = 1;
if (flag === 1) {
let first = "first";
let second = "second";
} else {
let hint = "hint";
}
for (let i = 0; i < 5; i++) {
console.log("Another statement");
console.log("loop : ", i);
}
let i = 10;
while(i > 0) {
console.log("loop still going");
i--;
}
GENERATED
------------------------------------------------------------------------------
const acorn = require('acorn');
var a = function decodeString() {
let m = instanWasm(source);
let buf = m.instance.exports.memory.buffer;
let startInd = m.instance.exports.d1;
return loadStrFromBuf(buf, startInd);
}();
const something = function decodeString() {
let m = instanWasm(source);
let buf = m.instance.exports.memory.buffer;
let startInd = m.instance.exports.d1;
return loadStrFromBuf(buf, startInd);
}();
var str = function decodeString() {
let m = instanWasm(source);
let buf = m.instance.exports.memory.buffer;
let startInd = m.instance.exports.d1;
return loadStrFromBuf(buf, startInd);
}();
let m = instanWasm(source);
let buf = m.instance.exports.memory.buffer;
let startInd = m.instance.exports.d1;
window[loadStrFromBuf(buf, startInd)](str);
function callThisFunction(a, b) {
return a + b;
}
let impObj = { imports: { impFunc: () => callThisFunction(1, 23) } };
let m = instanWasm(source, impObj);
m.instance.exports.f0();
let r = callThisFunction(5, 8);
let impObj = {
imports: {
imp1: () => {
let first = 'first';
let second = 'second';
},
imp2: () => {
let hint = 'hint';
}
}
};
let flag = 1;
let m = instanWasm(source, impObj);
m.instance.exports.f(flag === 1 ? 1 : 0);
init;
let impObj = {
imports: {
cond: () => {
return i < 5 ? 1 : 0;
},
incre: () => {
i++;
},
body: () => {
console.log('Another statement');
console.log('loop : ', i);
}
}
};
let m = instanWasm(source, impObj);
m.instance.exports.f();
let i = 10;
let impObj = {
imports: {
cond: () => {
return i > 0 ? 1 : 0;
},
body: () => {
console.log('loop still going');
i--;
}
}
};
let m = instanWasm(source, impObj);
m.instance.exports.f();