Changeset 18651


Ignore:
Timestamp:
11/18/12 17:49:51 (11 years ago)
Author:
obi
Message:

[titan] tithek fix putlocker/sockshare kinox hoster

File:
1 edited

Legend:

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

    r18403 r18651  
    4040{
    4141        debug(99, "in host: %s file: %s", host, file);
    42         int sock = -1, ret = 0;
    4342        char* tmphost = NULL;
    4443        char* tmpfile = NULL;
     
    5150        char* phpsessid = NULL;
    5251        char* serverid = NULL;
     52        char* usender = NULL;
     53        char* line = NULL;
     54        char* lines = NULL;     
     55        char* cmd = NULL;
    5356        char* streamlink = NULL;
    5457        char* streamlink1 = NULL;
     
    6265        debug(99, "ip: %s", ip);
    6366        debug(99, "tmpfile: %s", tmpfile);
    64         tmpstr = gethttp(tmphost, tmpfile, 80, NULL, NULL, NULL, 0);
     67
     68        send = ostrcat(send, "GET /file/", 1, 0);
     69        send = ostrcat(send, file, 1, 0);
     70        send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0); 
     71        send = ostrcat(send, host, 1, 0);
     72        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);       
     73       
     74        debug(99, "tmphost: %s", tmphost);
     75        debug(99, "tmpfile: %s", tmpfile);
     76        debug(99, "send: %s", send);
     77
     78        gethttpreal(tmphost, tmpfile, 80, "/tmp/tithek/get", NULL, NULL, 0, send, NULL, 1);
     79        sleep(1);
     80        free(send); send = NULL;
     81
     82        char* header = NULL;
     83        header = command("cat /tmp/tithek/get");
     84       
     85        phpsessid = getxmlentry(header, "PHPSESSID=");
     86        debug(99, "phpsessid: %s", phpsessid);
     87        serverid = getxmlentry(header, "SERVERID=");
     88        debug(99, "serverid: %s", serverid);
     89        usender = getxmlentry(header, "usender=");
     90        debug(99, "usender: %s", usender);
     91        free(header), header = NULL;
     92
     93        line = string_newline(command("cat /tmp/tithek/get | grep 'Set-Cookie:' -n | tail -n1| cut -d':' -f1"));
     94        cmd = ostrcat(cmd, "cat /tmp/tithek/get | wc -l", 1, 0);
     95        lines = string_newline(command(cmd));
     96        free(cmd); cmd = NULL;
     97        debug(99, "line: %s", line);
     98        debug(99, "lines: %s", lines);
     99
     100        if(lines == NULL || line == NULL) goto end;     
     101       
     102        int sline = atoi(lines) - atoi(line) - 1;
     103        debug(99, "sline: %d", sline);
     104        debug(99, "sline: %s", oitoa(sline));
     105
     106        cmd = ostrcat(cmd, "cat /tmp/tithek/get | tail -n", 1, 0);
     107        cmd = ostrcat(cmd, oitoa(sline), 1, 0);
     108        cmd = ostrcat(cmd, " | sed '1,1d' | zcat", 1, 0);
     109        debug(99, "cmd: %s", cmd);     
     110        tmpstr = command(cmd);
     111        free(cmd); cmd = NULL;
     112        free(lines); lines = NULL;
     113       
     114//      writesys("/var/usr/local/share/titan/plugins/tithek/tmpstr", tmpstr, 0);
    65115
    66116        //get hash from tmpstr
     
    86136        send = ostrcat(send, hashlen, 1, 0);
    87137        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: www.", 1, 0);
    88 
    89138        send = ostrcat(send, host, 1, 0);
    90         send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
    91         send = ostrcat(send, hash, 1, 0);
    92         debug(99, "send: %s", send);
    93 
    94         //send and receive answer
    95         ret = sockportopen(&sock, ip, 80, 5000 * 1000);
    96         if(ret != 0) goto end;
    97         ret = socksend(&sock, (unsigned char*)send, strlen(send), 5000 * 1000);
    98         if(ret != 0) goto end;
    99         free(send); send = NULL;
    100         tmpstr = (char*)putlockereceive(&sock);
    101         debug(99, "tmpstr: %s", tmpstr);
    102 
    103         sockclose(&sock);
    104         sleep(1);
    105 
    106         //get phpsessid and servierid
    107         phpsessid = getxmlentry(tmpstr, "PHPSESSID=");
    108         serverid = getxmlentry(tmpstr, "SERVERID=");
    109         free(tmpstr); tmpstr = NULL;
    110        
    111 // move we need error msg later
    112 //      if(phpsessid == NULL || serverid == NULL) goto end;
    113         if(strlen(phpsessid) > 0) phpsessid[strlen(phpsessid) - 1] = '\0';
    114 
    115         //create send string
    116         send = ostrcat(send, "GET /file/", 1, 0);
    117         send = ostrcat(send, file, 1, 0);
    118         send = ostrcat(send, " HTTP/1.1\r\nHost: www.", 1, 0);
    119         send = ostrcat(send, host, 1, 0);
    120         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\nCookie: SERVERID=", 1, 0);
     139        send = ostrcat(send, "\r\nCookie: usender=", 1, 0);
     140        send = ostrcat(send, usender, 1, 0);
     141        send = ostrcat(send, " SERVERID=", 1, 0);
    121142        send = ostrcat(send, serverid, 1, 0);
    122143        send = ostrcat(send, " PHPSESSID=", 1, 0);
    123144        send = ostrcat(send, phpsessid, 1, 0);
    124         send = ostrcat(send, "\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);
     145        send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
     146        send = ostrcat(send, hash, 1, 0);
    125147        debug(99, "send: %s", send);
    126148
     
    185207        free(phpsessid); phpsessid = NULL;
    186208        free(serverid); serverid = NULL;
     209        free(usender); usender = NULL;
    187210        free(streamlink); streamlink = NULL;
    188         sockclose(&sock);
    189211
    190212        return streamlink1;
Note: See TracChangeset for help on using the changeset viewer.