[24396] | 1 | #ifndef TITHEK_GLOBAL_H |
---|
| 2 | #define TITHEK_GLOBAL |
---|
| 3 | |
---|
[35348] | 4 | #include <curl/curl.h> |
---|
| 5 | |
---|
[36122] | 6 | char* hoster(char* url) |
---|
| 7 | { |
---|
| 8 | debug(99, "url: %s", url); |
---|
| 9 | char* streamurl = NULL, *tmplink = NULL; |
---|
[40357] | 10 | struct skin* load = getscreen("loading"); |
---|
[36122] | 11 | |
---|
| 12 | tmplink = ostrcat(url, NULL, 0, 0); |
---|
| 13 | string_tolower(tmplink); |
---|
| 14 | |
---|
[38982] | 15 | char* cmd = NULL; |
---|
[40103] | 16 | cmd = ostrcat("/tmp/localhoster/hoster.sh get \"", url, 0, 0); |
---|
[40053] | 17 | cmd = ostrcat(cmd, "\"", 1, 0); |
---|
[38982] | 18 | streamurl = command(cmd); |
---|
| 19 | streamurl = string_newline(streamurl); |
---|
[40117] | 20 | debug(99, "Streamurl1: %s", streamurl); |
---|
[40106] | 21 | |
---|
[38982] | 22 | free(cmd), cmd = NULL; |
---|
[40094] | 23 | |
---|
[38982] | 24 | if(streamurl == NULL) |
---|
[37146] | 25 | { |
---|
[38982] | 26 | if(ostrstr(tmplink, "sockshare") != NULL) |
---|
| 27 | streamurl = putlocker(url); |
---|
| 28 | else if(ostrstr(tmplink, "putlocker") != NULL) |
---|
| 29 | streamurl = firedrive(url); |
---|
| 30 | else if(ostrstr(tmplink, "filenuke") != NULL) |
---|
| 31 | streamurl = filenuke(url); |
---|
| 32 | else if(ostrstr(tmplink, "streamcloud") != NULL) |
---|
| 33 | streamurl = streamcloud(url); |
---|
| 34 | else if(ostrstr(tmplink, "vidstream") != NULL) |
---|
| 35 | streamurl = vidstream(url); |
---|
[40117] | 36 | else if(ostrstr(tmplink, "flashx_disable") != NULL) |
---|
[38982] | 37 | streamurl = flashx(url); |
---|
| 38 | else if(ostrstr(tmplink, "xvidstage") != NULL) |
---|
| 39 | streamurl = xvidstage(url); |
---|
| 40 | else if(ostrstr(tmplink, "nowvideo") != NULL) |
---|
| 41 | streamurl = nowvideo(url); |
---|
| 42 | else if(ostrstr(tmplink, "movshare") != NULL || ostrstr(tmplink, "wholecloud") != NULL) |
---|
| 43 | streamurl = movshare(url); |
---|
| 44 | else if(ostrstr(tmplink, "movreel") != NULL) |
---|
| 45 | streamurl = movreel(url); |
---|
| 46 | else if(ostrstr(tmplink, "novamov") != NULL || ostrstr(tmplink, "auroravid") != NULL) |
---|
| 47 | streamurl = novamov(url); |
---|
| 48 | else if(ostrstr(tmplink, "divxstage") != NULL || ostrstr(tmplink, "cloudtime") != NULL) |
---|
| 49 | streamurl = divxstage(url); |
---|
| 50 | else if(ostrstr(tmplink, "primeshare") != NULL) |
---|
| 51 | streamurl = primeshare(url); |
---|
| 52 | else if(ostrstr(tmplink, "faststream") != NULL || ostrstr(tmplink, "fastvideo") != NULL) |
---|
| 53 | streamurl = faststream(url); |
---|
| 54 | else if(ostrstr(tmplink, "played") != NULL) |
---|
| 55 | streamurl = played(url); |
---|
| 56 | else if(ostrstr(tmplink, "videoweed") != NULL) |
---|
| 57 | streamurl = videoweed(url); |
---|
| 58 | else if(ostrstr(tmplink, "firedrive") != NULL) |
---|
| 59 | streamurl = firedrive(url); |
---|
| 60 | else if(ostrstr(tmplink, "shared") != NULL) |
---|
| 61 | streamurl = shared(url); |
---|
| 62 | else if(ostrstr(tmplink, "thefile") != NULL) |
---|
| 63 | streamurl = thefile(url); |
---|
[40150] | 64 | else if(ostrstr(tmplink, "youtu_disable") != NULL) |
---|
[38982] | 65 | streamurl = youtube(url); |
---|
| 66 | else if(ostrstr(tmplink, "myvideo") != NULL) |
---|
| 67 | streamurl = myvideo(url); |
---|
| 68 | else if(ostrstr(tmplink, "promptfile") != NULL) |
---|
| 69 | streamurl = promptfile(url); |
---|
| 70 | else if(ostrstr(tmplink, "letwatch") != NULL || ostrstr(tmplink, "realvid") != NULL) |
---|
| 71 | streamurl = letwatch(url); |
---|
| 72 | else if(ostrstr(tmplink, "vidbull") != NULL) |
---|
| 73 | streamurl = vidbull(url); |
---|
| 74 | else if(ostrstr(tmplink, "vodlocker") != NULL) |
---|
| 75 | streamurl = vodlocker(url); |
---|
| 76 | else if(ostrstr(tmplink, "vidto") != NULL) |
---|
| 77 | streamurl = vidto(url); |
---|
| 78 | else if(ostrstr(tmplink, "amazon") != NULL) |
---|
| 79 | streamurl = amazon(url); |
---|
| 80 | else if(ostrstr(tmplink, "thevideo") != NULL) |
---|
| 81 | streamurl = thevideo(url); |
---|
| 82 | else if(ostrstr(tmplink, "mightyupload") != NULL) |
---|
| 83 | streamurl = mightyupload(url); |
---|
| 84 | else if(ostrstr(tmplink, "cloudzilla") != NULL) |
---|
| 85 | streamurl = cloudzilla(url); |
---|
| 86 | else if(ostrstr(tmplink, "vivo") != NULL) |
---|
| 87 | streamurl = vivo(url); |
---|
| 88 | else if(ostrstr(tmplink, "streamlive") != NULL) |
---|
| 89 | streamurl = streamlive(url, -1); |
---|
| 90 | else if(ostrstr(tmplink, "cricfree") != NULL) |
---|
| 91 | streamurl = cricfree(url, 0); |
---|
| 92 | else if(ostrstr(tmplink, "zerocast") != NULL) |
---|
| 93 | streamurl = zerocast(url, 0); |
---|
| 94 | else if(ostrstr(tmplink, "p2pcast") != NULL) |
---|
| 95 | streamurl = p2pcast(url); |
---|
| 96 | else if(ostrstr(tmplink, "vidzi") != NULL) |
---|
| 97 | streamurl = vidzi(url); |
---|
| 98 | else if(ostrstr(tmplink, "vid.ag") != NULL) |
---|
| 99 | streamurl = vidag(url); |
---|
[40117] | 100 | debug(99, "Streamurl2: %s", streamurl); |
---|
| 101 | } |
---|
[40106] | 102 | |
---|
| 103 | |
---|
| 104 | if(streamurl == NULL) |
---|
| 105 | { |
---|
[40357] | 106 | if(!file_exist("/tmp/localhoster")) |
---|
| 107 | localparser_init("http://atemio.dyndns.tv/mediathek/mainmenu.list", "mainmenu.local.list", 1); |
---|
| 108 | |
---|
| 109 | drawscreen(load, 0, 0); |
---|
| 110 | |
---|
[40109] | 111 | cmd = ostrcat("/tmp/localhoster/hoster.sh youtube_dl \"", url, 0, 0); |
---|
[40106] | 112 | cmd = ostrcat(cmd, "\"", 1, 0); |
---|
| 113 | streamurl = command(cmd); |
---|
| 114 | streamurl = string_newline(streamurl); |
---|
[40117] | 115 | debug(99, "Streamurl3: %s", streamurl); |
---|
[40106] | 116 | |
---|
| 117 | free(cmd), cmd = NULL; |
---|
[40117] | 118 | |
---|
[40357] | 119 | clearscreen(load); |
---|
| 120 | |
---|
[40117] | 121 | if(streamurl == NULL) |
---|
| 122 | textbox(_("Message"), _("The hoster is not yet supported !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
| 123 | |
---|
[40106] | 124 | } |
---|
| 125 | |
---|
[36122] | 126 | debug(99, "Streamurl1: %s", streamurl); |
---|
| 127 | |
---|
| 128 | streamurl = string_replace_all("amp;", "", streamurl, 1); |
---|
[40117] | 129 | debug(99, "Streamurl4: %s", streamurl); |
---|
[36122] | 130 | |
---|
| 131 | free(tmplink), tmplink = NULL; |
---|
[40088] | 132 | /* |
---|
[36122] | 133 | if(ostrncmp("http", streamurl, 4) && ostrncmp("rtmp", streamurl, 4) && ostrncmp("mms", streamurl, 3) && ostrncmp("rtsp", streamurl, 4)) |
---|
| 134 | { |
---|
| 135 | printf("Streamurl3: not http*|rtmp*|mms*|rtsp* Streamurl: %s\n", streamurl); |
---|
| 136 | free(streamurl),streamurl = NULL; |
---|
| 137 | } |
---|
[40088] | 138 | */ |
---|
[36122] | 139 | return streamurl; |
---|
| 140 | } |
---|
| 141 | |
---|
[35348] | 142 | struct MemoryStruct { |
---|
| 143 | char *memory; |
---|
| 144 | size_t size; |
---|
| 145 | }; |
---|
| 146 | |
---|
| 147 | static size_t |
---|
| 148 | WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) |
---|
| 149 | { |
---|
| 150 | size_t realsize = size * nmemb; |
---|
| 151 | struct MemoryStruct *mem = (struct MemoryStruct *)userp; |
---|
| 152 | |
---|
| 153 | mem->memory = realloc(mem->memory, mem->size + realsize + 1); |
---|
| 154 | if(mem->memory == NULL) { |
---|
| 155 | /* out of memory! */ |
---|
| 156 | printf("not enough memory (realloc returned NULL)\n"); |
---|
| 157 | return 0; |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | memcpy(&(mem->memory[mem->size]), contents, realsize); |
---|
| 161 | mem->size += realsize; |
---|
| 162 | mem->memory[mem->size] = 0; |
---|
| 163 | |
---|
| 164 | return realsize; |
---|
| 165 | } |
---|
| 166 | |
---|
[36122] | 167 | // flag = 0 (without header in output) |
---|
| 168 | // flag = 1 (with header in output) |
---|
| 169 | char* gethttps(char* url, char* localfile, char* data, char* user, char* pass, char* referer, int flag) |
---|
[35348] | 170 | { |
---|
| 171 | debug(99, "url: %s", url); |
---|
| 172 | |
---|
| 173 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
[36122] | 174 | |
---|
| 175 | char* tmpstr = NULL; |
---|
| 176 | FILE *fp; |
---|
| 177 | |
---|
[35348] | 178 | CURL *curl_handle; |
---|
| 179 | CURLcode res; |
---|
| 180 | |
---|
| 181 | struct MemoryStruct chunk; |
---|
| 182 | |
---|
| 183 | chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ |
---|
| 184 | chunk.size = 0; /* no data at this point */ |
---|
| 185 | |
---|
| 186 | curl_global_init(CURL_GLOBAL_ALL); |
---|
[36122] | 187 | |
---|
[35348] | 188 | /* init the curl session */ |
---|
| 189 | curl_handle = curl_easy_init(); |
---|
| 190 | if(curl_handle) |
---|
| 191 | { |
---|
[36122] | 192 | if(localfile != NULL) |
---|
| 193 | fp = fopen(localfile,"wb"); |
---|
| 194 | |
---|
[35348] | 195 | /* specify URL to get */ |
---|
| 196 | curl_easy_setopt(curl_handle, CURLOPT_URL, url); |
---|
[36122] | 197 | |
---|
| 198 | if(user != NULL && pass != NULL) |
---|
| 199 | { |
---|
| 200 | curl_easy_setopt(curl_handle, CURLOPT_USERNAME, user); |
---|
| 201 | curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, pass); |
---|
| 202 | curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
---|
| 203 | } |
---|
[35348] | 204 | if(data == NULL) |
---|
| 205 | curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1L); |
---|
| 206 | else |
---|
[37468] | 207 | { |
---|
| 208 | curl_easy_setopt(curl_handle, CURLOPT_POST, 1); |
---|
[35348] | 209 | curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, data); |
---|
[38926] | 210 | |
---|
| 211 | /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and |
---|
| 212 | 303 HTTP response codes */ |
---|
| 213 | curl_easy_setopt(curl_handle, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); |
---|
[37468] | 214 | } |
---|
[36122] | 215 | if(flag == 1) |
---|
| 216 | curl_easy_setopt(curl_handle, CURLOPT_HEADER, 1L); |
---|
[35348] | 217 | curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 5); |
---|
[38926] | 218 | curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 3); |
---|
| 219 | // curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, 1); |
---|
| 220 | |
---|
[35348] | 221 | /* send all data to this function */ |
---|
[36122] | 222 | if(localfile == NULL) |
---|
| 223 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); |
---|
| 224 | else |
---|
| 225 | curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); |
---|
| 226 | |
---|
[35348] | 227 | /* we pass our 'chunk' struct to the callback function */ |
---|
[36122] | 228 | if(localfile == NULL) |
---|
| 229 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); |
---|
| 230 | else |
---|
| 231 | curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, fp); |
---|
| 232 | |
---|
[35348] | 233 | /* some servers don't like requests that are made without a user-agent field, so we provide one */ |
---|
[38926] | 234 | // curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0"); |
---|
| 235 | curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36"); |
---|
[36122] | 236 | |
---|
| 237 | // This is occassionally required to stop CURL from verifying the peers certificate. |
---|
| 238 | // CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if |
---|
| 239 | // CURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2 - check the existence of a |
---|
| 240 | // common name and also verify that it matches the hostname provided) |
---|
| 241 | #ifdef MIPSEL |
---|
| 242 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 1L); |
---|
| 243 | #else |
---|
[36052] | 244 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); |
---|
[36122] | 245 | #endif |
---|
| 246 | |
---|
[35348] | 247 | curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L); |
---|
| 248 | if(debuglevel == 99) |
---|
| 249 | curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1); |
---|
[35352] | 250 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, "/mnt/network/cookies"); |
---|
| 251 | curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, "/mnt/network/cookies"); |
---|
[38926] | 252 | /* enable redirect following */ |
---|
[35348] | 253 | curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); |
---|
[38926] | 254 | /* allow three redirects */ |
---|
| 255 | curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); |
---|
| 256 | |
---|
| 257 | /* enable all supported built-in compressions */ |
---|
| 258 | curl_easy_setopt(curl_handle, CURLOPT_ACCEPT_ENCODING, ""); |
---|
| 259 | |
---|
[36122] | 260 | if(referer == NULL) |
---|
| 261 | curl_easy_setopt(curl_handle, CURLOPT_AUTOREFERER, 1L); |
---|
| 262 | else |
---|
| 263 | curl_easy_setopt(curl_handle, CURLOPT_REFERER, referer); |
---|
[35348] | 264 | |
---|
| 265 | /* get it! */ |
---|
| 266 | res = curl_easy_perform(curl_handle); |
---|
| 267 | /* check for errors */ |
---|
| 268 | if(res != CURLE_OK) |
---|
| 269 | { |
---|
| 270 | err("failed: %s", curl_easy_strerror(res)); |
---|
| 271 | printf("curl error\n"); |
---|
| 272 | } |
---|
| 273 | else |
---|
| 274 | { |
---|
| 275 | /* |
---|
| 276 | * Now, our chunk.memory points to a memory block that is chunk.size |
---|
| 277 | * bytes big and contains the remote file. |
---|
| 278 | * |
---|
| 279 | * Do something nice with it! |
---|
| 280 | */ |
---|
| 281 | printf("%lu bytes retrieved\n", (long)chunk.size); |
---|
| 282 | } |
---|
| 283 | |
---|
| 284 | /* cleanup curl stuff */ |
---|
| 285 | curl_easy_cleanup(curl_handle); |
---|
[36122] | 286 | if(localfile != NULL) |
---|
| 287 | fclose(fp); |
---|
[35348] | 288 | } |
---|
[36122] | 289 | |
---|
[35348] | 290 | tmpstr = ostrcat(chunk.memory, NULL, 0, 0); |
---|
| 291 | free(chunk.memory); |
---|
| 292 | /* we're done with libcurl, so clean it up */ |
---|
| 293 | curl_global_cleanup(); |
---|
| 294 | |
---|
[36122] | 295 | if(localfile != NULL) |
---|
| 296 | free(tmpstr), tmpstr = NULL; |
---|
[35348] | 297 | return tmpstr; |
---|
| 298 | } |
---|
| 299 | |
---|
[36122] | 300 | char* string_decode3(char* input) |
---|
| 301 | { |
---|
| 302 | if(input == NULL) return input; |
---|
| 303 | |
---|
| 304 | input = string_replace_all("Ä", "Ä", input, 1); |
---|
| 305 | input = string_replace_all("ä", "ä", input, 1); |
---|
| 306 | input = string_replace_all("É", "É", input, 1); |
---|
| 307 | input = string_replace_all("é", "é", input, 1); |
---|
| 308 | input = string_replace_all("Ö", "Ö", input, 1); |
---|
| 309 | input = string_replace_all("ö", "ö", input, 1); |
---|
| 310 | input = string_replace_all("Ü", "Ü", input, 1); |
---|
| 311 | input = string_replace_all("ü", "ü", input, 1); |
---|
| 312 | input = string_replace_all("ß", "ß", input, 1); |
---|
| 313 | input = string_replace_all("&", "&", input, 1); |
---|
| 314 | |
---|
| 315 | input = string_replace_all("Ä", "Ä", input, 1); |
---|
| 316 | input = string_replace_all("ä", "ä", input, 1); |
---|
| 317 | input = string_replace_all("É", "É", input, 1); |
---|
| 318 | input = string_replace_all("é", "é", input, 1); |
---|
| 319 | input = string_replace_all("Ö", "Ö", input, 1); |
---|
| 320 | input = string_replace_all("ö", "ö", input, 1); |
---|
| 321 | input = string_replace_all("Ü", "Ü", input, 1); |
---|
| 322 | input = string_replace_all("ü", "ü", input, 1); |
---|
| 323 | input = string_replace_all("ß", "ß", input, 1); |
---|
| 324 | input = string_replace_all("&", "&", input, 1); |
---|
| 325 | |
---|
| 326 | return input; |
---|
| 327 | } |
---|
| 328 | |
---|
[24456] | 329 | char* getfilekey(char* w, char* i, char* s, char* e) |
---|
| 330 | { |
---|
| 331 | char* ret = NULL; |
---|
| 332 | |
---|
| 333 | if(w == NULL || i == NULL || s == NULL || e == NULL) |
---|
| 334 | return NULL; |
---|
| 335 | |
---|
| 336 | int a = 0, b = 0, c = 0; |
---|
| 337 | int a1 = 0, b1 = 0; |
---|
| 338 | |
---|
| 339 | int lw = strlen(w); |
---|
| 340 | int li = strlen(i); |
---|
| 341 | int ls = strlen(s); |
---|
| 342 | |
---|
| 343 | if(lw < 5 || li < 5 || ls < 5) |
---|
| 344 | return NULL; |
---|
| 345 | |
---|
| 346 | char ca[lw + li + ls - 14]; |
---|
| 347 | char cb[16]; |
---|
| 348 | |
---|
| 349 | ca[lw + li + ls - 15] = '\0'; |
---|
| 350 | cb[15] = '\0'; |
---|
| 351 | |
---|
| 352 | while(1) |
---|
| 353 | { |
---|
| 354 | if(a < 5) |
---|
| 355 | { |
---|
| 356 | cb[b1] = w[a]; |
---|
| 357 | b1++; |
---|
| 358 | } |
---|
| 359 | else if(a < lw) |
---|
| 360 | { |
---|
| 361 | ca[a1] = w[a]; |
---|
| 362 | a1++; |
---|
| 363 | } |
---|
| 364 | a++; |
---|
| 365 | |
---|
| 366 | if(b < 5) |
---|
| 367 | { |
---|
| 368 | cb[b1] = i[b]; |
---|
| 369 | b1++; |
---|
| 370 | } |
---|
| 371 | else if(b < li) |
---|
| 372 | { |
---|
| 373 | ca[a1] = i[b]; |
---|
| 374 | a1++; |
---|
| 375 | } |
---|
| 376 | b++; |
---|
| 377 | |
---|
| 378 | if(c < 5) |
---|
| 379 | { |
---|
| 380 | cb[b1] = s[c]; |
---|
| 381 | b1++; |
---|
| 382 | } |
---|
| 383 | else if(c < ls) |
---|
| 384 | { |
---|
| 385 | ca[a1] = s[c]; |
---|
| 386 | a1++; |
---|
| 387 | } |
---|
| 388 | c++; |
---|
| 389 | |
---|
| 390 | if(lw + li + ls == a1 + b1) |
---|
| 391 | break; |
---|
| 392 | } |
---|
| 393 | |
---|
| 394 | b = 0; |
---|
| 395 | int d = 0; |
---|
| 396 | char cc[a1 / 2 + 1]; |
---|
| 397 | char casub[3] = {'\0'}; |
---|
| 398 | cc[a1 / 2] = '\0'; |
---|
| 399 | |
---|
| 400 | for(a = 0; a < a1; a += 2) |
---|
| 401 | { |
---|
| 402 | int c = -1; |
---|
| 403 | |
---|
| 404 | if(cb[b] % 2) c = 1; |
---|
| 405 | |
---|
| 406 | casub[0] = ca[a]; |
---|
| 407 | casub[1] = ca[a + 1]; |
---|
| 408 | |
---|
| 409 | cc[d] = strtol(casub, '\0', 36) - c; |
---|
| 410 | b++; d++; |
---|
| 411 | if(b >= b1) b = 0; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | char* r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL; |
---|
| 415 | char* pos = ostrstr(cc, ");}('"); |
---|
| 416 | if(pos != NULL) |
---|
| 417 | { |
---|
| 418 | r1 = string_resub(");}('", "'", pos, 0); |
---|
| 419 | pos = ostrstr(pos + 5, ",'"); |
---|
| 420 | if(pos != NULL) |
---|
| 421 | { |
---|
| 422 | r2 = string_resub(",'", "'", pos, 0); |
---|
| 423 | pos = ostrstr(pos + 2, ",'"); |
---|
| 424 | if(pos != NULL) |
---|
| 425 | { |
---|
| 426 | r3 = string_resub(",'", "'", pos, 0); |
---|
| 427 | pos = ostrstr(pos + 2, ",'"); |
---|
| 428 | if(pos != NULL) |
---|
| 429 | { |
---|
| 430 | r4 = string_resub(",'", "'", pos, 0); |
---|
| 431 | ret = getfilekey(r1, r2, r3, r4); |
---|
| 432 | } |
---|
| 433 | } |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | else |
---|
[24461] | 437 | { |
---|
| 438 | ret = string_resub("ll=\"", "\"", cc, 0); |
---|
| 439 | if(ret == NULL) |
---|
| 440 | ret = string_resub("filekey=\"", "\"", cc, 0); |
---|
| 441 | } |
---|
[24456] | 442 | |
---|
| 443 | free(r1); r1 = NULL; |
---|
| 444 | free(r2); r2 = NULL; |
---|
| 445 | free(r3); r3 = NULL; |
---|
| 446 | free(r4); r4 = NULL; |
---|
| 447 | |
---|
| 448 | return ret; |
---|
| 449 | } |
---|
| 450 | |
---|
[30018] | 451 | int screenlistbox(struct skin* grid, struct skin* listbox,struct skin* countlabel, char* title, char* titheklink, int* pagecount, int* tithekexit, int* oaktpage, int* oaktline, int* ogridcol, int flag, int cflag) |
---|
| 452 | { |
---|
| 453 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL; |
---|
| 454 | |
---|
| 455 | *oaktpage = listbox->aktpage; |
---|
| 456 | *oaktline = listbox->aktline; |
---|
| 457 | *ogridcol = listbox->gridcol; |
---|
| 458 | tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0); |
---|
| 459 | |
---|
| 460 | if(title != NULL) |
---|
| 461 | tmpstr1 = ostrcat(title, " - ", 0, 0); |
---|
| 462 | else |
---|
| 463 | tmpstr1 = ostrcat(((struct tithek*)listbox->select->handle)->menutitle, " - ", 0, 0); |
---|
| 464 | |
---|
| 465 | tmpstr2 = ostrcat(tmpstr1, ((struct tithek*)listbox->select->handle)->title, 1, 0); |
---|
| 466 | screentithekplay(tmpstr, tmpstr2, flag); |
---|
| 467 | free(tmpstr); tmpstr = NULL; |
---|
| 468 | free(tmpstr2); tmpstr2 = NULL; |
---|
| 469 | |
---|
| 470 | *pagecount = createtithekplay(titheklink, grid, listbox, countlabel, cflag); |
---|
| 471 | // if(pagecount == 0 || tithekexit == 1) break; |
---|
| 472 | if(*pagecount == 0 || *tithekexit == 1) return 0; |
---|
| 473 | |
---|
| 474 | listbox->aktpage = *oaktpage; |
---|
| 475 | listbox->aktline = *oaktline; |
---|
| 476 | listbox->gridcol = *ogridcol; |
---|
| 477 | addscreenrc(grid, listbox); |
---|
| 478 | |
---|
| 479 | return 1; |
---|
| 480 | } |
---|
| 481 | |
---|
[34615] | 482 | int all_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
| 483 | { |
---|
| 484 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
| 485 | int ret = 1, count = 0, i = 0; |
---|
[36174] | 486 | |
---|
[34615] | 487 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
| 488 | return ret; |
---|
| 489 | |
---|
| 490 | if(searchstr == NULL) |
---|
| 491 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
| 492 | else |
---|
| 493 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
| 494 | |
---|
| 495 | if(search != NULL) |
---|
| 496 | { |
---|
| 497 | drawscreen(load, 0, 0); |
---|
| 498 | |
---|
| 499 | strstrip(search); |
---|
| 500 | string_tolower(search); |
---|
| 501 | |
---|
| 502 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/all/all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
| 503 | |
---|
| 504 | struct splitstr* ret1 = NULL; |
---|
| 505 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
| 506 | |
---|
| 507 | if(ret1 != NULL) |
---|
| 508 | { |
---|
| 509 | int max = count; |
---|
| 510 | for(i = 0; i < max; i++) |
---|
| 511 | { |
---|
| 512 | |
---|
| 513 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
| 514 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
| 515 | string_tolower(tmpstr1); |
---|
| 516 | |
---|
| 517 | if(ostrstr(tmpstr1, search) != NULL) |
---|
| 518 | { |
---|
| 519 | printf("found: %s\n", ret1[i].part); |
---|
| 520 | int rcret = waitrc(NULL, 10, 0); |
---|
| 521 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
| 522 | |
---|
| 523 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
| 524 | line = ostrcat(line, "\n", 0, 0); |
---|
| 525 | } |
---|
| 526 | free(tmpstr1), tmpstr1 = NULL; |
---|
| 527 | } |
---|
| 528 | free(ret1), ret1 = NULL; |
---|
| 529 | |
---|
| 530 | if(line != NULL) |
---|
| 531 | { |
---|
| 532 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
| 533 | menu = ostrcat("/tmp/tithek/all.search.list", NULL, 0, 0); |
---|
| 534 | writesys(menu, line, 0); |
---|
| 535 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
| 536 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
| 537 | ret = 0; |
---|
| 538 | } |
---|
| 539 | } |
---|
| 540 | free(tmpstr), tmpstr = NULL; |
---|
| 541 | } |
---|
| 542 | free(search), search = NULL; |
---|
| 543 | return ret; |
---|
| 544 | } |
---|
| 545 | |
---|
[36122] | 546 | char* jsunpack(char* input) |
---|
| 547 | { |
---|
| 548 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
| 549 | |
---|
| 550 | if(input == NULL) return input; |
---|
| 551 | |
---|
| 552 | char* b36code = NULL, *search = NULL, *charlist = NULL, *base = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *tmpstr = NULL, *packed = NULL; |
---|
| 553 | |
---|
| 554 | unlink("/tmp/jsunpack1_packed"); |
---|
| 555 | unlink("/tmp/jsunpack2_tmpstr"); |
---|
| 556 | unlink("/tmp/jsunpack3_b36code"); |
---|
| 557 | unlink("/tmp/jsunpack4_tmpstr_last"); |
---|
| 558 | |
---|
[38825] | 559 | //eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('1k.1j(\'<c 13="1i"1h="1g:1f-1e-1d-1c-1b"u="t"s="r"1a="3://h.9.g/f/19.18"><2 1="y"0="x"/><2 1="w"0="v"/><2 1="a"0="3://8.7.6.5/i/q/p.o"/><2 1="l"0="4"><2 1="m"0="4"/><2 1="k"0="j"/><2 1="n"0="4"/><2 1="12"0="3://8.7.6.5:11/d/10/b.z"/><e 13="17"16="b/9"12="3://8.7.6.5:11/d/10/b.z"y="x"w="v"u="t"s="r"a="3://8.7.6.5/i/q/p.o"n="4"m="4"a=""l="4"k="j"15="3://h.9.g/f/14/"></e></c>\');',36,57,'value|name|param|http|false|240|30|56|185|divx|previewImage|video|object||embed|plugin|com|go||Play|previewMessage|allowContextMenu|bannerEnabled|autoPlay|jpg|rezh7ogkvg6b|00004|380|height|715|width|transparent|wmode|Stage6|custommode|mkv|s4umuuk7gii5uaadrm5a76s7fd4bjlcti2r3v6bsa5d6yryt4dawmiqg|182|src|id|download|pluginspage|type|np_vid|cab|DivXBrowserPlugin|codebase|CC0F21721616|9C46|41fa|D0AB|67DABFBF|clsid|classid|ie_vid|write|document'.split('|'))) |
---|
| 560 | |
---|
| 561 | //eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3.2(\'<0 4\'.1(\'8="\'+\'/5\'.1(\'/\'+7+\'">\\6/0>\')))',9,9,'script|concat|write|document|s|jwv|x3C|mpri_Key|rc'.split('|'),0,{})) |
---|
| 562 | |
---|
[36122] | 563 | while(ostrstr(input, "eval(function(p,a,c,k,e,d){") != NULL) |
---|
| 564 | { |
---|
[38825] | 565 | packed = string_resub("eval(function(p,a,c,k,e,d){", "}))", input, 0); |
---|
| 566 | if(packed == NULL) |
---|
| 567 | packed = string_resub("eval(function(p,a,c,k,e,d){", "))", input, 0); |
---|
| 568 | |
---|
[36122] | 569 | titheklog(debuglevel, "/tmp/jsunpack1_packed", NULL, NULL, NULL, packed); |
---|
| 570 | |
---|
| 571 | // tmpstr = string_resub(";return p}('", ");'", packed, 0); |
---|
| 572 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{2,2},[0-9]{2,2},'.*'.split.*", packed); |
---|
[38825] | 573 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 574 | tmpstr = oregex(".*return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 575 | |
---|
| 576 | debug(99, "tmpstr: %s", tmpstr); |
---|
| 577 | titheklog(debuglevel, "/tmp/jsunpack2_packed_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
| 578 | |
---|
| 579 | // b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", packed); |
---|
| 580 | b36code = oregex(".*',[0-9]{1,3},[0-9]{1,3},'(.*)'.split.*", packed); |
---|
| 581 | |
---|
| 582 | b36code = string_replace_all("||", "| |", b36code, 1); |
---|
| 583 | debug(99, "b36code: %s", b36code); |
---|
| 584 | titheklog(debuglevel, "/tmp/jsunpack3_packed_b36code", NULL, NULL, NULL, b36code); |
---|
| 585 | |
---|
| 586 | if(!ostrncmp("|", b36code, 1)) |
---|
| 587 | b36code = ostrcat(" ", b36code, 0, 1); |
---|
| 588 | |
---|
| 589 | struct splitstr* ret1 = NULL; |
---|
| 590 | int count = 0; |
---|
| 591 | int i = 0; |
---|
| 592 | ret1 = strsplit(b36code, "|", &count); |
---|
| 593 | |
---|
| 594 | charlist = ostrcat(charlist, "\"", 1, 0); |
---|
| 595 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 596 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 597 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 598 | charlist = ostrcat(charlist, ".", 1, 0); |
---|
| 599 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 600 | charlist = ostrcat(charlist, ";", 1, 0); |
---|
| 601 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 602 | charlist = ostrcat(charlist, ":", 1, 0); |
---|
| 603 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 604 | charlist = ostrcat(charlist, "=", 1, 0); |
---|
| 605 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 606 | charlist = ostrcat(charlist, ",", 1, 0); |
---|
| 607 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 608 | charlist = ostrcat(charlist, " ", 1, 0); |
---|
| 609 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 610 | charlist = ostrcat(charlist, "\\", 1, 0); |
---|
| 611 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 612 | charlist = ostrcat(charlist, "/", 1, 0); |
---|
| 613 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 614 | charlist = ostrcat(charlist, "(", 1, 0); |
---|
| 615 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 616 | charlist = ostrcat(charlist, ")", 1, 0); |
---|
| 617 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 618 | charlist = ostrcat(charlist, "%", 1, 0); |
---|
| 619 | |
---|
| 620 | for(i = 0; i < count; i++) |
---|
| 621 | { |
---|
| 622 | if(ostrstr((&ret1[i])->part, " ") != NULL) |
---|
| 623 | { |
---|
| 624 | printf("continue\n"); |
---|
| 625 | continue; |
---|
| 626 | } |
---|
| 627 | char* x = oltostr(i, 36); |
---|
| 628 | |
---|
| 629 | struct splitstr* ret2 = NULL; |
---|
| 630 | int count2 = 0; |
---|
| 631 | int i2 = 0; |
---|
| 632 | tmpstr2 = ostrcat(charlist, NULL, 0, 0); |
---|
| 633 | ret2 = strsplit(tmpstr2, "|", &count2); |
---|
| 634 | for(i2 = 0; i2 < count2; i2++) |
---|
| 635 | { |
---|
| 636 | struct splitstr* ret3 = NULL; |
---|
| 637 | int count3 = 0; |
---|
| 638 | int i3 = 0; |
---|
| 639 | tmpstr3 = ostrcat(charlist, NULL, 0, 0); |
---|
| 640 | ret3 = strsplit(tmpstr3, "|", &count3); |
---|
| 641 | for(i3 = 0; i3 < count3; i3++) |
---|
| 642 | { |
---|
| 643 | debug(99, "-----------------------------------------------"); |
---|
| 644 | debug(99, "replace %s%s%s <> %s%s%s",(&ret2[i2])->part, x, (&ret3[i3])->part, (&ret2[i2])->part, (&ret1[i])->part, (&ret3[i3])->part); |
---|
| 645 | |
---|
| 646 | base = ostrcat(base, (&ret2[i2])->part, 1, 0); |
---|
| 647 | base = ostrcat(base, x, 1, 0); |
---|
| 648 | base = ostrcat(base, (&ret3[i3])->part, 1, 0); |
---|
| 649 | search = ostrcat(search, (&ret2[i2])->part, 1, 0); |
---|
| 650 | search = ostrcat(search, (&ret1[i])->part, 1, 0); |
---|
| 651 | search = ostrcat(search, (&ret3[i3])->part, 1, 0); |
---|
| 652 | tmpstr = string_replace_all(base, search, tmpstr, 1); |
---|
| 653 | free(base), base = NULL; |
---|
| 654 | free(search), search = NULL; |
---|
| 655 | } |
---|
| 656 | free(ret3), ret3 = NULL; |
---|
| 657 | free(tmpstr3), tmpstr3 = NULL; |
---|
| 658 | } |
---|
| 659 | free(ret2), ret2 = NULL; |
---|
| 660 | free(tmpstr2), tmpstr2 = NULL; |
---|
| 661 | free(x); |
---|
| 662 | } |
---|
| 663 | free(ret1), ret1 = NULL; |
---|
| 664 | |
---|
| 665 | titheklog(debuglevel, "/tmp/jsunpack4_packed_tmpstr_last", NULL, NULL, NULL, tmpstr); |
---|
| 666 | |
---|
| 667 | if(tmpstr == NULL) |
---|
| 668 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted-error){", input, 1); |
---|
| 669 | else |
---|
| 670 | { |
---|
| 671 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted){", input, 1); |
---|
| 672 | input = string_replace(packed, tmpstr, input, 1); |
---|
| 673 | } |
---|
| 674 | free(tmpstr),tmpstr = NULL; |
---|
| 675 | free(packed), packed = NULL; |
---|
| 676 | free(b36code), b36code = NULL; |
---|
| 677 | free(charlist), charlist = NULL; |
---|
| 678 | } |
---|
| 679 | |
---|
| 680 | //eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[2-9k-t]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('k p(a){5 b="s=1",c="t=l";7(a&&a.8&&a.8.9>0)6(5 d=0;d<a.8.9;d++){5 e=a.8[d],f=["r","m"];6(5 g n f){5 h=f[g];7(e&&e[h])6(5 i=e[h],j=0;j<i.9;j++)i[j]&&i[j].2&&(i[j].2+=(-1==i[j].2.o("?")?"?":"&")+"4=3&"+b+"&"+c)}}q a}',[],30,'||file|false|direct|var|for|if|playlist|length|||||||||||function|g2wppbatyvegydjngpim4hp5rl6ammlhkneq3sdgfqh5woiym753qlis6o6737kceon73boksojlkppwz744cta5i2kpzwwdsh3hrjqq3eiwcysqmy6aerlaeszaptrregtvpdfsdaiy4idwqdlack4abotyacmth2a253x5lrvvul7dxs6kligge5dufn6eofjjxex7vzljmvrrv4dnb4xlbn3hvb67c2pgc7y|httpfallback|in|indexOf|jwConfig|return|sources|ua|vt'.split('|'),0,{})) |
---|
| 681 | |
---|
| 682 | while(ostrstr(input, "eval(function(p,a,c,k,e,r){") != NULL) |
---|
| 683 | { |
---|
| 684 | packed = string_resub("eval(function(p,a,c,k,e,r){", "))", input, 0); |
---|
| 685 | titheklog(debuglevel, "/tmp/jsunpack1_packed", NULL, NULL, NULL, packed); |
---|
| 686 | |
---|
| 687 | // tmpstr = string_resub(";return p}('", ");'", packed, 0); |
---|
| 688 | // tmpstr = oregex(".*;return p}(.*)',[0-9]{2,2},[0-9]{2,2},'.*'.split.*", packed); |
---|
[36122] | 689 | tmpstr = oregex(".*;return p}(.*)',[0-9]{1,3},[0-9]{1,3},'.*'.split.*", packed); |
---|
| 690 | |
---|
| 691 | debug(99, "tmpstr: %s", tmpstr); |
---|
[38825] | 692 | titheklog(debuglevel, "/tmp/jsunpack2_packed_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
[36122] | 693 | |
---|
| 694 | // b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", packed); |
---|
| 695 | b36code = oregex(".*',[0-9]{1,3},[0-9]{1,3},'(.*)'.split.*", packed); |
---|
| 696 | |
---|
| 697 | b36code = string_replace_all("||", "| |", b36code, 1); |
---|
| 698 | debug(99, "b36code: %s", b36code); |
---|
[38825] | 699 | titheklog(debuglevel, "/tmp/jsunpack3_packed_b36code", NULL, NULL, NULL, b36code); |
---|
[36122] | 700 | |
---|
| 701 | if(!ostrncmp("|", b36code, 1)) |
---|
| 702 | b36code = ostrcat(" ", b36code, 0, 1); |
---|
| 703 | |
---|
| 704 | struct splitstr* ret1 = NULL; |
---|
| 705 | int count = 0; |
---|
| 706 | int i = 0; |
---|
| 707 | ret1 = strsplit(b36code, "|", &count); |
---|
| 708 | |
---|
| 709 | charlist = ostrcat(charlist, "\"", 1, 0); |
---|
| 710 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 711 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 712 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 713 | charlist = ostrcat(charlist, ".", 1, 0); |
---|
| 714 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 715 | charlist = ostrcat(charlist, ";", 1, 0); |
---|
| 716 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 717 | charlist = ostrcat(charlist, ":", 1, 0); |
---|
| 718 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 719 | charlist = ostrcat(charlist, "=", 1, 0); |
---|
| 720 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 721 | charlist = ostrcat(charlist, ",", 1, 0); |
---|
| 722 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 723 | charlist = ostrcat(charlist, " ", 1, 0); |
---|
| 724 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 725 | charlist = ostrcat(charlist, "\\", 1, 0); |
---|
| 726 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 727 | charlist = ostrcat(charlist, "/", 1, 0); |
---|
| 728 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 729 | charlist = ostrcat(charlist, "(", 1, 0); |
---|
| 730 | charlist = ostrcat(charlist, "|", 1, 0); |
---|
| 731 | charlist = ostrcat(charlist, ")", 1, 0); |
---|
| 732 | charlist = ostrcat(charlist, "'", 1, 0); |
---|
| 733 | charlist = ostrcat(charlist, "%", 1, 0); |
---|
| 734 | |
---|
| 735 | for(i = 0; i < count; i++) |
---|
| 736 | { |
---|
| 737 | if(ostrstr((&ret1[i])->part, " ") != NULL) |
---|
| 738 | { |
---|
| 739 | printf("continue\n"); |
---|
| 740 | continue; |
---|
| 741 | } |
---|
| 742 | char* x = oltostr(i, 36); |
---|
| 743 | |
---|
| 744 | struct splitstr* ret2 = NULL; |
---|
| 745 | int count2 = 0; |
---|
| 746 | int i2 = 0; |
---|
| 747 | tmpstr2 = ostrcat(charlist, NULL, 0, 0); |
---|
| 748 | ret2 = strsplit(tmpstr2, "|", &count2); |
---|
| 749 | for(i2 = 0; i2 < count2; i2++) |
---|
| 750 | { |
---|
| 751 | struct splitstr* ret3 = NULL; |
---|
| 752 | int count3 = 0; |
---|
| 753 | int i3 = 0; |
---|
| 754 | tmpstr3 = ostrcat(charlist, NULL, 0, 0); |
---|
| 755 | ret3 = strsplit(tmpstr3, "|", &count3); |
---|
| 756 | for(i3 = 0; i3 < count3; i3++) |
---|
| 757 | { |
---|
| 758 | debug(99, "-----------------------------------------------"); |
---|
| 759 | debug(99, "replace %s%s%s <> %s%s%s",(&ret2[i2])->part, x, (&ret3[i3])->part, (&ret2[i2])->part, (&ret1[i])->part, (&ret3[i3])->part); |
---|
| 760 | |
---|
| 761 | base = ostrcat(base, (&ret2[i2])->part, 1, 0); |
---|
| 762 | base = ostrcat(base, x, 1, 0); |
---|
| 763 | base = ostrcat(base, (&ret3[i3])->part, 1, 0); |
---|
| 764 | search = ostrcat(search, (&ret2[i2])->part, 1, 0); |
---|
| 765 | search = ostrcat(search, (&ret1[i])->part, 1, 0); |
---|
| 766 | search = ostrcat(search, (&ret3[i3])->part, 1, 0); |
---|
| 767 | tmpstr = string_replace_all(base, search, tmpstr, 1); |
---|
| 768 | free(base), base = NULL; |
---|
| 769 | free(search), search = NULL; |
---|
| 770 | } |
---|
| 771 | free(ret3), ret3 = NULL; |
---|
| 772 | free(tmpstr3), tmpstr3 = NULL; |
---|
| 773 | } |
---|
| 774 | free(ret2), ret2 = NULL; |
---|
| 775 | free(tmpstr2), tmpstr2 = NULL; |
---|
| 776 | free(x); |
---|
| 777 | } |
---|
| 778 | free(ret1), ret1 = NULL; |
---|
| 779 | |
---|
[38825] | 780 | titheklog(debuglevel, "/tmp/jsunpack4_packed_tmpstr_last", NULL, NULL, NULL, tmpstr); |
---|
[36122] | 781 | |
---|
| 782 | if(tmpstr == NULL) |
---|
| 783 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted-error){", input, 1); |
---|
| 784 | else |
---|
| 785 | { |
---|
| 786 | input = string_replace("eval(function(p,a,c,k,e,d){", "eval(function(p,a,c,k,e,d-extracted){", input, 1); |
---|
| 787 | input = string_replace(packed, tmpstr, input, 1); |
---|
| 788 | } |
---|
| 789 | free(tmpstr),tmpstr = NULL; |
---|
| 790 | free(packed), packed = NULL; |
---|
| 791 | free(b36code), b36code = NULL; |
---|
| 792 | free(charlist), charlist = NULL; |
---|
| 793 | } |
---|
| 794 | |
---|
| 795 | return input; |
---|
| 796 | } |
---|
| 797 | |
---|
[39020] | 798 | void localparser_init(char* titheklink, char* tithekfile, int flag) |
---|
[36211] | 799 | { |
---|
| 800 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *cmd = NULL, *line = NULL, *path = NULL; |
---|
[39035] | 801 | struct skin* load = getscreen("loading"); |
---|
[36211] | 802 | |
---|
| 803 | if(ostrcmp("http://atemio.dyndns.tv/mediathek/mainmenu.list", titheklink) == 0) |
---|
| 804 | { |
---|
[37150] | 805 | path = ostrcat("/tmp/localparser", NULL, 0, 0); |
---|
[39035] | 806 | drawscreen(load, 0, 0); |
---|
[36211] | 807 | |
---|
[39581] | 808 | char* titheklocalfile = ostrcat("/tmp/tithek/mainmenu.local.list", NULL, 0, 0); |
---|
| 809 | |
---|
[39020] | 810 | if(flag == 1) |
---|
[36949] | 811 | { |
---|
[39020] | 812 | if(!file_exist("/tmp/localhoster")) |
---|
| 813 | mkdir("/tmp/localhoster", 0777); |
---|
| 814 | if(!file_exist("/mnt/parser")) |
---|
| 815 | mkdir("/mnt/parser", 0777); |
---|
| 816 | if(!file_exist(path)) |
---|
| 817 | mkdir(path, 0777); |
---|
| 818 | |
---|
| 819 | gethttp("atemio.dyndns.tv", "/mediathek/parser_free.tar", 80, "/tmp/parser.tar", HTTPAUTH, 5000, NULL, 0); |
---|
| 820 | |
---|
[40191] | 821 | cmd = ostrcat("tar -xf /tmp/parser.tar -C ", path, 0, 0); |
---|
[40195] | 822 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[36949] | 823 | system(cmd); |
---|
[40195] | 824 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[36949] | 825 | free(cmd), cmd = NULL; |
---|
[39033] | 826 | unlink("/tmp/parser.tar"); |
---|
[40195] | 827 | printf("[tithek] remove: /tmp/parser.tar\n"); |
---|
[39020] | 828 | |
---|
| 829 | if(file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack")) |
---|
| 830 | { |
---|
| 831 | gethttp("atemio.dyndns.tv", "/mediathek/parser_secret.tar", 80, "/tmp/parser.tar", HTTPAUTH, 5000, NULL, 0); |
---|
[40191] | 832 | cmd = ostrcat("tar -xf /tmp/parser.tar -C ", path, 0, 0); |
---|
[40195] | 833 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[39020] | 834 | system(cmd); |
---|
[40195] | 835 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[39020] | 836 | free(cmd), cmd = NULL; |
---|
[40195] | 837 | printf("[tithek] remove: /tmp/parser.tar\n"); |
---|
[39034] | 838 | unlink("/tmp/parser.tar"); |
---|
[39020] | 839 | } |
---|
| 840 | |
---|
| 841 | gethttp("atemio.dyndns.tv", "/mediathek/hoster.tar", 80, "/tmp/hoster.tar", HTTPAUTH, 5000, NULL, 0); |
---|
[40191] | 842 | cmd = ostrcat("tar -xf /tmp/hoster.tar -C ", "/tmp/localhoster", 0, 0); |
---|
[40195] | 843 | printf("[tithek] start cmd: %s\n", cmd); |
---|
[39020] | 844 | system(cmd); |
---|
[40195] | 845 | printf("[tithek] ende cmd: %s\n", cmd); |
---|
[39020] | 846 | free(cmd), cmd = NULL; |
---|
[40195] | 847 | printf("[tithek] remove: /tmp/hoster.tar\n"); |
---|
[39033] | 848 | unlink("/tmp/hoster.tar"); |
---|
[39031] | 849 | |
---|
[40119] | 850 | //dnode is freed in thread |
---|
| 851 | struct download* dnode = calloc(1, sizeof(struct download)); |
---|
| 852 | if(dnode != NULL) |
---|
| 853 | { |
---|
| 854 | dnode->host = ostrcat("atemio.dyndns.tv", NULL, 0, 0); |
---|
[40180] | 855 | dnode->page = ostrcat("/mediathek/python.tar", NULL, 0, 0); |
---|
[40119] | 856 | dnode->port = 80; |
---|
[40176] | 857 | dnode->filename = ostrcat("/tmp/python.tar", NULL, 0, 0); |
---|
[40191] | 858 | |
---|
| 859 | printf("[tithek] getfreespace start\n"); |
---|
| 860 | |
---|
[40174] | 861 | if(getfreespace("/mnt") / 1024 > 102400) //100mb |
---|
[40160] | 862 | { |
---|
[40153] | 863 | mkdir("/mnt/.tithek", 0777); |
---|
[40159] | 864 | if(file_exist("/mnt/.tithek")) |
---|
[40153] | 865 | dnode->filename = ostrcat("/mnt/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 866 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 867 | symlink("/mnt/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40174] | 868 | } |
---|
| 869 | else if(file_exist("/media/hdd") && getfreespace("/media/hdd") / 1024 > 102400) |
---|
[40153] | 870 | { |
---|
| 871 | mkdir("/media/hdd/.tithek", 0777); |
---|
[40159] | 872 | if(file_exist("/media/hdd/.tithek")) |
---|
[40153] | 873 | dnode->filename = ostrcat("/media/hdd/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 874 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 875 | symlink("/media/hdd/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40153] | 876 | } |
---|
[40174] | 877 | else if(file_exist("/var/swap") && getfreespace("/var/swap") / 1024 > 102400) |
---|
[40153] | 878 | { |
---|
| 879 | mkdir("/var/swap/.tithek", 0777); |
---|
[40159] | 880 | if(file_exist("/var/swap/.tithek")) |
---|
[40153] | 881 | dnode->filename = ostrcat("/var/swap/.tithek/python.tar", NULL, 0, 0); |
---|
[40195] | 882 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
| 883 | symlink("/var/swap/.tithek/lib", "/tmp/localhoster/lib"); |
---|
[40153] | 884 | } |
---|
[40174] | 885 | else if(getfreespace("/tmp") / 1024 > 102400) |
---|
| 886 | { |
---|
| 887 | dnode->filename = ostrcat("/tmp/python.tar", NULL, 0, 0); |
---|
[40176] | 888 | dnode->page = ostrcat("/mediathek/python_full.tar", NULL, 0, 0); |
---|
[40174] | 889 | } |
---|
[40191] | 890 | printf("[tithek] getfreespace end\n"); |
---|
[40174] | 891 | |
---|
[40279] | 892 | // if(ostrcmp(dnode->page, "/tmp/python.tar") == 0 || getconfigint("tithek_autoupdate", NULL) == 1) |
---|
| 893 | if(getconfigint("tithek_autoupdate", NULL) == 1) |
---|
[40195] | 894 | { |
---|
[40313] | 895 | if(file_exist(dnode->filename)) |
---|
[40195] | 896 | { |
---|
| 897 | printf("[tithek] remove before download: %s\n", dnode->page); |
---|
[40313] | 898 | unlink(dnode->filename); |
---|
[40195] | 899 | } |
---|
| 900 | } |
---|
| 901 | |
---|
[40119] | 902 | dnode->auth = ostrcat(HTTPAUTH, NULL, 0, 0); |
---|
| 903 | dnode->connfd = -1; |
---|
| 904 | dnode->ret = -1; |
---|
[40121] | 905 | dnode->timeout = 10000; |
---|
[40119] | 906 | addtimer(&tithekdownloadthread, START, 100, 1, (void*)dnode, NULL, NULL); |
---|
| 907 | } |
---|
| 908 | |
---|
[39031] | 909 | cmd = ostrcat("chmod -R 755 ", path, 0, 0); |
---|
| 910 | system(cmd); |
---|
| 911 | free(cmd), cmd = NULL; |
---|
| 912 | |
---|
| 913 | cmd = ostrcat("chmod -R 755 /mnt/parser", NULL, 0, 0); |
---|
| 914 | system(cmd); |
---|
| 915 | free(cmd), cmd = NULL; |
---|
| 916 | |
---|
| 917 | cmd = ostrcat("chmod -R 755 /tmp/localhoster", NULL, 0, 0); |
---|
| 918 | system(cmd); |
---|
| 919 | free(cmd), cmd = NULL; |
---|
[39581] | 920 | // } |
---|
[36211] | 921 | |
---|
[39581] | 922 | cmd = ostrcat("ls -1 ", path, 0, 0); |
---|
| 923 | cmd = ostrcat(cmd, "/*.sh", 1, 0); |
---|
| 924 | |
---|
| 925 | free(path), path = NULL; |
---|
| 926 | tmpstr1 = command("ls -1 /mnt/parser/*.sh"); |
---|
| 927 | tmpstr2 = command(cmd); |
---|
| 928 | free(cmd), cmd = NULL; |
---|
| 929 | tmpstr = ostrcat(tmpstr1, "\n", 0, 0); |
---|
| 930 | tmpstr = ostrcat(tmpstr, tmpstr2, 1, 0); |
---|
| 931 | |
---|
| 932 | int count = 0, i = 0; |
---|
| 933 | struct splitstr* ret1 = NULL; |
---|
| 934 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
| 935 | |
---|
| 936 | int max = count; |
---|
| 937 | for(i = 0; i < max; i++) |
---|
[36211] | 938 | { |
---|
[39581] | 939 | if(file_exist(ret1[i].part) && cmpfilenameext(ret1[i].part, ".sh") == 0) |
---|
| 940 | { |
---|
| 941 | cmd = ostrcat(ret1[i].part, " ", 0, 0); |
---|
| 942 | cmd = ostrcat(cmd, ret1[i].part, 1, 0); |
---|
| 943 | cmd = ostrcat(cmd, " init", 1, 0); |
---|
| 944 | line = command(cmd); |
---|
[40191] | 945 | line = string_newline(line); |
---|
[40195] | 946 | printf("[tithek] cmd: %s\n", cmd); |
---|
[39581] | 947 | debug(99, "add main menuentry: %s", line); |
---|
| 948 | writesys(titheklocalfile, line, 3); |
---|
| 949 | free(cmd), cmd = NULL; |
---|
| 950 | free(line), line = NULL; |
---|
| 951 | } |
---|
[36211] | 952 | } |
---|
[39581] | 953 | free(ret1), ret1 = NULL; |
---|
| 954 | free(tmpstr), tmpstr = NULL; |
---|
| 955 | free(tmpstr1), tmpstr1 = NULL; |
---|
| 956 | free(tmpstr2), tmpstr2 = NULL; |
---|
[36211] | 957 | } |
---|
[39581] | 958 | |
---|
| 959 | line = readfiletomem(titheklocalfile, 1); |
---|
| 960 | free(titheklocalfile), titheklocalfile = NULL; |
---|
| 961 | writesys(tithekfile, line, 3); |
---|
| 962 | |
---|
[39035] | 963 | clearscreen(load); |
---|
[36211] | 964 | } |
---|
[39581] | 965 | |
---|
[36211] | 966 | } |
---|
| 967 | |
---|
[36966] | 968 | char* localparser_hoster(char* link) |
---|
| 969 | { |
---|
[37026] | 970 | debug(99, "link: %s", link); |
---|
[36966] | 971 | int ret = 1; |
---|
| 972 | char* tmpstr = NULL, *streamurl = NULL; |
---|
| 973 | |
---|
| 974 | tmpstr = command(link); |
---|
| 975 | tmpstr = string_newline(tmpstr); |
---|
[40006] | 976 | debug(99, "tmpstr: %s", tmpstr); |
---|
[36970] | 977 | |
---|
[39993] | 978 | if(ostrstr(tmpstr, "gethoster2") != NULL) |
---|
| 979 | { |
---|
| 980 | tmpstr = string_replace_all("gethoster2 ", "", tmpstr, 1); |
---|
| 981 | streamurl = hoster(tmpstr); |
---|
| 982 | } |
---|
| 983 | else if(ostrstr(link, ".sh play ") != NULL) |
---|
[36970] | 984 | streamurl = ostrcat(tmpstr, NULL, 0, 0); |
---|
[36973] | 985 | else if(ostrstr(link, ".sh hoster ") != NULL) |
---|
[36972] | 986 | streamurl = hoster(tmpstr); |
---|
[36970] | 987 | |
---|
[36966] | 988 | free(tmpstr), tmpstr = NULL; |
---|
| 989 | |
---|
[40006] | 990 | debug(99, "streamurl: %s", streamurl); |
---|
| 991 | |
---|
[36966] | 992 | return streamurl; |
---|
| 993 | } |
---|
| 994 | |
---|
| 995 | int localparser_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
| 996 | { |
---|
[37534] | 997 | char* tmpstr = NULL, *menu = NULL, *search = NULL, *cmd = NULL; |
---|
[37443] | 998 | int ret = 1; |
---|
[36966] | 999 | |
---|
| 1000 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
| 1001 | return ret; |
---|
| 1002 | |
---|
| 1003 | if(searchstr == NULL) |
---|
| 1004 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
| 1005 | else |
---|
| 1006 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
| 1007 | |
---|
| 1008 | if(search != NULL) |
---|
| 1009 | { |
---|
| 1010 | drawscreen(load, 0, 0); |
---|
| 1011 | |
---|
| 1012 | strstrip(search); |
---|
| 1013 | string_tolower(search); |
---|
[37534] | 1014 | search = stringreplacechar(search, ' ', '+'); |
---|
[36966] | 1015 | |
---|
[37534] | 1016 | cmd = ostrcat(link, NULL, 0, 0); |
---|
| 1017 | |
---|
[37532] | 1018 | if(ostrstr(cmd, "%search%") != NULL) |
---|
[37534] | 1019 | cmd = string_replace_all("%search%", search, cmd, 1); |
---|
[37532] | 1020 | else |
---|
| 1021 | cmd = ostrcat(link, search, 0, 0); |
---|
| 1022 | |
---|
[37533] | 1023 | debug(99, "cmd: %s", cmd); |
---|
[36970] | 1024 | char* filename = command(cmd); |
---|
| 1025 | filename = string_newline(filename); |
---|
| 1026 | tmpstr = readfiletomem(filename, 1); |
---|
| 1027 | free(cmd), cmd = NULL; |
---|
[36966] | 1028 | |
---|
[36970] | 1029 | if(tmpstr != NULL) |
---|
[36966] | 1030 | { |
---|
[36970] | 1031 | tmpstr = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", tmpstr, 1); |
---|
| 1032 | menu = ostrcat(filename, NULL, 0, 0); |
---|
| 1033 | // writesys(menu, tmpstr, 0); |
---|
| 1034 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
| 1035 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
| 1036 | ret = 0; |
---|
| 1037 | } |
---|
[36966] | 1038 | |
---|
[36970] | 1039 | free(filename), filename = NULL; |
---|
[36966] | 1040 | free(tmpstr), tmpstr = NULL; |
---|
| 1041 | } |
---|
| 1042 | free(search), search = NULL; |
---|
| 1043 | return ret; |
---|
| 1044 | } |
---|
| 1045 | |
---|
[36122] | 1046 | #endif |
---|