示例#1
0
 private void handlePassword(final DownloadLink dl) throws PluginException, IOException {
   if (br.getURL().contains("/file_password.html")) {
     logger.info("Current link is password protected");
     String passCode = dl.getStringProperty("pass", null);
     if (passCode == null) {
       passCode = Plugin.getUserInput("Password?", dl);
       if (passCode == null || passCode.equals("")) {
         logger.info("User has entered blank password, exiting handlePassword");
         dl.setProperty("pass", Property.NULL);
         throw new PluginException(LinkStatus.ERROR_RETRY, "Wrong password entered");
       }
       dl.setProperty("pass", passCode);
     }
     br.postPage(
         br.getURL(),
         "submit=access+file&submitme=1&file="
             + this.getFID(dl)
             + "&filePassword="******"/file_password.html")) {
       logger.info("User entered incorrect password --> Retrying");
       dl.setProperty("pass", Property.NULL);
       throw new PluginException(LinkStatus.ERROR_RETRY, "Wrong password entered");
     }
     logger.info("User entered correct password --> Continuing");
   }
 }
示例#2
0
 public String handlePassword(String passCode, Form pwform, DownloadLink thelink)
     throws IOException, PluginException {
   passCode = thelink.getStringProperty("pass", null);
   if (passCode == null) passCode = Plugin.getUserInput("Password?", thelink);
   pwform.put("password", passCode);
   logger.info("Put password \"" + passCode + "\" entered by user in the DLForm.");
   return Encoding.urlEncode(passCode);
 }
示例#3
0
 public String handlePassword(String passCode, Form pwform, DownloadLink thelink)
     throws IOException, PluginException {
   if (thelink.getStringProperty("pass", null) == null) {
     passCode = Plugin.getUserInput("Password?", thelink);
   } else {
     /* gespeicherten PassCode holen */
     passCode = thelink.getStringProperty("pass", null);
   }
   pwform.put("password", passCode);
   logger.info("Put password \"" + passCode + "\" entered by user in the DLForm.");
   return passCode;
 }
示例#4
0
  public void handlePremium(DownloadLink parameter, Account account) throws Exception {
    requestFileInformation(parameter);
    login(account, false);
    br.setFollowRedirects(false);
    br.setCookie(COOKIE_HOST, "mfh_mylang", "en");
    br.getPage(parameter.getDownloadURL());
    String finalLink = null;
    if (br.getRedirectLocation() != null
        && (br.getRedirectLocation().contains("access_key=")
            || br.getRedirectLocation().contains("getfile.php"))) {
      finalLink = br.getRedirectLocation();
    } else {
      if (br.containsHTML("You have got max allowed download sessions from the same IP"))
        throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l);
      String passCode = null;
      if (br.containsHTML("downloadpw")) {
        logger.info("The file you're trying to download seems to be password protected...");
        Form pwform = br.getFormbyProperty("name", "myform");
        if (pwform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
        if (parameter.getStringProperty("pass", null) == null) {
          passCode = Plugin.getUserInput("Password?", parameter);
        } else {
          /* gespeicherten PassCode holen */
          passCode = parameter.getStringProperty("pass", null);
        }
        pwform.put("downloadpw", passCode);
        br.submitForm(pwform);
      }
      if (br.containsHTML("You have got max allowed download sessions from the same IP"))
        throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l);
      if (br.containsHTML("Password Error")) {
        logger.warning("Wrong password!");
        parameter.setProperty("pass", null);
        throw new PluginException(LinkStatus.ERROR_RETRY);
      }

      if (passCode != null) {
        parameter.setProperty("pass", passCode);
      }
      finalLink = findLink(br);
    }
    if (finalLink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    dl = jd.plugins.BrowserAdapter.openDownload(br, parameter, finalLink, true, 0);
    if (dl.getConnection().getContentType().contains("html")) {
      br.followConnection();
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    dl.startDownload();
  }
示例#5
0
  public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress)
      throws Exception {
    ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
    String parameter = param.toString();
    String uid = new Regex(parameter, "([a-z0-9]{7})$").getMatch(0);

    br.getPage(parameter);
    if (br.containsHTML("<div id=\"error\">пакет не найден<")) {
      logger.info("Wrong URL or the package no longer exists.");
      return decryptedLinks;
    }
    String title = br.getRegex("<title>(.*?)</title>").getMatch(0);
    if (title == null) title = "";

    /* Password protected package */
    if (br.containsHTML(">пакет защищен паролем<")) {
      for (int i = 0; i <= 3; i++) {
        final String passCode = Plugin.getUserInput("Enter password for: " + title, param);
        br.postPage(parameter, "put_pwd=" + Encoding.urlEncode(passCode));
        if (br.containsHTML(">пакет защищен паролем<")) continue;
        break;
      }
      if (br.containsHTML(">пакет защищен паролем<"))
        throw new DecrypterException(DecrypterException.PASSWORD);
      if (br.getRedirectLocation() != null) br.getPage(br.getRedirectLocation());
    }

    String domain = new Regex(br.getURL(), "(https?://[^/]+)").getMatch(0);

    String[] links = br.getRegex("href=\"(/download/" + uid + "/[^\"]+)").getColumn(0);
    if (links == null || links.length == 0) {
      logger.warning("Decrypter broken for link: " + parameter);
      return null;
    }

    for (String link : links) {
      decryptedLinks.add(createDownloadlink("directhttp://" + domain + link));
    }

    if (title != null || !title.equals("")) {
      FilePackage fp = FilePackage.getInstance();
      fp.setName(Encoding.htmlDecode(title.trim()));
      fp.addLinks(decryptedLinks);
    }

    return decryptedLinks;
  }
示例#6
0
 public void handleFree(DownloadLink downloadLink) throws Exception {
   requestFileInformation(downloadLink);
   br.setFollowRedirects(false);
   if (br.containsHTML(BLOCKED)) {
     throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, 10 * 1000l);
   }
   if (br.containsHTML("Download password")) {
     Form pw = br.getFormbyProperty("name", "pass");
     String pass = downloadLink.getStringProperty("pass", null);
     if (pass == null) {
       pass = Plugin.getUserInput("Password?", downloadLink);
     }
     pw.put("passwd", pass);
     br.submitForm(pw);
     br.getPage(br.getRedirectLocation());
     if (br.containsHTML("Incorrect password entered")) {
       downloadLink.setProperty("pass", null);
       throw new PluginException(
           LinkStatus.ERROR_FATAL, JDL.L("plugins.errors.wrongpassword", "Password wrong"));
     } else {
       downloadLink.setProperty("pass", pass);
     }
   }
   String lnk = execJS();
   if (lnk == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   if (!lnk.matches("https?://.+") && !lnk.matches("^/.+$")) {
     lnk = new Regex(lnk, "<a href=\"(http://.*?)\"").getMatch(0);
   }
   br.getPage(lnk);
   String dllink = br.getRedirectLocation();
   if (dllink == null) {
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   br.setFollowRedirects(true);
   dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, false, 1);
   if (dl.getConnection().getLongContentLength() == 0) {
     throw new PluginException(
         LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error", 2 * 60 * 60 * 1000l);
   }
   if (!(dl.getConnection().isContentDisposition())) {
     br.followConnection();
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   dl.startDownload();
 }
示例#7
0
 private String handlePassword(final Form pwform, final DownloadLink thelink)
     throws PluginException {
   if (passCode == null) passCode = Plugin.getUserInput("Password?", thelink);
   if (passCode == null || passCode.equals("")) {
     logger.info("User has entered blank password, exiting handlePassword");
     passCode = null;
     thelink.setProperty("pass", Property.NULL);
     return null;
   }
   if (pwform == null) {
     // so we know handlePassword triggered without any form
     logger.info("Password Form == null");
   } else {
     logger.info("Put password \"" + passCode + "\" entered by user in the DLForm.");
     pwform.put("password", Encoding.urlEncode(passCode));
   }
   thelink.setProperty("pass", passCode);
   return passCode;
 }
示例#8
0
  @Override
  public void handleFree(DownloadLink downloadLink) throws Exception {
    requestFileInformation(downloadLink);
    if (br.containsHTML("downloadpw")) {
      Form pwform = br.getFormbyProperty("name", "myform");
      if (pwform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
      String passCode = null;
      {
        if (downloadLink.getStringProperty("pass", null) == null) {
          passCode = Plugin.getUserInput("Password?", downloadLink);

        } else {
          /* gespeicherten PassCode holen */
          passCode = downloadLink.getStringProperty("pass", null);
        }
        pwform.put("downloadpw", passCode);
        br.submitForm(pwform);
        if (br.containsHTML("Password Error")) {
          logger.warning("Wrong password!");
          downloadLink.setProperty("pass", null);
          throw new PluginException(LinkStatus.ERROR_RETRY);
        }
      }
      if (passCode != null) {
        downloadLink.setProperty("pass", passCode);
      }
    }
    // Limit errorhandling, currently this host does not have any limit but
    // if they add the limit, this should work as it is the standard phrase
    // of the script which they use!
    if (br.containsHTML("You have reached the maximum")) {
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l);
    }
    String dllink =
        br.getRegex(
                "wnloadfile style=\"display:none\">.*?<a href=\"(.*?)\" onmouseout='window.status=\"\";return true;' onmou")
            .getMatch(0);
    dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, true, 1);
    dl.startDownload();
  }
示例#9
0
  // @Override
  public void handleFree(DownloadLink downloadLink) throws Exception {
    requestFileInformation(downloadLink);
    /* Link holen */
    HashMap<String, String> submitvalues = HTMLParser.getInputHiddenFields(br.toString());
    postdata = "act=" + Encoding.urlEncode(submitvalues.get("act"));
    postdata = postdata + "&id=" + Encoding.urlEncode(submitvalues.get("id"));
    postdata = postdata + "&fname=" + Encoding.urlEncode(submitvalues.get("fname"));
    if (br.containsHTML("type=\"password\" name=\"password\"")) {
      String password =
          Plugin.getUserInput(
              JDL.L("plugins.hoster.speedysharecom.password", "Enter Password:"******"")) {
        postdata = postdata + "&password=" + Encoding.urlEncode(password);
      }
    }

    /* Zwangswarten, 30seks */
    sleep(30000, downloadLink);

    /* Datei herunterladen */
    jd.plugins.BrowserAdapter.openDownload(
            br, downloadLink, downloadLink.getDownloadURL(), postdata)
        .startDownload();
  }
示例#10
0
  private void handleCaptchaAndPassword(final String partLink, final CryptedLink param)
      throws Exception {
    br.getPage(partLink);
    ALLFORM = br.getFormbyProperty("name", "form");
    boolean b = ALLFORM == null ? true : false;
    // 20150120 - raztoki
    if (ALLFORM == null
        && br.containsHTML(">Please Wait\\.\\.\\.<")
        && br.containsHTML("class=\"timer\">\\d+</span>\\s*seconds</div>")) {
      // pile of redirects happen here
      final String link =
          br.getRegex(
                  "class=\"timer\">\\d+</span>\\s*seconds</div>\\s*<a href=\"\\s*(https?://(\\w+\\.)?relink\\.us/.*?)\\s*\"")
              .getMatch(0);
      if (link != null) {
        br.getPage(link.trim());
        ALLFORM = br.getFormbyProperty("name", "form");
        b = ALLFORM == null ? true : false;
      } else {
        // possible plugin defect
        logger.warning("Possible Plugin Defect!");
      }
    }

    if (b) {
      ALLFORM = br.getForm(0);
      ALLFORM =
          ALLFORM != null
                  && ALLFORM.getAction() != null
                  && ALLFORM
                      .getAction()
                      .matches("^https?://(\\w+\\.)?relink\\.us/container_password\\.php.*")
              ? ALLFORM
              : null;
    }
    if (ALLFORM != null) {
      for (int i = 0; i < 5; i++) {
        if (ALLFORM.containsHTML("password")) {
          final String passCode = Plugin.getUserInput(null, param);
          ALLFORM.put("password", passCode);
        }
        if (ALLFORM.containsHTML("captcha")) {
          ALLFORM.remove("button");
          final String captchaLink = ALLFORM.getRegex("src=\"(.*?)\"").getMatch(0);
          if (captchaLink == null) {
            break;
          }
          final File captchaFile = this.getLocalCaptchaFile();
          Browser.download(
              captchaFile,
              br.cloneBrowser().openGetConnection("http://www.relink.us/" + captchaLink));
          final Point p =
              UserIO.getInstance()
                  .requestClickPositionDialog(
                      captchaFile, "relink.us | " + String.valueOf(i + 1) + "/5", null);
          if (p == null) {
            throw new DecrypterException(DecrypterException.CAPTCHA);
          }
          ALLFORM.put("button.x", String.valueOf(p.x));
          ALLFORM.put("button.y", String.valueOf(p.y));
        }
        br.submitForm(ALLFORM);
        if (br.getURL().contains("error.php")) {
          br.getPage(partLink);
          continue;
        }
        ALLFORM = br.getFormbyProperty("name", "form");
        ALLFORM = ALLFORM == null && b ? br.getForm(0) : ALLFORM;
        if (ALLFORM != null
            && ALLFORM.getAction().startsWith("http://www.relink.us/container_password.php")) {
          continue;
        }
        ALLFORM = null;
        break;
      }
    }
  }
示例#11
0
 @Override
 public void handlePremium(final DownloadLink downloadLink, final Account account)
     throws Exception {
   String passCode = null;
   requestFileInformation(downloadLink);
   login(account);
   br.setFollowRedirects(false);
   br.getPage(downloadLink.getDownloadURL());
   String dllink = br.getRedirectLocation();
   if (dllink == null) {
     Form DLForm = br.getFormbyProperty("name", "F1");
     if (DLForm == null) {
       throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
     }
     if (br.containsHTML("(<b>Passwort:</b>|<b>Password:</b>)")) {
       logger.info("The downloadlink seems to be password protected.");
       if (downloadLink.getStringProperty("pass", null) == null) {
         passCode = Plugin.getUserInput("Password?", downloadLink);
       } else {
         /* gespeicherten PassCode holen */
         passCode = downloadLink.getStringProperty("pass", null);
       }
       DLForm.put("password", passCode);
       logger.info(
           "Put password \"" + passCode + "\" entered by user in the DLForm and submitted it.");
     }
     br.submitForm(DLForm);
     if (br.containsHTML("(Wrong password|<b>Passwort:</b>|<b>Password:</b>)")) {
       logger.warning(
           "Wrong password, the entered password \"" + passCode + "\" is wrong, retrying...");
       downloadLink.setProperty("pass", null);
       throw new PluginException(LinkStatus.ERROR_RETRY);
     }
     dllink = br.getRedirectLocation();
     if (dllink == null) {
       dllink = getDllink();
     }
   }
   if (dllink == null) {
     handleErrors();
     logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!");
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   logger.info("Final downloadlink = " + dllink + " starting the download...");
   int chunks = -5;
   boolean resume = true;
   if (downloadLink.getBooleanProperty(JumboFilesCom.NOCHUNKS, false) || resume == false) {
     chunks = 1;
   }
   dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, resume, chunks);
   if (passCode != null) {
     downloadLink.setProperty("pass", passCode);
   }
   if (dl.getConnection().getContentType() != null
       && dl.getConnection().getContentType().contains("html")) {
     logger.warning("The final dllink seems not to be a file!");
     br.followConnection();
     throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
   }
   if (!this.dl.startDownload()) {
     try {
       if (dl.externalDownloadStop()) {
         return;
       }
     } catch (final Throwable e) {
     }
     if (downloadLink.getLinkStatus().getErrorMessage() != null
         && downloadLink
             .getLinkStatus()
             .getErrorMessage()
             .startsWith(
                 JDL.L(
                     "download.error.message.rangeheaders",
                     "Server does not support chunkload"))) {
       if (downloadLink.getBooleanProperty(JumboFilesCom.NORESUME, false) == false) {
         downloadLink.setChunksProgress(null);
         downloadLink.setProperty(JumboFilesCom.NORESUME, Boolean.valueOf(true));
         throw new PluginException(LinkStatus.ERROR_RETRY);
       }
     } else {
       /* unknown error, we disable multiple chunks */
       if (downloadLink.getBooleanProperty(JumboFilesCom.NOCHUNKS, false) == false) {
         downloadLink.setProperty(JumboFilesCom.NOCHUNKS, Boolean.valueOf(true));
         throw new PluginException(LinkStatus.ERROR_RETRY);
       }
     }
   }
 }
示例#12
0
  @Override
  public void handleFree(DownloadLink link) throws Exception {
    this.setBrowserExclusive();
    requestFileInformation(link);
    if (br.containsHTML("value=\"Free Users\""))
      br.postPage(link.getDownloadURL(), "Free=Free+Users");
    String passCode = null;
    Form captchaform = br.getFormbyProperty("name", "myform");
    if (captchaform == null) {
      captchaform = br.getFormbyProperty("name", "validateform");
      if (captchaform == null) {
        captchaform = br.getFormbyProperty("name", "valideform");
      }
    }
    if (br.containsHTML("(captcha.php|class=textinput name=downloadpw)")) {
      if (captchaform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
      for (int i = 0; i <= 3; i++) {
        if (br.containsHTML("captcha.php")) {
          String captchaurl = COOKIE_HOST + "/captcha.php";
          String code = getCaptchaCode(captchaurl, link);
          captchaform.put("captchacode", code);
        }
        if (br.containsHTML("class=textinput name=downloadpw")) {
          if (link.getStringProperty("pass", null) == null) {
            passCode = Plugin.getUserInput("Password?", link);

          } else {
            /* gespeicherten PassCode holen */
            passCode = link.getStringProperty("pass", null);
          }
          captchaform.put("downloadpw", passCode);
        }
        br.submitForm(captchaform);
        if (br.containsHTML("Password Error")) {
          logger.warning("Wrong password!");
          link.setProperty("pass", null);
          continue;
        }
        if (br.containsHTML("Captcha number error")
            || br.containsHTML("captcha.php")
                && !br.containsHTML("You have got max allowed bandwidth size per hour")) {
          logger.warning("Wrong captcha or wrong password!");
          link.setProperty("pass", null);
          continue;
        }
        break;
      }
    }
    if (br.containsHTML("Password Error")) {
      logger.warning("Wrong password!");
      link.setProperty("pass", null);
      throw new PluginException(LinkStatus.ERROR_RETRY);
    }
    if (br.containsHTML("Captcha number error")
        || br.containsHTML("captcha.php")
            && !br.containsHTML("You have got max allowed bandwidth size per hour")) {
      logger.warning("Wrong captcha or wrong password!");
      link.setProperty("pass", null);
      throw new PluginException(LinkStatus.ERROR_CAPTCHA);
    }
    if (passCode != null) {
      link.setProperty("pass", passCode);
    }
    if (br.containsHTML("You have got max allowed bandwidth size per hour"))
      throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l);
    String finalLink = findLink();
    if (finalLink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    dl = jd.plugins.BrowserAdapter.openDownload(br, link, finalLink, true, 1);
    if (dl.getConnection().getContentType().contains("html")) {
      br.followConnection();
      throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
    }
    dl.startDownload();
  }