Changeset 32096


Ignore:
Timestamp:
01/04/15 20:52:21 (8 years ago)
Author:
obi
Message:

tithek fix movreel

File:
1 edited

Legend:

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

    r29526 r32096  
    4444
    4545        tmppath = ostrcat("/", path, 0, 0);
    46 //      free(path), path = NULL;
    4746
    48 /////////////
    49 
    50 
    51 /*
    52         tmphost = ostrcat("www.", host, 0, 0);
    53         tmppath = ostrcat("/", file, 0, 0);
    54         debug(99, "tmphost: %s", tmphost);
    55         ip = get_ip(tmphost);
    56         debug(99, "ip: %s", ip);
    57         debug(99, "test host only: %s", get_ip(host));
    58         debug(99, "tmppath: %s", tmppath);
    59 */
     47        if(!ostrncmp("www.", tmphost, 7))
     48                tmphost = ostrcat("www.", tmphost, 0, 1);
     49        tmppath = string_replace(".html", "", tmppath, 1);
    6050
    6151        send = ostrcat(send, "GET ", 1, 0);
    6252        send = ostrcat(send, tmppath, 1, 0);
    63         send = ostrcat(send, " HTTP/1.1\r\nAccept-Encoding: identity\r\n", 1, 0);
    64         send = ostrcat(send, "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4\r\n", 1, 0);
    65         send = ostrcat(send, "Host: ", 1, 0);
     53        send = ostrcat(send, " HTTP/1.0", 1, 0);
     54        send = ostrcat(send, "\r\nHost: ", 1, 0);
    6655        send = ostrcat(send, tmphost, 1, 0);
    67         send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3\r\n", 1, 0);
    68         send = ostrcat(send, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n", 1, 0);
    69         send = ostrcat(send, "Connection: close\r\nCookie: xxx2=ok;\r\n\r\n", 1, 0);
     56        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);
     57        send = ostrcat(send, "\r\nConnection: close", 1, 0);
     58        send = ostrcat(send, "\r\nAccept-Encoding: gzip", 1, 0);       
     59        send = ostrcat(send, "\r\n\r\n", 1, 0);
    7060        debug(99, "send: %s", send);
    7161
    72         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1);
     62        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 15000, 1);
    7363        free(send), send = NULL;
    7464        debug(99, "tmpstr: %s", tmpstr);
    7565        titheklog(debuglevel, "/tmp/movreel1_get", NULL, NULL, NULL, tmpstr);
     66        char* cokkie = string_resub("Set-Cookie: ", ";", tmpstr, 0);
    7667
    77         if(tmpstr == NULL)
    78         {
    79                 textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    80                 goto end;
    81         }
     68        send = ostrcat(send, "GET ", 1, 0);
     69        send = ostrcat(send, tmppath, 1, 0);
     70        send = ostrcat(send, " HTTP/1.0", 1, 0);
     71        send = ostrcat(send, "\r\nHost: ", 1, 0);
     72        send = ostrcat(send, tmphost, 1, 0);
     73        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);
     74        send = ostrcat(send, "\r\nCookie: ", 1, 0);
     75        send = ostrcat(send, cokkie, 1, 0);
     76        send = ostrcat(send, "\r\nConnection: close", 1, 0);
     77        send = ostrcat(send, "\r\nAccept-Encoding: gzip", 1, 0);       
     78        send = ostrcat(send, "\r\n\r\n", 1, 0);
     79        debug(99, "send: %s", send);
    8280
    83         if(tmpstr == NULL || ostrstr(tmpstr, "Die von Ihnen angeforderte Datei konnte nicht gefunden werden") != NULL)
    84         {
    85                 textbox(_("Message"), _("The file that you requested could not be found"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    86                 goto end;
    87         }
    88 
    89         if(tmpstr == NULL || ostrstr(tmpstr, "No such file No such user exist File not found") != NULL)
    90         {
    91                 textbox(_("Message"), _("No such file No such user exist File not found"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    92                 goto end;
    93         }
    94 
    95         if(tmpstr == NULL || ostrstr(tmpstr, "<title>The page is temporarily unavailable</title>") != NULL)
    96         {
    97                 error = string_resub("<td align=\"center\" valign=\"middle\">", "</td>", tmpstr, 0);
    98                 string_deltags(error);
    99                 stringreplacechar(error, '|', '\0');
    100                 error = strstrip(error);
    101                 if(error == NULL || strlen(error) == 0)
    102                         error = ostrcat(_("The page is temporarily unavailable"), error, 0, 1);
    103                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    104                 goto end;
    105         }
    106 
    107         if(ostrstr(tmpstr, "<title>Direct IP access not allowed") != NULL)
    108         {
    109                 error = string_resub("<title>", "</title>", tmpstr, 0);
    110                 string_deltags(error);
    111                 stringreplacechar(error, '|', '\0');
    112                 error = strstrip(error);
    113                 if(error == NULL || strlen(error) == 0)
    114                         error = ostrcat(_("The page is temporarily unavailable"), error, 0, 1);
    115                 textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
    116                 goto end;
    117         }
    118 
    119         //get hash from tmpstr
    120         char* pos1 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"fname\" value=");
    121         fname = getxmlentry(pos1, "value=");
    122         debug(99, "fname: %s", fname);
    123         if(fname == NULL) goto end;
    124 
    125         char* pos2 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"id\" value=");
    126         id = getxmlentry(pos2, "value=");
    127         debug(99, "id: %s", id);
    128         if(id == NULL) goto end;
    129 
    130         char* pos3 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"op\" value=");
    131         op = getxmlentry(pos3, "value=");
    132         free(tmpstr); tmpstr = NULL;
    133         debug(99, "op: %s", op);
    134         if(op == NULL) goto end;
    13581        free(tmpstr), tmpstr = NULL;
    136 
    137         hash = ostrcat(hash, "id=", 1, 0);     
    138         hash = ostrcat(hash, id, 1, 0);
    139         hash = ostrcat(hash, "&referer=&fname=", 1, 0);
    140         hash = ostrcat(hash, fname, 1, 0);
    141         hash = ostrcat(hash, "&method_free=%20Kostenloser%20Download&usr_login=&op=", 1, 0);
    142         hash = ostrcat(hash, op, 1, 0);
    143         debug(99, "hash: %s", hash);
    144 
    145         hashlen = oitoa(strlen(hash));
    146        
    147         //create send string
    148         send = ostrcat(send, "POST /", 1, 0);
    149         send = ostrcat(send, id, 1, 0);
    150         send = ostrcat(send, " HTTP/1.0\r\nContent-Length: ", 1, 0);
    151         send = ostrcat(send, hashlen, 1, 0);
    152         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);
    153         send = ostrcat(send, tmphost, 1, 0);
    154         send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
    155         send = ostrcat(send, hash, 1, 0);
    156         debug(99, "send: %s", send);
    157         free(hash), hash = NULL;
    158 
    159         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0);
     82        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 15000, 1);
    16083        free(send), send = NULL;
    16184        debug(99, "tmpstr: %s", tmpstr);
    162         titheklog(debuglevel, "/tmp/movreel2_post", NULL, NULL, NULL, tmpstr);
    163 
    164         if(tmpstr == NULL)
    165         {
    166                 textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
    167                 goto end;
    168         }
     85        titheklog(debuglevel, "/tmp/movreel2_get", NULL, NULL, NULL, tmpstr);
    16986
    17087        char* pos4 = ostrstr(tmpstr, "<input type=\"hidden\" name=\"id\" value=");
     
    183100        if(op == NULL) goto end;
    184101
    185         hash = ostrcat(hash, "id=", 1, 0);     
     102        hash = ostrcat(hash, "rand=", 1, 0);
     103        hash = ostrcat(hash, rand, 1, 0);
     104        hash = ostrcat(hash, "&referer=%22&method_premium=&down_script=1&method_free=%22&id=", 1, 0);
    186105        hash = ostrcat(hash, id, 1, 0);
    187         hash = ostrcat(hash, "&referer=&rand=", 1, 0);
    188         hash = ostrcat(hash, rand, 1, 0);
    189         hash = ostrcat(hash, "&method_free=%20Kostenloser%20Download&usr_login=&op=", 1, 0);
     106        hash = ostrcat(hash, "&op=", 1, 0);
    190107        hash = ostrcat(hash, op, 1, 0);
     108
    191109        debug(99, "hash: %s", hash);
    192110
     
    200118        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);
    201119        send = ostrcat(send, tmphost, 1, 0);
     120
     121        send = ostrcat(send, "\r\nCookie: ", 1, 0);
     122        send = ostrcat(send, cokkie, 1, 0);
     123
    202124        send = ostrcat(send, "\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n", 1, 0);
    203125        send = ostrcat(send, hash, 1, 0);
    204126        debug(99, "send: %s", send);
    205127        free(hash), hash = NULL;
    206        
    207         tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0);
     128        free(cokkie), cokkie = NULL;
     129
     130        tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 15000, 0);
    208131        free(send), send = NULL;
    209132        debug(99, "post: %s", tmpstr);
     
    216139        }
    217140
    218         streamlink = string_resub("var file_link = '", "'", tmpstr, 0);         
     141        char* streamlink1 = string_resub("<span style=", "</span>", tmpstr, 0);         
     142        streamlink = string_resub("<a href=\"", "\"", streamlink1, 0);         
     143        free(streamlink1); streamlink1 = NULL;
    219144
    220145        titheklog(debuglevel, "/tmp/movreel4_streamlink", NULL, NULL, NULL, streamlink);
Note: See TracChangeset for help on using the changeset viewer.