-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbin3_disasm.txt
257 lines (257 loc) · 7.64 KB
/
bin3_disasm.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
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
bin3
Entries on strings table: 5
Entries on symbols table: 16
Strings: ['Incoming...', '\n', 'Mangled: ', 'Flag: ', 'Zipped: ']
Symbols: ['mangled', 'flag', '-first', 'pair', '-second', 'gen-reverser',
'counter', 'modu', 'res', 'zip', 'what-one', 'what-two', 'map',
'with', 'what', 'zipped']
Tapes: 7
----------------------------------
Tape id: 0 | Length: 963
0x0 PUSHI 0xaa
0x9 PUSHI 0x57
0x12 PUSHI 0x76
0x1b PUSHI 0x50
0x24 PUSHI 0x3e
0x2d PUSHI 0xd4
0x36 PUSHI 0xf3
0x3f PUSHI 0x8a
0x48 PUSHI 0xe4
0x51 PUSHI 0xd5
0x5a PUSHI 0xc6
0x63 PUSHI 0x7
0x6c PUSHI 0x12
0x75 PUSHI 0xd
0x7e PUSHI 0x82
0x87 PUSHI 0xc9
0x90 PUSHI 0x59
0x99 PUSHI 0x52
0xa2 PUSHI 0xa2
0xab PUSHI 0x17
0xb4 PUSHI 0xc0
0xbd PUSHI 0x7b
0xc6 PUSHI 0x5d
0xcf PUSHI 0x5a
0xd8 PUSHI 0xc
0xe1 PUSHI 0x52
0xea PUSHI 0x18
0xf3 PUSHI 0xfa
0xfc PUSHI 0x6c
0x105 PUSHI 0xd2
0x10e PUSHI 0x9e
0x117 PUSHI 0x36
0x120 LIST 0x20 ; create list of 32 integers
0x129 DECLARE 0x0
0x132 STORETOP 0x0 ; store list1 to 0x0
0x13b PUSHUNIT ; push unit (empty list) to value stack
0x13c PUSHI 0xd4
0x145 PUSHI 0x74
0x14e PUSHI 0x17
0x157 PUSHI 0x23
0x160 PUSHI 0x56
0x169 PUSHI 0xa9
0x172 PUSHI 0xb3
0x17b PUSHI 0xfb
0x184 PUSHI 0x97
0x18d PUSHI 0xa7
0x196 PUSHI 0xa6
0x19f PUSHI 0x71
0x1a8 PUSHI 0x7d
0x1b1 PUSHI 0x58
0x1ba PUSHI 0x1e
0x1c3 PUSHI 0xa9
0x1cc PUSHI 0x2c
0x1d5 PUSHI 0xf
0x1de PUSHI 0xfe
0x1e7 PUSHI 0x77
0x1f0 PUSHI 0xda
0x1f9 PUSHI 0x17
0x202 PUSHI 0x3b
0x20b PUSHI 0x33
0x214 PUSHI 0x67
0x21d PUSHI 0x2b
0x226 PUSHI 0x2d
0x22f PUSHI 0xc7
0x238 PUSHI 0x32
0x241 PUSHI 0x94
0x24a PUSHI 0xde
0x253 PUSHI 0x60
0x25c LIST 0x20
0x265 DECLARE 0x1
0x26e STORETOP 0x1 ; store list2 to 0x1
0x277 PUSHUNIT ; push unit (empty list) to value stack
0x278 DECLARE 0x2
0x281 PUSHCLOSURE 0x1
0x28a STORETOP 0x2 ; store tape_1 to 0x2
0x293 PUSHUNIT ; push unit (empty list) to value stack
0x294 DECLARE 0x4
0x29d PUSHCLOSURE 0x2
0x2a6 STORETOP 0x4 ; store tape_2 to 0x4
0x2af PUSHUNIT ; push unit (empty list) to value stack
0x2b0 DECLARE 0x5
0x2b9 PUSHCLOSURE 0x3
0x2c2 STORETOP 0x5 ; store tape_3 to 0x5
0x2cb PUSHUNIT
0x2cc DECLARE 0x9
0x2d5 PUSHCLOSURE 0x5
0x2de STORETOP 0x9 ; store tape_5 to 0x9
0x2e7 PUSHUNIT
0x2e8 DECLARE 0xc
0x2f1 PUSHCLOSURE 0x6
0x2fa STORETOP 0xc ; store tape_6 to 0xc
0x303 PUSHUNIT
0x304 PUSHSTR 0x0 ; 'Incoming...'
0x30d PRINT
0x30e PUSHSTR 0x1 ; '\n'
0x317 PRINT
0x318 PUSHUNIT
0x319 PUSHSTR 0x2 ; 'Mangled'
0x322 PRINT
0x323 PUSHSY 0x0 ; 'mangled'
0x32c PRINT
0x32d PUSHSTR 0x1 ; '\n'
0x336 PRINT
0x337 PUSHUNIT
0x338 PUSHSTR 0x3 ; 'Flag: '
0x341 PRINT
0x342 PUSHSY 0x1 ; 'flag'
0x34b PRINT
0x34c PUSHSTR 0x1 ; '\n'
0x355 PRINT
0x356 PUSHUNIT ; push empty list to value stack
0x357 PUSHSY 0x1 ; arg2 (list2)
0x360 PUSHSY 0x0 ; arg1 (list1)
0x369 PUSHSY 0x9
0x372 CALL ; call tape_5 (zip list1 and list2)
0x373 DECLARE 0xf
0x37c STORETOP 0xf ; save to symbols (replace 'zipped')
0x385 PUSHUNIT ; push empty list to value stack
0x386 PUSHSTR 0x4 ; 'Zipped: '
0x38f PRINT
0x390 PUSHSY 0xf ; 'zipped'
0x399 PRINT
0x39a PUSHSTR 0x1 ; '\n'
0x3a3 PRINT
0x3a4 PUSHUNIT ; push empty list to value stack
0x3a5 PUSHSY 0xf ; zipped list
0x3ae PUSHSY 0x5
0x3b7 CALL ; call tape_3 (get tape_4 id & reset counter)
0x3b8 PUSHSY 0xc
0x3c1 CALL ; call tape_6
0x3c2 HLT
----------------------------------
Tape id: 1 | Length: 29 ; get first item of list
0x0 DECLARE 0x3
0x9 STORE 0x3
0x12 PUSHSY 0x3
0x1b HEAD
0x1c RET
----------------------------------
Tape id: 2 | Length: 30 ; remove 1st item and return 2nd item from list
0x0 DECLARE 0x3
0x9 STORE 0x3
0x12 PUSHSY 0x3
0x1b TAIL ; remove 1st item from list
0x1c HEAD ; get 1st item from list
0x1d RET
----------------------------------
Tape id: 3 | Length: 39 ; get tape_4 id & reset counter
0x0 NEWENV
0x1 DECLARE 0x6
0xa PUSHI 0x0 ; push integer 0x0
0x13 STORE 0x6 ; store it in 0x6 (counter)
0x1c PUSHCLOSURE 0x4 ; push tape_4
0x25 DEPARTENV
0x26 RET
----------------------------------
Tape id: 4 | Length: 184 ; decrypt
0x0 DECLARE 0x3
0x9 STORE 0x3 ; store arg1
0x12 NEWENV
0x13 DECLARE 0x7
0x1c PUSHI 0x8 ; integer 8
0x25 PUSHSY 0x6 ; counter
0x2e MOD ; counter % 8
0x2f PUSHI 0x8 ; integer 8
0x38 SUB ; 8 - (counter % 8)
0x39 PUSHSY 0x3 ; arg1
0x42 PUSHSY 0x2 ; tape_1
0x4b CALL ; call tape_1 (get first item of list)
0x4c SUB ; item - (8 - (counter % 8))
0x4d STORE 0x7 ; save to 0x7
0x56 DECLARE 0x8 ; result
0x5f PUSHSY 0x3
0x68 PUSHSY 0x4
0x71 CALL ; call tape_2, get next byte (TAIL & HEAD)
0x72 PUSHI 0xff
0x7b PUSHSY 0x7
0x84 MOD ; byte % 0xff
0x85 XOR ; xor bytes
0x86 STORE 0x8
0x8f PUSHI 0x1
0x98 PUSHSY 0x6 ; counter
0xa1 ADD ; counter + 1
0xa2 STORE 0x6 ; save counter
0xab PUSHUNIT ; push unit (empty list) to value stack
0xac POP
0xad PUSHSY 0x8
0xb6 DEPARTENV
0xb7 RET
----------------------------------
Tape id: 5 | Length: 200
0x0 DECLARE 0xa
0x9 STORE 0xa ; store list1 to 0xa
0x12 DECLARE 0xb
0x1b STORE 0xb ; store list2 to 0xb
0x24 LIST 0x0 ; create empty list
0x2d PUSHSY 0xa
0x36 EQ ; check if list1 is empty
0x37 JT 0x5c
0x40 LIST 0x0
0x49 PUSHSY 0xb
0x52 EQ ; check if list2 is empty
0x53 JF 0x66
0x5c PUSHTRUE
0x5d JMP 0x67
0x66 PUSHFALSE
0x67 JF 0x82
0x70 LIST 0x0
0x79 JMP 0xc7 ; jump to end
0x82 PUSHSY 0xb
0x8b HEAD ; push 1st item of list2
0x8c PUSHSY 0xa
0x95 HEAD ; push 1st item of list2
0x96 LIST 0x2 ; create list of 2 items
0x9f LIST 0x1 ;
0xa8 PUSHSY 0xb
0xb1 TAIL ; remove first item of list2
0xb2 PUSHSY 0xa
0xbb TAIL ; remove first item of list1
0xbc PUSHSY 0x9 ; tape_5
0xc5 CALL ; recursive call
0xc6 LISTCAT ; concatenate 2 lists from value stack
0xc7 RET
----------------------------------
Tape id: 6 | Length: 142
0x0 DECLARE 0xd
0x9 STORE 0xd ; arg1 (tape_4)
0x12 DECLARE 0xe
0x1b STORE 0xe ; store arg2
0x24 LIST 0x0
0x2d PUSHSY 0xe ; arg2
0x36 EQ ; check if arg2 is an empty list
0x37 JF 0x52
0x40 LIST 0x0
0x49 JMP 0x8d ; end (return empty list)
0x52 PUSHSY 0xe
0x5b HEAD ; get 1st item of arg2
0x5c PUSHSY 0xd
0x65 CALL ; call tape_4 (arg_1)
0x66 LIST 0x1
0x6f PUSHSY 0xe
0x78 TAIL ; remove 1st item of arg2
0x79 PUSHSY 0xd ; arg1
0x82 PUSHSY 0xc
0x8b CALL ; recursive call
0x8c LISTCAT
0x8d RET