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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
| __int64 __fastcall start_vm(Virtual_machine *virtual_machine) { __int64 pc_register; __int64 v2; __int64 v3; __int64 input_data_addr; __int64 v5; char v6; unsigned __int64 v7; __int64 v8; __int64 v9; char v10; unsigned __int64 v11; __int64 v12; __int64 v13; char v14; unsigned __int64 v15; int v17; int v18; int v19; int v20; __int64 v21; int v22; int v23; int v24; int v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; int v34; int v35; int v36; int v37; int v38; int v39; int v40; int v41; int v42; int v43; int v44; int v45; int v46; int v47; int v48; int v49; int v50; int v51; int i; __int64 v53; unsigned __int64 v54; unsigned __int64 v55; unsigned __int64 v56; unsigned __int64 Instruction_only_one_operand__first_operand_len; unsigned __int64 Instruction_only_two_operand__first_operand_len; unsigned __int64 Instruction_only_two_operand__second_operand_len; unsigned __int64 v60; unsigned __int64 v61; unsigned __int64 v62; unsigned __int64 v63; unsigned __int64 v64; unsigned __int64 v65; unsigned __int64 v66; unsigned __int64 v67; unsigned __int64 v68; unsigned __int64 v69; unsigned __int64 v70; unsigned __int64 v71; unsigned __int64 v72; unsigned __int64 v73; unsigned __int64 v74; unsigned __int64 v75; unsigned __int64 v76; unsigned __int64 v77; unsigned __int64 v78; unsigned __int64 v79; unsigned __int64 v80; unsigned __int64 v81; unsigned __int64 v82; unsigned __int64 v83; __int64 *v84; __int64 v85[4]; __int64 v86[7];
v86[5] = __readfsqword(0x28u); v53 = 0LL; memset(v85, 0, sizeof(v85)); memset(v86, 0, 32); LABEL_193: while ( virtual_machine->pc_register <= 0xFFFuLL ) { while ( (*(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == ' ' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\t' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\n' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\r') && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF ) ++virtual_machine->pc_register; for ( i = 0; (&instruction_list)[3 * i]; ++i ) { pc_register = virtual_machine->pc_register; if ( (unsigned __int64)(pc_register + j_wcsncmp_ifunc((&instruction_list)[3 * i])) <= 0xFFF ) { v2 = j_wcsncmp_ifunc((&instruction_list)[3 * i]); if ( !(unsigned int)j_strncmp_ifunc( virtual_machine->pc_register + virtual_machine->input_data_addr, (&instruction_list)[3 * i], v2) ) { virtual_machine->Instruction_type = (__int64)(&instruction_list)[3 * i + 1]; v3 = virtual_machine->pc_register; virtual_machine->pc_register = v3 + j_wcsncmp_ifunc((&instruction_list)[3 * i]); break; } virtual_machine->Instruction_type = 20LL; } } if ( (&instruction_list)[3 * virtual_machine->Instruction_type + 2] == (char *)1 ) { j_memset_ifunc(v85, 0LL, 32LL); while ( (*(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == ' ' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\t') && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' ) ++virtual_machine->pc_register; for ( Instruction_only_one_operand__first_operand_len = 0LL; *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != ' ' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\t' && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && Instruction_only_one_operand__first_operand_len <= 0x1E && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\r' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n'; ++Instruction_only_one_operand__first_operand_len ) { input_data_addr = virtual_machine->input_data_addr; v5 = virtual_machine->pc_register; virtual_machine->pc_register = v5 + 1; v6 = *(_BYTE *)(input_data_addr + v5); v7 = Instruction_only_one_operand__first_operand_len; *((_BYTE *)v85 + v7) = v6; } *((_BYTE *)v85 + Instruction_only_one_operand__first_operand_len) = 0; if ( !Instruction_only_one_operand__first_operand_len ) goto Error_about_Miss_oprand; } else if ( (&instruction_list)[3 * virtual_machine->Instruction_type + 2] == (char *)2 ) { j_memset_ifunc(v85, 0LL, 32LL); j_memset_ifunc(v86, 0LL, 32LL); while ( (*(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == ' ' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\t') && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' ) ++virtual_machine->pc_register; Instruction_only_two_operand__first_operand_len = 0LL; while ( *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != ' ' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\t' && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && Instruction_only_two_operand__first_operand_len <= 0x1E && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\r' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' ) { v8 = virtual_machine->input_data_addr; v9 = virtual_machine->pc_register; virtual_machine->pc_register = v9 + 1; v10 = *(_BYTE *)(v8 + v9); v11 = Instruction_only_two_operand__first_operand_len++; *((_BYTE *)v85 + v11) = v10; } *((_BYTE *)v85 + Instruction_only_two_operand__first_operand_len) = 0; if ( !Instruction_only_two_operand__first_operand_len ) goto Error_about_Miss_oprand; while ( (*(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == ' ' || *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) == '\t') && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' ) ++virtual_machine->pc_register; Instruction_only_two_operand__second_operand_len = 0LL; while ( *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != ' ' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\t' && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF && Instruction_only_two_operand__second_operand_len <= 0x1E && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\r' && *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' ) { v12 = virtual_machine->input_data_addr; v13 = virtual_machine->pc_register; virtual_machine->pc_register = v13 + 1; v14 = *(_BYTE *)(v12 + v13); v15 = Instruction_only_two_operand__second_operand_len++; *((_BYTE *)v86 + v15) = v14; } *((_BYTE *)v86 + Instruction_only_two_operand__second_operand_len) = 0; if ( !Instruction_only_two_operand__second_operand_len ) { Error_about_Miss_oprand: virtual_machine->error_code = 2LL; puts("ERROR: Miss oprand!"); return virtual_machine->error_code; } } while ( *(_BYTE *)(virtual_machine->input_data_addr + virtual_machine->pc_register) != '\n' && (unsigned __int64)(virtual_machine->pc_register + 1) <= 0xFFF ) ++virtual_machine->pc_register; ++virtual_machine->pc_register; switch ( virtual_machine->Instruction_type ) { case 0LL: goto LABEL_193; case 1LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v60 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v60 > 5 ) goto Error_about_invalid_register; v84 = (__int64 *)atoi(v86, 0LL, 16LL); if ( (unsigned __int64)v84 <= 0x2023FFFF || (unsigned __int64)v84 > 0x20242FFF ) goto Error_about_invalid_address; if ( (unsigned __int64)(v84 + 1) > 0x20242FFF ) goto LABEL_76; *(&virtual_machine->register0 + v60) = *v84; goto LABEL_193; case 2LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v74 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v74 > 5 ) goto Error_about_invalid_register; v84 = (__int64 *)atoi(v86, 0LL, 16LL); if ( (unsigned __int64)v84 <= 0x2023FFFF || (unsigned __int64)v84 > 0x20242FFF ) { Error_about_invalid_address: virtual_machine->error_code = 4LL; printf((unsigned int)"ERROR: Invalid address: %#lx!\n", (_DWORD)v84, v17, v18, v19, v20); return virtual_machine->error_code; } if ( (unsigned __int64)(v84 + 1) > 0x20242FFF ) { LABEL_76: virtual_machine->error_code = 4LL; printf((unsigned int)"ERROR: Invalid memory access: %lx!\n", (_DWORD)v84, v17, v18, v19, v20); return virtual_machine->error_code; } *v84 = *(&virtual_machine->register0 + v74); goto LABEL_193; case 3LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v61 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v61 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v75 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v75 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v61) = *(&virtual_machine->register0 + v75); goto LABEL_193; case 4LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v62 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v62 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v76 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v76 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v62) += *(&virtual_machine->register0 + v76); goto LABEL_193; case 5LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v63 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v63 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v77 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v77 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v63) -= *(&virtual_machine->register0 + v77); goto LABEL_193; case 6LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v64 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v64 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v78 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v78 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v64) *= *(&virtual_machine->register0 + v78); goto LABEL_193; case 7LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v65 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v65 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v79 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v79 > 5 ) goto Error_about_invalid_register; if ( !*(&virtual_machine->register0 + v79) ) { virtual_machine->error_code = 5LL; puts("ERROR: Divide by zero!"); return virtual_machine->error_code; } *(&virtual_machine->register0 + v65) /= (unsigned __int64)*(&virtual_machine->register0 + v79); goto LABEL_193; case 8LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v66 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v66 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v80 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v80 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v66) &= *(&virtual_machine->register0 + v80); goto LABEL_193; case 9LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v67 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v67 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v81 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v81 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v67) |= *(&virtual_machine->register0 + v81); goto LABEL_193; case 0xALL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v68 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v68 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v82 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v82 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v68) ^= *(&virtual_machine->register0 + v82); goto LABEL_193; case 0xBLL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v69 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v69 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v69) = ~*(&virtual_machine->register0 + v69); goto LABEL_193; case 0xCLL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v70 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v70 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v70) <<= atoi(v86, 0LL, 16LL); goto LABEL_193; case 0xDLL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v71 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v71 > 5 ) goto Error_about_invalid_register; *(&virtual_machine->register0 + v71) = (unsigned __int64)*(&virtual_machine->register0 + v71) >> atoi(v86, 0LL, 16LL); goto LABEL_193; case 0xELL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) ) goto Error_about_invalid_register; v72 = atoi((char *)v85 + 3, 0LL, 10LL); if ( v72 > 5 ) goto Error_about_invalid_register; if ( (unsigned int)j_strncmp_ifunc(v86, "REG", 3LL) ) goto Error_about_invalid_register; v83 = atoi((char *)v86 + 3, 0LL, 10LL); if ( v83 > 5 ) goto Error_about_invalid_register; if ( *(&virtual_machine->register0 + v72) == *(&virtual_machine->register0 + v83) ) { virtual_machine->flags_register = 0LL; } else if ( *(&virtual_machine->register0 + v72) <= (unsigned __int64)*(&virtual_machine->register0 + v83) ) { virtual_machine->flags_register = 2LL; } else { virtual_machine->flags_register = 1LL; } goto LABEL_193; case 0xFLL: v54 = atoi(v85, 0LL, 10LL); goto LABEL_168; case 0x10LL: v54 = atoi(v85, 0LL, 10LL); if ( virtual_machine->flags_register ) goto LABEL_193; goto LABEL_168; case 0x11LL: v54 = atoi(v85, 0LL, 10LL); if ( !virtual_machine->flags_register ) goto LABEL_193; LABEL_168: if ( !v54 || v54 > 0xFFF ) goto LABEL_179; v55 = 0LL; v56 = v54; while ( 2 ) { if ( v55 <= 0xFFF ) { if ( v56 != 1 ) { v21 = virtual_machine->input_data_addr; if ( *(_BYTE *)(v21 + v55) == 10 ) --v56; ++v55; continue; } LODWORD(v21) = v55; virtual_machine->pc_register = v55; } break; } if ( v56 == 1 ) goto LABEL_193; LABEL_179: virtual_machine->error_code = 4LL; printf((unsigned int)"ERROR: Invalid jmp line: %ld!\n", v54, v21, v22, v23, v24); return virtual_machine->error_code; case 0x12LL: if ( (unsigned int)j_strncmp_ifunc(v85, "REG", 3LL) || (v73 = atoi((char *)v85 + 3, 0LL, 10LL), v73 > 5) ) { Error_about_invalid_register: virtual_machine->error_code = 3LL; puts("ERROR: Invalid register!"); return virtual_machine->error_code; } *(&virtual_machine->register0 + v73) = atoi(v86, 0LL, 16LL); break; case 0x13LL: if ( v53 ) { virtual_machine->error_code = 6LL; puts("ERROR: Syscall limit reached!"); return virtual_machine->error_code; } virtual_machine->unknow1 = atoi(v85, 0LL, 16LL); v53 = 1LL; virtual_machine->register0 = syscall( virtual_machine->unknow1, virtual_machine->register0, virtual_machine->register1, virtual_machine->register2, virtual_machine->register3, virtual_machine->register4, virtual_machine->register5); virtual_machine->unknow1 = -1LL; goto LABEL_193; case 0x14LL: puts("------------------vmstate------------------"); printf( (unsigned int)"pc: %#lx flags: %lx\n", virtual_machine->pc_register, virtual_machine->flags_register, v25, v26, v27); printf((unsigned int)"reg0: %#lx\n", virtual_machine->register0, v28, v29, v30, v31); printf((unsigned int)"reg1: %#lx\n", virtual_machine->register1, v32, v33, v34, v35); printf((unsigned int)"reg2: %#lx\n", virtual_machine->register2, v36, v37, v38, v39); printf((unsigned int)"reg3: %#lx\n", virtual_machine->register3, v40, v41, v42, v43); printf((unsigned int)"reg4: %#lx\n", virtual_machine->register4, v44, v45, v46, v47); printf((unsigned int)"reg5: %#lx\n", virtual_machine->register5, v48, v49, v50, v51); puts("-------------------------------------------"); virtual_machine->error_code = 0LL; return virtual_machine->error_code; default: virtual_machine->error_code = 1LL; puts("ERROR: Unknown opcode!"); return virtual_machine->error_code; } } return 0LL; }
|