Changeset 24315 for titan/plugins/tithek/xvidstage.h
- Timestamp:
- 10/14/13 21:47:04 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/xvidstage.h
r24251 r24315 33 33 char* charlist = NULL; 34 34 35 unlink("/tmp/ tithek/get");36 unlink("/tmp/ tithek/post");35 unlink("/tmp/xvidstage1_get"); 36 unlink("/tmp/xvidstage2_post"); 37 37 38 38 if(host == NULL || file == NULL) return NULL; 39 39 40 tmphost = ostrcat("www.", host, 0, 0); 41 tmpfile = ostrcat("/file/", file, 0, 0); 40 // tmphost = ostrcat("www.", host, 0, 0); 41 tmphost = ostrcat(host, NULL, 0, 0); 42 tmpfile = ostrcat("/", file, 0, 0); 42 43 debug(99, "tmphost: %s", tmphost); 43 44 ip = get_ip(tmphost); 44 debug(99, "ip: %s", ip);45 debug(99, "tmpfile: %s", tmpfile);46 debug(99, "file: %s", file);47 48 send = ostrcat(send, "GET /", 1, 0);49 send = ostrcat(send, file, 1, 0);50 send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0);51 send = ostrcat(send, host, 1, 0);52 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\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);53 45 debug(99, "tmphost: %s", tmphost); 54 46 debug(99, "tmpfile: %s", tmpfile); 47 debug(99, "ip: %s", ip); 48 49 send = ostrcat(send, "GET ", 1, 0); 50 send = ostrcat(send, tmpfile, 1, 0); 51 send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0); 52 send = ostrcat(send, tmphost, 1, 0); 53 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\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0); 55 54 debug(99, "send: %s", send); 56 55 57 56 char* line = NULL; 58 57 char* lines = NULL; 59 58 char* cmd = NULL; 60 gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/get", NULL, NULL, 0, send, NULL, 5000, 1); 59 60 tmpstr = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); 61 debug(99, "tmpstr: %s", tmpstr); 62 titheklog(debuglevel, "/tmp/xvidstage1_get", NULL, tmpstr); 63 free(send); send = NULL; 64 61 65 sleep(1); 62 free(send); send = NULL; 63 if(!file_exist("/tmp/tithek/get")) 66 if(tmpstr == NULL) 64 67 { 65 68 textbox(_("Message"), _("This file doesn't exist, or has been removed") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); … … 67 70 } 68 71 69 if(debuglevel == 99) system("cp -a /tmp/tithek/get /tmp/xvidstage1_tmpstr_get");70 71 tmpstr = command("cat /tmp/tithek/get");72 72 cookie = string_resub("Set-Cookie: afc=", ";", tmpstr, 0); 73 73 debug(99, "cookie: %s", cookie); 74 75 titheklog(debuglevel, "/tmp/xvidstage2_tmpstr", NULL, tmpstr);76 77 free(tmpstr), tmpstr = NULL;78 79 line = string_newline(command("cat /tmp/tithek/get | grep 'Set-Cookie:' -n | tail -n1| cut -d':' -f1"));80 cmd = ostrcat(cmd, "cat /tmp/tithek/get | wc -l", 1, 0);81 lines = string_newline(command(cmd));82 free(cmd); cmd = NULL;83 debug(99, "line: %s", line);84 debug(99, "lines: %s", lines);85 86 if(lines == NULL || line == NULL) goto end;87 88 int sline = atoi(lines) - atoi(line) - 4;89 debug(99, "sline: %d", sline);90 debug(99, "sline: %s", oitoa(sline));91 92 cmd = ostrcat(cmd, "cat /tmp/tithek/get | tail -n", 1, 0);93 cmd = ostrcat(cmd, oitoa(sline), 1, 0);94 cmd = ostrcat(cmd, " | sed '1,1d' | zcat", 1, 0);95 debug(99, "cmd: %s", cmd);96 tmpstr = command(cmd);97 free(cmd); cmd = NULL;98 free(lines); lines = NULL;99 100 titheklog(debuglevel, "/tmp/xvidstage3_tmpstr_zcat", NULL, tmpstr);101 102 sleep(1);103 74 104 75 //get hash from tmpstr … … 106 77 fname = getxmlentry(pos1, "value="); 107 78 debug(99, "fname: %s", fname); 108 //if(fname == NULL) goto end;79 if(fname == NULL) goto end; 109 80 110 81 char* pos2 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"id\" value="); … … 115 86 char* pos3 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"op\" value="); 116 87 op = getxmlentry(pos3, "value="); 88 debug(99, "op: %s", op); 117 89 118 90 char* pos4 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"rand\" value="); 119 91 hashline = getxmlentry(pos4, "value="); 92 debug(99, "hashline: %s", hashline); 120 93 121 94 char* pos5 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"referer\" value="); 122 95 referer = getxmlentry(pos5, "value="); 96 debug(99, "referer: %s", referer); 123 97 124 98 char* pos6 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"imhuman\" value="); 125 99 imhuman = getxmlentry(pos6, "value="); 100 debug(99, "imhuman: %s", imhuman); 126 101 127 102 char* pos7 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"usr_login\" value="); 128 103 usr_login = getxmlentry(pos7, "value="); 104 debug(99, "usr_login: %s", usr_login); 129 105 130 106 free(tmpstr); tmpstr = NULL; 131 debug(99, "op: %s", op);132 107 if(op == NULL) goto end; 133 108 … … 144 119 hash = ostrcat(hash, id, 1, 0); 145 120 hash = ostrcat(hash, "&op=download1", 1, 0); 146 //hash = ostrcat(hash, op, 1, 0);121 hash = ostrcat(hash, op, 1, 0); 147 122 debug(99, "hash: %s", hash); 148 123 hashlen = oitoa(strlen(hash)); 149 124 150 //create send string 151 free(send), send = NULL; 152 153 send = ostrcat(send, "POST /", 1, 0); 154 send = ostrcat(send, file, 1, 0); 125 send = ostrcat(send, "POST ", 1, 0); 126 send = ostrcat(send, tmpfile, 1, 0); 155 127 send = ostrcat(send, " HTTP/1.1\r\nContent-Length: ", 1, 0); 156 128 send = ostrcat(send, hashlen, 1, 0); 157 129 send = ostrcat(send, "\r\nAccept-Encoding: gzip\r\nConnection: close\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nHost: ", 1, 0); 158 send = ostrcat(send, host, 1, 0);130 send = ostrcat(send, tmphost, 1, 0); 159 131 send = ostrcat(send, "\r\nCookie: afc=", 1, 0); 160 132 send = ostrcat(send, cookie, 1, 0); … … 163 135 debug(99, "send: %s", send); 164 136 165 free(tmpstr), tmpstr = NULL;166 167 137 //send and receive answer 168 // post = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0);169 // writesys("/var/usr/local/share/titan/plugins/tithek/xvidstage_post1", post, 0);170 /// 171 gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/post", NULL, NULL, 0, send, NULL, 5000, 0); 172 173 if( !file_exist("/tmp/tithek/post"))138 post = gethttpreal(tmphost, tmpfile, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); 139 debug(99, "post: %s", post); 140 titheklog(debuglevel, "/tmp/xvidstage2_post", NULL, post); 141 142 // hier wird nun ein captcha bild auth verlangt geht also erstmal nicht mehr 143 if(post == NULL) 174 144 { 175 145 textbox(_("Message"), _("This file doesn't exist, or has been removed") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); 176 146 goto end; 177 147 } 178 179 if(debuglevel == 99) system("cp -a /tmp/tithek/post /tmp/xvidstage4_tmpstr_post"); 180 181 cmd = ostrcat(cmd, "cat /tmp/tithek/post | zcat", 1, 0); 182 debug(99, "cmd: %s", cmd); 183 post = command(cmd); 184 titheklog(debuglevel, "/tmp/xvidstage5_tmpstr_post1_zcat", NULL, post); 185 free(cmd); cmd = NULL; 186 187 free(tmpstr),tmpstr = NULL; 148 188 149 tmpstr = string_resub(";return p}('", ");'", post, 0); 189 titheklog(debuglevel, "/tmp/xvidstage 6_tmpstr_post1_zcat_resub", NULL, tmpstr);150 titheklog(debuglevel, "/tmp/xvidstage3_tmpstr", NULL, tmpstr); 190 151 191 152 post = string_replace_all(tmpstr, "", post, 1); 192 153 post = string_replace_all(";return p}(');'", "", post, 1); 193 titheklog(debuglevel, "/tmp/xvidstage 7_tmpstr_post2", NULL, post);154 titheklog(debuglevel, "/tmp/xvidstage4_tmpstr", NULL, post); 194 155 195 156 free(tmpstr),tmpstr = NULL; 196 157 free(b36code),b36code = NULL; 197 158 tmpstr = string_resub(";return p}('", ");'", post, 0); 198 titheklog(debuglevel, "/tmp/xvidstage 8_tmpstr_post2_resub", NULL, tmpstr);159 titheklog(debuglevel, "/tmp/xvidstage5_tmpstr", NULL, tmpstr); 199 160 200 161 b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", post); 201 162 202 163 b36code = string_replace_all("||", "| |", b36code, 1); 203 titheklog(debuglevel, "/tmp/xvidstage 9_tmpstr_post2_resub_b36code2", NULL, b36code);164 titheklog(debuglevel, "/tmp/xvidstage6_tmpstr", NULL, b36code); 204 165 205 166 struct splitstr* ret1 = NULL; … … 280 241 free(charlist), charlist = NULL; 281 242 282 titheklog(debuglevel, "/tmp/xvidstage 10_tmpstr_last", NULL, tmpstr);243 titheklog(debuglevel, "/tmp/xvidstage7_tmpstr_last", NULL, tmpstr); 283 244 284 245 streamlink = oregex(".*file.*(http:.*video.flv).*image.*", tmpstr); … … 310 271 streamlink = oregex(".*value=.*(http:.*video.avi).*\".*", tmpstr); 311 272 312 titheklog(debuglevel, "/tmp/xvidstage 11_streamlink", NULL, streamlink);273 titheklog(debuglevel, "/tmp/xvidstage8_streamlink", NULL, streamlink); 313 274 314 275 free(tmpstr); tmpstr = NULL;
Note: See TracChangeset
for help on using the changeset viewer.