__int64 __fastcall main(int a1, char **a2, char **a3) { size_t v3; _WORD v5[4]; time_t time1; time_t timer; int longind; _QWORD s[129]; int v10; double v11; char *v12; int v13; unsigned int v14; unsigned __int8 v15; char v16; int n; int v18; char v19; int m; int k; char v22; int v23; unsigned __int64 v24; int v25; int v26; int v27; char v28; bool v29; unsigned __int16 v30; int v31; unsigned int v32; unsigned int i; int v34; unsigned int j; char *haystack;
haystack = 0; i = 0; v32 = 0; v31 = 0; memset(s, 0, 1024); v30 = 0; v29 = 0; v28 = 0; v27 = 90; while ( 1 ) { v26 = getopt_long(a1, a2, "eshiItnd:f:r:R:c:C:W:H:", &longopts, &longind); if ( v26 == -1 ) break; if ( !v26 && !*((_QWORD *)&longopts.flag + 4 * longind) ) v26 = *(&longopts.val + 8 * longind); switch ( v26 ) { case 'C': dword_E1F8 = atoi(optarg); break; case 'H': dword_E1EC = (64 - atoi(optarg)) / 2; dword_E1F0 = (atoi(optarg) + 64) / 2; break; case 'I': v28 = 1; break; case 'R': dword_E1F0 = atoi(optarg); break; case 'W': dword_E1F4 = (64 - atoi(optarg)) / 2; dword_E1F8 = (atoi(optarg) + 64) / 2; break; case 'c': dword_E1F4 = atoi(optarg); break; case 'd': if ( atoi(optarg) > 9 && atoi(optarg) <= 1000 ) v27 = atoi(optarg); break; case 'e': dword_E104 = 0; break; case 'f': dword_104C4 = atoi(optarg); break; case 'h': sub_67F0(a2); exit(0); case 'i': v29 = 1; break; case 'r': dword_E1EC = atoi(optarg); break; case 's': dword_E108 = 0; break; case 't': dword_104C0 = 1; break; default: continue; } } if ( dword_104C0 ) { v29 = v28 == 0; sub_6669(); for ( i = 0; i <= 0xFF; ++i ) { if ( *((_BYTE *)&unk_104E0 + i) ) { sub_66AF(*((unsigned __int8 *)&unk_104E0 + i), i); fflush(stdout); } } for ( i = 0; i <= 0xFF; ++i ) { if ( *((_BYTE *)&unk_105E0 + i) ) { sub_66AF(*((unsigned __int8 *)&unk_105E0 + i), i); fflush(stdout); } } signal(14, sub_64C0); if ( !_setjmp(env) ) { alarm(1u); while ( !feof(stdin) && v32 <= 1 ) { v16 = getchar(); v15 = 0; if ( v16 == -1 ) { v16 = getchar(); switch ( v16 ) { case -16: v31 = 0; if ( LOBYTE(s[0]) == 24 ) { alarm(2u); haystack = strndup((const char *)s + 2, 0x3FEu); ++v32; } else if ( LOBYTE(s[0]) == 31 ) { alarm(2u); dword_E1FC = (BYTE1(s[0]) << 8) | BYTE2(s[0]); dword_E200 = (BYTE3(s[0]) << 8) | BYTE4(s[0]); ++v32; } break; case -15: sub_66AF(241, 0); fflush(stdout); break; case -6: v31 = 1; v30 = 0; memset(s, 0, 0x400u); break; case -5: case -4: v15 = getchar(); if ( !*((_BYTE *)&unk_105E0 + v15) ) *((_BYTE *)&unk_105E0 + v15) = -4; sub_66AF(*((unsigned __int8 *)&unk_105E0 + v15), v15); fflush(stdout); if ( v16 == -5 && v15 == 24 ) { printf("%c%c%c%c%c%c", 255, 250, 24, 1, 255, 240); fflush(stdout); } break; case -3: case -2: v15 = getchar(); if ( !*((_BYTE *)&unk_104E0 + v15) ) *((_BYTE *)&unk_104E0 + v15) = -2; sub_66AF(*((unsigned __int8 *)&unk_104E0 + v15), v15); fflush(stdout); break; case -1: v32 = 2; break; default: continue; } } else if ( v31 && v30 <= 0x3FEu ) { *((_BYTE *)s + v30++) = v16; } } } alarm(0); } else { haystack = getenv("TERM"); ioctl(0, 0x5413u, v5); dword_E1FC = v5[1]; dword_E200 = v5[0]; } v34 = 2; if ( haystack ) { for ( j = 0; ; ++j ) { v3 = j; if ( v3 >= strlen(haystack) ) break; haystack[j] = tolower(haystack[j]); } if ( strstr(haystack, "xterm") ) { v34 = 1; } else if ( strstr(haystack, "toaru") ) { v34 = 1; } else if ( strstr(haystack, "linux") ) { v34 = 3; } else if ( strstr(haystack, "vtnt") ) { v34 = 5; } else if ( strstr(haystack, "cygwin") ) { v34 = 5; } else if ( strstr(haystack, "vt220") ) { v34 = 6; } else if ( strstr(haystack, "fallback") ) { v34 = 4; } else if ( strstr(haystack, "rxvt-256color") ) { v34 = 1; } else if ( strstr(haystack, "rxvt") ) { v34 = 3; } else if ( strstr(haystack, "vt100") && dword_E1FC == 40 ) { v34 = 7; } else if ( !strncmp(haystack, "st", 2u) ) { v34 = 1; } } v25 = 0; signal(2, sub_64A8); signal(13, sub_64E6); if ( !dword_104C0 ) signal(28, handler); switch ( v34 ) { case 1: qword_FE20 = (__int64)"\x1B[48;5;17m"; qword_FE30 = (__int64)"\x1B[48;5;231m"; qword_FDF8 = (__int64)"\x1B[48;5;16m"; qword_FEC0 = (__int64)"\x1B[48;5;230m"; qword_FDE0 = (__int64)"\x1B[48;5;175m"; qword_FE28 = (__int64)"\x1B[48;5;162m"; qword_FEB0 = (__int64)"\x1B[48;5;196m"; qword_FDF0 = (__int64)"\x1B[48;5;214m"; qword_FE18 = (__int64)"\x1B[48;5;226m"; qword_FDD8 = (__int64)"\x1B[48;5;118m"; qword_FEA8 = (__int64)"\x1B[48;5;33m"; qword_FE98 = (__int64)"\x1B[48;5;19m"; qword_FE10 = (__int64)"\x1B[48;5;240m"; qword_FDE8 = (__int64)"\x1B[48;5;175m"; break; case 2: qword_FE20 = (__int64)"\x1B[104m"; qword_FE30 = (__int64)"\x1B[107m"; qword_FDF8 = (__int64)"\x1B[40m"; qword_FEC0 = (__int64)"\x1B[47m"; qword_FDE0 = (__int64)"\x1B[105m"; qword_FE28 = (__int64)"\x1B[101m"; qword_FEB0 = (__int64)"\x1B[101m"; qword_FDF0 = (__int64)"\x1B[43m"; qword_FE18 = (__int64)"\x1B[103m"; qword_FDD8 = (__int64)"\x1B[102m"; qword_FEA8 = (__int64)"\x1B[104m"; qword_FE98 = (__int64)"\x1B[44m"; qword_FE10 = (__int64)"\x1B[100m"; qword_FDE8 = (__int64)"\x1B[105m"; break; case 3: qword_FE20 = (__int64)"\x1B[25;44m"; qword_FE30 = (__int64)"\x1B[5;47m"; qword_FDF8 = (__int64)"\x1B[25;40m"; qword_FEC0 = (__int64)"\x1B[5;47m"; qword_FDE0 = (__int64)"\x1B[5;45m"; qword_FE28 = (__int64)"\x1B[5;41m"; qword_FEB0 = (__int64)"\x1B[5;41m"; qword_FDF0 = (__int64)"\x1B[25;43m"; qword_FE18 = (__int64)"\x1B[5;43m"; qword_FDD8 = (__int64)"\x1B[5;42m"; qword_FEA8 = (__int64)"\x1B[25;44m"; qword_FE98 = (__int64)"\x1B[5;44m"; qword_FE10 = (__int64)"\x1B[5;40m"; qword_FDE8 = (__int64)"\x1B[5;45m"; break; case 4: qword_FE20 = (__int64)"\x1B[0;34;44m"; qword_FE30 = (__int64)"\x1B[1;37;47m"; qword_FDF8 = (__int64)"\x1B[0;30;40m"; qword_FEC0 = (__int64)"\x1B[1;37;47m"; qword_FDE0 = (__int64)"\x1B[1;35;45m"; qword_FE28 = (__int64)"\x1B[1;31;41m"; qword_FEB0 = (__int64)"\x1B[1;31;41m"; qword_FDF0 = (__int64)"\x1B[0;33;43m"; qword_FE18 = (__int64)"\x1B[1;33;43m"; qword_FDD8 = (__int64)"\x1B[1;32;42m"; qword_FEA8 = (__int64)"\x1B[1;34;44m"; qword_FE98 = (__int64)"\x1B[0;34;44m"; qword_FE10 = (__int64)"\x1B[1;30;40m"; qword_FDE8 = (__int64)"\x1B[1;35;45m"; off_FA88 = (char *)&unk_BCFF; break; case 5: qword_FE20 = (__int64)"\x1B[0;34;44m"; qword_FE30 = (__int64)"\x1B[1;37;47m"; qword_FDF8 = (__int64)"\x1B[0;30;40m"; qword_FEC0 = (__int64)"\x1B[1;37;47m"; qword_FDE0 = (__int64)"\x1B[1;35;45m"; qword_FE28 = (__int64)"\x1B[1;31;41m"; qword_FEB0 = (__int64)"\x1B[1;31;41m"; qword_FDF0 = (__int64)"\x1B[0;33;43m"; qword_FE18 = (__int64)"\x1B[1;33;43m"; qword_FDD8 = (__int64)"\x1B[1;32;42m"; qword_FEA8 = (__int64)"\x1B[1;34;44m"; qword_FE98 = (__int64)"\x1B[0;34;44m"; qword_FE10 = (__int64)"\x1B[1;30;40m"; qword_FDE8 = (__int64)"\x1B[1;35;45m"; off_FA88 = (char *)&unk_BD06; break; case 6: qword_FE20 = (__int64)&unk_BD09; qword_FE30 = (__int64)&unk_BD0C; qword_FDF8 = (__int64)" "; qword_FEC0 = (__int64)&unk_BD0F; qword_FDE0 = (__int64)&unk_BD12; qword_FE28 = (__int64)&unk_BD15; qword_FEB0 = (__int64)&unk_BD0F; qword_FDF0 = (__int64)&unk_BD18; qword_FE18 = (__int64)&unk_BD1B; qword_FDD8 = (__int64)&unk_BD1E; qword_FEA8 = (__int64)&unk_BD21; qword_FE98 = (__int64)&unk_BD24; qword_FE10 = (__int64)&unk_BD27; qword_FDE8 = (__int64)&unk_BD2A; v25 = 1; break; case 7: qword_FE20 = (__int64)&unk_BD2D; qword_FE30 = (__int64)&unk_BD2F; qword_FDF8 = (__int64)&unk_BD31; qword_FEC0 = (__int64)&unk_BD33; qword_FDE0 = (__int64)&unk_BD35; qword_FE28 = (__int64)&unk_BD37; qword_FEB0 = (__int64)&unk_BD33; qword_FDF0 = (__int64)&unk_BD39; qword_FE18 = (__int64)&unk_BD3B; qword_FDD8 = (__int64)&unk_BD3D; qword_FEA8 = (__int64)&unk_BD3F; qword_FE98 = (__int64)&unk_BD41; qword_FE10 = (__int64)&unk_BD43; qword_FDE8 = (__int64)&unk_BD45; v25 = 1; dword_E1FC = 40; break; default: break; } if ( dword_E1F4 == dword_E1F8 ) { dword_E1F4 = (dword_E1FC / -2 + 64) / 2; dword_E1F8 = (dword_E1FC / 2 + 64) / 2; byte_104CB = 1; } if ( dword_E1EC == dword_E1F0 ) { dword_E1EC = (65 - dword_E200) / 2; dword_E1F0 = (dword_E200 + 63) / 2; byte_104CC = 1; } if ( dword_E108 ) { printf("\x1BkNyanyanyanyanyanyanya...\x1B\\"); printf("\x1B]1;Nyanyanyanyanyanyanya...\a"); printf("\x1B]2;Nyanyanyanyanyanyanya...\a"); } if ( dword_E104 ) printf("\x1B[H\x1B[2J\x1B[?25l"); else printf("\x1B[s"); if ( v29 ) { v14 = 5; for ( j = 0; j < v14; ++j ) { sub_65E2(3); printf(" \x1B[1mNyancat Telnet Server\x1B[0m"); sub_65E2(2); printf(" written and run by \x1B[1;32mK. Lange\x1B[1;34m @_klange\x1B[0m"); sub_65E2(2); printf(" If things don't look right, try:"); sub_65E2(1); printf(" TERM=fallback telnet ..."); sub_65E2(2); printf(" Or on Windows:"); sub_65E2(1); printf(" telnet -t vtnt ..."); sub_65E2(2); printf(" Problems? Check the website:"); sub_65E2(1); printf(" \x1B[1;34mhttp://nyancat.dakko.us\x1B[0m"); sub_65E2(2); printf(" This is a telnet server, remember your escape keys!"); sub_65E2(1); printf(" \x1B[1;31m^]quit\x1B[0m to exit"); sub_65E2(2); printf(" Starting in %d... \n", v14 - j); fflush(stdout); usleep(0x61A80u); if ( dword_E104 ) printf("\x1B[H"); else printf("\x1B[u"); } if ( dword_E104 ) printf("\x1B[H\x1B[2J\x1B[?25l"); } time(&timer); v13 = 1; v24 = 0; v23 = 0; v22 = 0; v12 = off_FA88; while ( v13 ) { if ( dword_E104 ) printf("\x1B[H"); else printf("\x1B[u"); for ( k = dword_E1EC; k < dword_E1F0; ++k ) { for ( m = dword_E1F4; m < dword_E1F8; ++m ) { if ( k <= 23 || k > 42 || m >= 0 ) { if ( m >= 0 && (unsigned int)k < 0x40 && m <= 63 ) { v19 = off_FA20[v24][k][m]; off_FA88 = (char *)sub_6314((unsigned int)v24, (unsigned int)k, (unsigned int)m, v12); } else { v19 = 44; } } else { v18 = (2 - m) % 16 / 8; if ( ((v24 >> 1) & 1) != 0 ) v18 = 1 - v18; s[128] = ",,>>&&&+++###==;;;,,"; v19 = asc_BFE3[v18 - 23 + k]; if ( !v19 ) v19 = 44; } if ( v25 ) { printf("%s", *((const char **)&unk_FCC0 + v19)); } else if ( v19 == v22 || !*((_QWORD *)&unk_FCC0 + v19) ) { printf("%s", off_FA88); } else { v22 = v19; printf("%s%s", *((const char **)&unk_FCC0 + v19), off_FA88); } } sub_65E2(1); } if ( dword_E100 ) { time(&time1); v11 = difftime(time1, timer); v10 = sub_63FF((unsigned int)(int)v11); for ( n = (dword_E1FC - 29 - v10) / 2; n > 0; --n ) putchar(32); dword_E1E8 += printf("\x1B[1;37mYou have nyaned for %d times!\x1B[J\x1B[0m", ++dword_108E0); } v22 = 0; ++v23; if ( dword_104C4 && v23 == dword_104C4 ) sub_6471(); if ( !off_FA20[++v24] ) v24 = 0; usleep(1000 * v27); } return 0; }
|