private boolean fixFile(File file) {
    String content = JDIO.readFileToString(file);
    if (content.contains(LICENSE_PREFIX_TRIMMED)) return false;

    StringBuilder sb = new StringBuilder();
    sb.append(LICENSE);
    sb.append(content);

    return JDIO.writeLocalFile(file, sb.toString());
  }
示例#2
0
  // @Override
  public ContainerStatus callDecryption(File lc) {
    ContainerStatus cs = new ContainerStatus(lc);

    // if (!getProperties().getBooleanProperty("USECCFRSDF", false)) {
    Vector<URL> services;
    try {
      services = new Vector<URL>();

      Collections.sort(
          services,
          new Comparator<Object>() {
            public int compare(Object a, Object b) {
              return (int) (Math.random() * 4.0 - 2.0);
            }
          });
      services.add(0, new URL("http://service.jdownloader.net/dlcrypt/getDLC.php"));
      Iterator<URL> it = services.iterator();

      String dlc = null;
      // Ua6LDQoSRm6XrkfussF7t1iM5D+WAT9y5QB0U3gwmkELcT+6+4
      // U0RUeKvv256VUPZdHttMCuf0/C
      // Ua6LDRJGbpeuR+6ywXu3WIzkj5YBP3LlAHRTeDCaQQtxkLr7hTRFR4q+/
      // bnpVQ9l0e20wK5/T8L1

      while (it.hasNext() && dlc == null) {
        URL service = it.next();
        try {
          // RequestInfo ri;
          // requestInfo = Plugin.postRequest(new
          // URL(ri.getLocation()), null, null, null, "src=ccf&data="
          // + data, true);
          Browser br = new Browser();
          br.setDebug(true);
          PostFormDataRequest r = (PostFormDataRequest) br.createPostFormDataRequest(service + "");
          r.addFormData(new FormData("upload", lc.getName(), lc));

          try {
            r.addFormData(
                new FormData(
                    "l",
                    getClass()
                            .forName(getClass().getPackage().getName() + ".Config")
                            .getField("CCF")
                            .get(null)
                        + ""));

          } catch (Throwable e) {

          }
          r.addFormData(new FormData("src", "ccf"));

          br.openRequestConnection(r);

          String ret = br.loadConnection(null) + "";

          if (ret != null && ret.contains("<dlc>")) {
            dlc = new Regex(ret, "<dlc>(.*)</dlc>").getMatch(0);
            if (dlc.length() < 90) {
              dlc = null;
            }
          }

        } catch (Exception e) {
          JDLogger.exception(e);
        }
      }
      if (dlc != null) {
        lc = new File(lc.getAbsolutePath().substring(0, lc.getAbsolutePath().length() - 3) + "dlc");
        JDIO.writeLocalFile(lc, dlc);
        LinkCollector.getInstance()
            .addCrawlerJob(new LinkCollectingJob("file://" + lc.getAbsolutePath()));
        cs.setStatus(ContainerStatus.STATUS_FINISHED);

        return cs;
      }
    } catch (MalformedURLException e) {

    }

    cs.setStatus(ContainerStatus.STATUS_FAILED);

    return cs;
  }