Changeset 38816
- Timestamp:
- 09/16/16 10:33:19 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/promptfile.h
r32084 r38816 6 6 debug(99, "link: %s", link); 7 7 int debuglevel = getconfigint("debuglevel", NULL); 8 char* tmphost = NULL, *error = NULL, *tmppath = NULL, *tmpstr = NULL, *send = NULL, *id = NULL, *fname = NULL, *op = NULL, *hash = NULL, *hashlen = NULL, *ip = NULL; 9 char* post = NULL, *streamlink = NULL; 10 // char* cmd = NULL; 8 char* tmpstr = NULL, *post = NULL, *streamlink = NULL, *chashname = NULL, *chashvalue = NULL, *extra = NULL, *tmpstr2 = NULL, *tmplink = NULL; 11 9 12 10 if(link == NULL) return NULL; … … 14 12 unlink("/tmp/promptfile1_get"); 15 13 unlink("/tmp/promptfile2_post"); 16 unlink("/tmp/promptfile3_tmpstr1"); 17 unlink("/tmp/promptfile4_post2"); 18 unlink("/tmp/promptfile5_tmpstr2"); 19 unlink("/tmp/promptfile6_b36code2"); 20 unlink("/tmp/promptfile7_tmpstr_last"); 21 unlink("/tmp/promptfile8_streamlink"); 22 23 ///////////// 24 char* tmplink = NULL, *pos = NULL, *path = NULL; 14 unlink("/tmp/promptfile3_streamlink"); 25 15 26 16 tmplink = ostrcat(link, NULL, 0, 0); 27 17 28 debug(99, "tmplink: %s", tmplink);29 30 char* referer = NULL;31 // htmldecode(referer, tmplink);32 referer = htmlencode(tmplink);33 referer = string_replace_all("/", "%2F", referer, 1);34 debug(99, "referer: %s", referer);35 36 37 18 if(ostrstr(link, "/Out/?s=") != NULL) 38 19 { … … 41 22 } 42 23 43 44 if(tmplink == NULL || ostrncmp("http://", tmplink, 7)) 24 if(tmplink == NULL || ostrncmp("http", tmplink, 4)) 45 25 { 46 textbox(_("Message"), _("Hoster Url not http:// ") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);26 textbox(_("Message"), _("Hoster Url not http:// or https://") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); 47 27 goto end; 48 28 } 49 29 50 tmphost = string_replace("http://", "", tmplink, 0); 51 free(tmplink) , tmplink = NULL; 52 53 if(tmphost != NULL) 54 pos = strchr(tmphost, '/'); 55 if(pos != NULL) 56 { 57 pos[0] = '\0'; 58 path = pos + 1; 59 } 60 61 tmppath = ostrcat("/", path, 0, 0); 62 // free(path), path = NULL; 63 64 ///////////// 65 66 /* 67 tmphost = ostrcat("www.", host, 0, 0); 68 tmppath = ostrcat("/", file, 0, 0); 69 debug(99, "tmphost: %s", tmphost); 70 ip = get_ip(tmphost); 71 debug(99, "ip: %s", ip); 72 debug(99, "test host only: %s", get_ip(host)); 73 debug(99, "tmppath: %s", tmppath); 74 */ 75 76 send = ostrcat(send, "GET ", 1, 0); 77 send = ostrcat(send, tmppath, 1, 0); 78 send = ostrcat(send, " HTTP/1.0", 1, 0); 79 send = ostrcat(send, "\r\nHost: ", 1, 0); 80 send = ostrcat(send, tmphost, 1, 0); 81 send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1", 1, 0); 82 send = ostrcat(send, "\r\nConnection: close", 1, 0); 83 send = ostrcat(send, "\r\nAccept-Encoding: gzip", 1, 0); 84 send = ostrcat(send, "\r\n\r\n", 1, 0); 85 debug(99, "send: %s", send); 86 87 tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); 88 free(send), send = NULL; 89 debug(99, "tmpstr: %s", tmpstr); 30 tmpstr = gethttps(tmplink, NULL, NULL, NULL, NULL, NULL, 1); 90 31 titheklog(debuglevel, "/tmp/promptfile1_get", NULL, NULL, NULL, tmpstr); 91 32 … … 96 37 } 97 38 98 char* chash = string_resub("name=\"chash\" value=\"", "\"", tmpstr, 0); 99 hash = ostrcat(hash, "chash=", 1, 0); 100 hash = ostrcat(hash, chash, 1, 0); 101 debug(99, "hash: %s", hash); 39 // <input type="hidden" id="chash" name = "ch883c3b867d7baa1d9e0176d44e7af34de1281a93" value="b205ee9355067bbc71a3802324d3aa42df661450" /> 40 // <button type="submit" class="gray_btn" onclick='$("#chash").val("bb"+$("#chash").val());//For Kodi devs: we are prepared to rotate our code every hour. So please stop including us in your addons.'>Continue to File</button> 102 41 103 hashlen = oitoa(strlen(hash)); 42 chashname = oregex("id=\"chash\" name.*\"(.*)\" value=.*", tmpstr); 43 chashvalue = oregex("id=\"chash\" name.*value=\"(.*)\" />.*", tmpstr); 44 extra = string_resub("onclick='$(\"#chash\").val(\"", "\"+$(\"#chash\").val", tmpstr, 0); 45 debug(99, "chashname: %s", chashname); 46 debug(99, "extra: %s", extra); 47 debug(99, "chashvalue: %s", chashvalue); 104 48 105 char* cokkie = string_resub("Set-Cookie: ", ";", tmpstr, 0); 49 post = ostrcat(chashname, "=", 0, 0); 50 post = ostrcat(post, extra, 1, 0); 51 post = ostrcat(post, chashvalue, 1, 0); 52 free(chashname), chashname = NULL; 53 free(extra), extra = NULL; 54 free(chashvalue), chashvalue = NULL; 106 55 107 //create send string 108 send = ostrcat(send, "POST ", 1, 0); 109 send = ostrcat(send, tmppath, 1, 0); 56 debug(99, "post: %s", post); 110 57 111 send = ostrcat(send, " HTTP/1.0\r\nContent-Length: ", 1, 0); 112 send = ostrcat(send, hashlen, 1, 0); 113 send = ostrcat(send, "\r\nAccept-Encoding: gzip", 1, 0); 114 send = ostrcat(send, "\r\nHost: ", 1, 0); 115 send = ostrcat(send, tmphost, 1, 0); 116 send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0", 1, 0); 117 send = ostrcat(send, "\r\nConnection: close", 1, 0); 118 send = ostrcat(send, "\r\nReferer: ", 1, 0); 119 send = ostrcat(send, link, 1, 0); 120 send = ostrcat(send, "\r\nCookie: ", 1, 0); 121 send = ostrcat(send, cokkie, 1, 0); 122 send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded", 1, 0); 123 send = ostrcat(send, "\r\n\r\n", 1, 0); 124 send = ostrcat(send, hash, 1, 0); 125 debug(99, "send: %s", send); 126 127 free(cokkie), cokkie = NULL; 128 129 post = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0); 130 free(send), send = NULL; 131 debug(99, "post: %s", post); 58 tmpstr = gethttps(tmplink, NULL, post, NULL, NULL, tmplink, 1); 132 59 titheklog(debuglevel, "/tmp/promptfile2_post", NULL, NULL, NULL, tmpstr); 133 60 134 if(post == NULL) 135 { 136 textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); 137 goto end; 138 } 61 tmpstr2 = string_resub("flowplayer(container", "native_fullscreen", tmpstr, 0); 62 // src: "http://www.promptfile.com/file/eyJpIjoiRDFEM0M1MEZGNC00MTBDRTA2RDY5IiwiZSI6MTQ3NDAxNTU0OSwidCI6Im1vYmlsZSIsImgiOiJlZmE1ZmQ2NzBlMDJiOWQ4ZjEzMTBlZjg5NzVlYTBlNzUzZjU1YzViIiwicyI6MX0=" } 139 63 140 free(tmpstr),tmpstr = NULL; 141 tmpstr = string_resub(";return p}('", ");'", post, 0); 142 debug(99, "tmpstr: %s", tmpstr); 143 titheklog(debuglevel, "/tmp/promptfile3_tmpstr1", NULL, NULL, NULL, tmpstr); 144 145 post = string_replace_all(tmpstr, "", post, 1); 146 post = string_replace_all(";return p}(');'", "", post, 1); 147 debug(99, "post: %s", post); 148 titheklog(debuglevel, "/tmp/promptfile4_post2", NULL, NULL, NULL, post); 149 150 streamlink = string_resub("url: '", "',", post, 0); 151 152 titheklog(debuglevel, "/tmp/promptfile8_streamlink", NULL, NULL, NULL, streamlink); 153 154 free(tmpstr); tmpstr = NULL; 64 streamlink = oregex("src:.*\"(.*)\" }.*", tmpstr); 65 titheklog(debuglevel, "/tmp/promptfile3_streamlink", NULL, NULL, NULL, streamlink); 155 66 156 67 end: 157 68 158 free(error); error = NULL;159 free(tmphost); tmphost = NULL;160 free(tmppath); tmppath = NULL;161 69 free(tmpstr); tmpstr = NULL; 162 free(send); send = NULL; 163 free(hash), hash = NULL; 164 free(hashlen), hashlen = NULL; 165 free(op), op = NULL; 166 free(id), id = NULL; 167 free(fname), fname = NULL; 168 free(ip); ip = NULL; 70 free(tmpstr2); tmpstr2 = NULL; 71 free(chashname), chashname = NULL; 72 free(chashvalue), chashvalue = NULL; 73 free(extra), extra = NULL; 74 free(tmplink), tmplink = NULL; 75 free(post), post = NULL; 169 76 170 77 return streamlink;
Note: See TracChangeset
for help on using the changeset viewer.