Ignore:
Timestamp:
10/14/13 21:47:04 (10 years ago)
Author:
obi
Message:

fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tithek/xvidstage.h

    r24251 r24315  
    3333        char* charlist = NULL;
    3434
    35         unlink("/tmp/tithek/get");
    36         unlink("/tmp/tithek/post");
     35        unlink("/tmp/xvidstage1_get");
     36        unlink("/tmp/xvidstage2_post");
    3737
    3838        if(host == NULL || file == NULL) return NULL;
    3939
    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);
    4243        debug(99, "tmphost: %s", tmphost);
    4344        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);       
    5345        debug(99, "tmphost: %s", tmphost);
    5446        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);       
    5554        debug(99, "send: %s", send);
    56 
     55       
    5756        char* line = NULL;
    5857        char* lines = NULL;
    5958        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
    6165        sleep(1);
    62         free(send); send = NULL;
    63         if(!file_exist("/tmp/tithek/get"))
     66        if(tmpstr == NULL)
    6467        {
    6568                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);
     
    6770        }
    6871
    69         if(debuglevel == 99) system("cp -a /tmp/tithek/get /tmp/xvidstage1_tmpstr_get");
    70 
    71         tmpstr = command("cat /tmp/tithek/get");
    7272        cookie = string_resub("Set-Cookie: afc=", ";", tmpstr, 0);     
    7373        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);
    10374
    10475        //get hash from tmpstr
     
    10677        fname = getxmlentry(pos1, "value=");
    10778        debug(99, "fname: %s", fname);
    108 //      if(fname == NULL) goto end;
     79        if(fname == NULL) goto end;
    10980
    11081        char* pos2 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"id\" value=");
     
    11586        char* pos3 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"op\" value=");
    11687        op = getxmlentry(pos3, "value=");
     88        debug(99, "op: %s", op);
    11789
    11890        char* pos4 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"rand\" value=");
    11991        hashline = getxmlentry(pos4, "value=");
     92        debug(99, "hashline: %s", hashline);
    12093
    12194        char* pos5 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"referer\" value=");
    12295        referer = getxmlentry(pos5, "value=");
     96        debug(99, "referer: %s", referer);
    12397
    12498        char* pos6 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"imhuman\" value=");
    12599        imhuman = getxmlentry(pos6, "value=");
     100        debug(99, "imhuman: %s", imhuman);
    126101
    127102        char* pos7 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"usr_login\" value=");
    128103        usr_login = getxmlentry(pos7, "value=");
     104        debug(99, "usr_login: %s", usr_login);
    129105       
    130106        free(tmpstr); tmpstr = NULL;
    131         debug(99, "op: %s", op);
    132107        if(op == NULL) goto end;
    133108
     
    144119        hash = ostrcat(hash, id, 1, 0);
    145120        hash = ostrcat(hash, "&op=download1", 1, 0);
    146 //      hash = ostrcat(hash, op, 1, 0);
     121        hash = ostrcat(hash, op, 1, 0);
    147122        debug(99, "hash: %s", hash);
    148123        hashlen = oitoa(strlen(hash));
    149124
    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);
    155127        send = ostrcat(send, " HTTP/1.1\r\nContent-Length: ", 1, 0);
    156128        send = ostrcat(send, hashlen, 1, 0);
    157129        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);
    159131        send = ostrcat(send, "\r\nCookie: afc=", 1, 0);
    160132        send = ostrcat(send, cookie, 1, 0);
     
    163135        debug(99, "send: %s", send);
    164136
    165         free(tmpstr), tmpstr = NULL;
    166 
    167137        //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)
    174144        {
    175145                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);
    176146                goto end;
    177147        }
    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       
    188149        tmpstr = string_resub(";return p}('", ");'", post, 0);
    189         titheklog(debuglevel, "/tmp/xvidstage6_tmpstr_post1_zcat_resub", NULL, tmpstr);
     150        titheklog(debuglevel, "/tmp/xvidstage3_tmpstr", NULL, tmpstr);
    190151       
    191152        post = string_replace_all(tmpstr, "", post, 1);
    192153        post = string_replace_all(";return p}(');'", "", post, 1);
    193         titheklog(debuglevel, "/tmp/xvidstage7_tmpstr_post2", NULL, post);
     154        titheklog(debuglevel, "/tmp/xvidstage4_tmpstr", NULL, post);
    194155
    195156        free(tmpstr),tmpstr = NULL;
    196157        free(b36code),b36code = NULL;
    197158        tmpstr = string_resub(";return p}('", ");'", post, 0);
    198         titheklog(debuglevel, "/tmp/xvidstage8_tmpstr_post2_resub", NULL, tmpstr);
     159        titheklog(debuglevel, "/tmp/xvidstage5_tmpstr", NULL, tmpstr);
    199160
    200161        b36code = oregex(".*;',[0-9]{2,2},[0-9]{2,2},'(.*)'.split.*", post);
    201162       
    202163        b36code = string_replace_all("||", "| |", b36code, 1);
    203         titheklog(debuglevel, "/tmp/xvidstage9_tmpstr_post2_resub_b36code2", NULL, b36code);
     164        titheklog(debuglevel, "/tmp/xvidstage6_tmpstr", NULL, b36code);
    204165       
    205166        struct splitstr* ret1 = NULL;
     
    280241        free(charlist), charlist = NULL;
    281242
    282         titheklog(debuglevel, "/tmp/xvidstage10_tmpstr_last", NULL, tmpstr);
     243        titheklog(debuglevel, "/tmp/xvidstage7_tmpstr_last", NULL, tmpstr);
    283244
    284245        streamlink = oregex(".*file.*(http:.*video.flv).*image.*", tmpstr);
     
    310271                streamlink = oregex(".*value=.*(http:.*video.avi).*\".*", tmpstr);                     
    311272
    312         titheklog(debuglevel, "/tmp/xvidstage11_streamlink", NULL, streamlink);
     273        titheklog(debuglevel, "/tmp/xvidstage8_streamlink", NULL, streamlink);
    313274
    314275        free(tmpstr); tmpstr = NULL;
Note: See TracChangeset for help on using the changeset viewer.