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
| __int64 __fastcall sub_4678(__int64 a1) { __int64 v1; __int64 v3; __int64 v4; __int64 v5; __int64 v6; __int64 v7; __int64 v8; __int64 v9; __int64 v10; __int64 v11; __int64 v13; __int64 v14; __int64 v15; __int64 v16; __int64 v17; __int64 v18; __int64 v19; size_t v20; __int64 v21; const void *v22; __int64 v23; void **v24; __int64 v25; __int64 v26; __int64 v27; __int64 v28; __int64 v29; const char **v30; __int64 v31; __int64 v32; __int64 v33; __int64 v34; __int64 v35; __int64 v36; __int64 v37; void **v38; __int64 v39; __int64 v40; __int64 v41; __int64 v42; __int64 v43; void *v44; __int64 v45; __int64 v46; __int64 v47; __int64 v48; __int64 v49; __int64 v50; __int64 v51; __int64 v52; __int64 v53; __int64 v54; __int64 v55; int i; int v57; int j; int v59; int k; int v61; int v62; int m; int v64; int n; int v66; int ii; __int64 v68; __int64 v69; __int64 v70; char *s1; char v72[32]; char v73[40]; unsigned __int64 v74;
v74 = __readfsqword(0x28u); if ( sub_61A6(a1) == 1 ) { v1 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v1, "ls") ) { if ( !sub_61A6(&unk_102E0) ) return 1LL; for ( i = 0; i < (unsigned __int64)sub_61A6(&unk_102E0); ++i ) { v3 = sub_61CE(&unk_102E0, i); std::operator+<char>(v72, "\x1B[1;32m", v3); sub_6351(v73, v72, "\x1B[0m"); v4 = std::operator<<<char>(&std::cout, v73); std::operator<<<std::char_traits<char>>(v4, (const char *)&asc_B008[2]); std::string::~string(v73); std::string::~string(v72); } std::ostream::operator<<(&std::cout, &std::endl<char,std::char_traits<char>>); return 1LL; } v5 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v5, "env") ) { sub_3C72(); return 1LL; } v6 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v6, "clear") ) { std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[2J\x1B[H"); return 1LL; } v7 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v7, "exit") ) { s1 = (char *)malloc(0x210uLL) - 16; if ( !strcmp(s1, "eeeeeee") ) { v8 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;32mGoodbye, my eeee\x1B[0m"); std::ostream::operator<<(v8, &std::endl<char,std::char_traits<char>>); exit(0); } v9 = std::operator<<<std::char_traits<char>>( &std::cout, "\x1B[1;31mOh! you are not eeee! You are a hacker!\x1B[0m"); std::ostream::operator<<(v9, &std::endl<char,std::char_traits<char>>); _exit(0); } } if ( sub_61A6(a1) == 4 ) { v10 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v10, "echo") ) { v11 = sub_61CE(a1, 2LL); if ( (unsigned __int8)sub_61F2(v11, ">") ) { v57 = 0; for ( j = 0; j < (unsigned __int64)sub_61A6(&unk_102E0); ++j ) { v13 = sub_61CE(a1, 3LL); v14 = sub_61CE(&unk_102E0, j); if ( (unsigned __int8)sub_639C(v14, v13) ) { v57 = 1; break; } } if ( v57 ) { if ( (unsigned __int64)sub_61A6(a1) <= 0x1FF ) { if ( dword_10010 ) { --dword_10010; v19 = sub_61CE(a1, 1LL); v20 = std::string::length(v19); v21 = sub_61CE(a1, 1LL); v22 = (const void *)std::string::c_str(v21); v23 = sub_61CE(a1, 3LL); v24 = (void **)sub_6086(&unk_10300, v23); memcpy(*v24, v22, v20); } return 1LL; } else { return 1LL; } } else { v15 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe file "); v16 = sub_61CE(a1, 3LL); v17 = std::operator<<<char>(v15, v16); v18 = std::operator<<<std::char_traits<char>>(v17, " does not exist.\x1B[0m"); std::ostream::operator<<(v18, &std::endl<char,std::char_traits<char>>); return 1LL; } } } } if ( sub_61A6(a1) != 2 ) return 0LL; v25 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v25, "cat") ) { v59 = 0; for ( k = 0; k < (unsigned __int64)sub_61A6(&unk_102E0); ++k ) { v26 = sub_61CE(a1, 1LL); v27 = sub_61CE(&unk_102E0, k); if ( (unsigned __int8)sub_639C(v27, v26) ) { v59 = 1; break; } } if ( v59 ) { v29 = sub_61CE(a1, 1LL); v30 = (const char **)sub_6086(&unk_10300, v29); v28 = std::operator<<<std::char_traits<char>>(&std::cout, *v30); } else { v28 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe file does not exist.\x1B[0m"); } std::ostream::operator<<(v28, &std::endl<char,std::char_traits<char>>); return 1LL; } v31 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v31, "rm") ) { v61 = 0; v62 = 0; for ( m = 0; m < (unsigned __int64)sub_61A6(&unk_102E0); ++m ) { v32 = sub_61CE(a1, 1LL); v33 = sub_61CE(&unk_102E0, m); if ( (unsigned __int8)sub_639C(v33, v32) ) { v61 = 1; v62 = m; break; } } if ( v61 ) { v35 = sub_61CE(a1, 1LL); if ( (unsigned __int8)sub_61F2(v35, "flag") ) { v36 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe flag cannot be remove!\x1B[0m"); std::ostream::operator<<(v36, &std::endl<char,std::char_traits<char>>); } else { v68 = sub_6424(&unk_102E0); v69 = sub_6470(&v68, v62); sub_64D6(&v70, &v69); sub_6504(&unk_102E0, v70); v37 = sub_61CE(a1, 1LL); v38 = (void **)sub_6086(&unk_10300, v37); free(*v38); } return 1LL; } else { v34 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe file does not exist.\x1B[0m"); std::ostream::operator<<(v34, &std::endl<char,std::char_traits<char>>); return 1LL; } } v39 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v39, "touch") ) { v64 = 0; for ( n = 0; n < (unsigned __int64)sub_61A6(&unk_102E0); ++n ) { v40 = sub_61CE(a1, 1LL); v41 = sub_61CE(&unk_102E0, n); if ( (unsigned __int8)sub_639C(v41, v40) ) { v64 = 1; break; } } if ( v64 ) { v42 = std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe file already exists.\x1B[0m"); std::ostream::operator<<(v42, &std::endl<char,std::char_traits<char>>); } else { v43 = sub_61CE(a1, 1LL); sub_659A((__int64)&unk_102E0, v43); v44 = malloc(0x210uLL); v45 = sub_61CE(a1, 1LL); *(_QWORD *)sub_6086(&unk_10300, v45) = v44; v46 = sub_61CE(a1, 1LL); **(_BYTE **)sub_6086(&unk_10300, v46) = 0; } return 1LL; } v47 = sub_61CE(a1, 0LL); if ( (unsigned __int8)sub_61F2(v47, "echo") ) { v48 = sub_61CE(a1, 1LL); v49 = std::operator<<<char>(&std::cout, v48); std::ostream::operator<<(v49, &std::endl<char,std::char_traits<char>>); return 1LL; } v50 = sub_61CE(a1, 0LL); if ( !(unsigned __int8)sub_61F2(v50, "edit") ) return 0LL; v66 = 0; for ( ii = 0; ii < (unsigned __int64)sub_61A6(&unk_102E0); ++ii ) { v51 = sub_61CE(a1, 1LL); v52 = sub_61CE(&unk_102E0, ii); if ( (unsigned __int8)sub_639C(v52, v51) ) { v66 = 1; break; } } if ( v66 ) { v53 = std::operator<<<std::char_traits<char>>(&std::cout, "content:"); std::ostream::operator<<(v53, &std::endl<char,std::char_traits<char>>); } else { std::operator<<<std::char_traits<char>>(&std::cout, "\x1B[1;31mThe file does not exist, edit failed... \x1B[0m"); } v54 = sub_61CE(a1, 1LL); if ( sub_661A(&unk_10300, v54) ) { v55 = sub_61CE(a1, 1LL); std::string::basic_string(v73, v55); sub_44B7(v73); std::string::~string(v73); } else { sub_3A09(); } return 1LL; }
|