コード例 #1
0
  private void initialize() throws Exception {

    NULogger.getLogger().info("After login, geting the link again :)");
    httpGet = new NUHttpGet("http://www.slingfile.com/");
    httpResponse = httpclient.execute(httpGet, httpContext);
    stringResponse = EntityUtils.toString(httpResponse.getEntity());
    // FileUtils.saveInFile("SlingFile.com.html", stringResponse);

    // See here: http://www.slingfile.com/media/plupload.beauty.js
    // http://www.plupload.com/punbb/viewtopic.php?pid=5686
    jSonObject =
        new JSONObject(
            StringUtils.stringBetweenTwoStrings(stringResponse, "var uploaderSettings = ", ";"));

    uploadURL = jSonObject.getString("uploadURL");
    ssd = jSonObject.getString("ssd");

    if (jSonObject.has("encUserID")) {
      encUserID = jSonObject.getString("encUserID");
    }

    progressID = guid();
    postURL = uploadURL + progressID;
    rauLink =
        StringUtils.stringBetweenTwoStrings(stringResponse, "document.location.href = '", "'");
    NULogger.getLogger().log(Level.INFO, "progressID: " + progressID);

    URILink = URIUtils.createURI(rauLink);
  }
コード例 #2
0
  public void fileUpload() throws Exception {
    uploading();

    httpPost = new NUHttpPost(postURL);
    MultipartEntity mpEntity = new MultipartEntity();
    ContentBody cbFile = createMonitoredFileBody();

    mpEntity.addPart("MAX_FILE_SIZE", new StringBody(MAX_FILE_SIZE));
    mpEntity.addPart("UPLOAD_IDENTIFIER", new StringBody(UPLOAD_IDENTIFIER));
    mpEntity.addPart("go", new StringBody(go));
    mpEntity.addPart("files", cbFile);
    mpEntity.addPart("agree", new StringBody("1"));
    mpEntity.addPart("submit", new StringBody("Upload Now"));
    httpPost.setEntity(mpEntity);
    NULogger.getLogger()
        .info("Now uploading your file into depositfiles...........................");
    HttpResponse response = httpclient.execute(httpPost, httpContext);
    HttpEntity resEntity = response.getEntity();

    NULogger.getLogger().info(response.getStatusLine().toString());
    if (resEntity != null) {
      gettingLink();
      uploadresponse = EntityUtils.toString(resEntity);
      downloadlink =
          StringUtils.stringBetweenTwoStrings(uploadresponse, "ud_download_url = '", "'");
      deletelink = StringUtils.stringBetweenTwoStrings(uploadresponse, "ud_delete_url = '", "'");
      NULogger.getLogger().log(Level.INFO, "download link : {0}", downloadlink);
      NULogger.getLogger().log(Level.INFO, "delete link : {0}", deletelink);
      downURL = downloadlink;
      delURL = deletelink;
    } else {
      throw new Exception("Error in depositfiles!");
    }
  }
コード例 #3
0
  /**
   * Find the C Challenge URL from the given K Challenge URL.
   *
   * @param kCaptchaUrl The K Challenge URL as a String.
   * @return The C Challenge URL as a String..
   * @throws IOException
   */
  @Override
  public String findCCaptchaUrlFromK(String kCaptchaUrl) throws IOException, Exception {
    cCaptchaUrl = null;

    if (kCaptchaUrl == null) {
      return null;
    }

    String body = NUHttpClientUtils.getData(kCaptchaUrl, httpContext);

    // CommonUploaderTasks.saveInFile("Recaptcha.html", body);

    regex = Pattern.compile(googleRegC);
    regexMatcher = regex.matcher(body);

    if (regexMatcher.find()) {
      NULogger.getLogger().info("Google C recaptcha found!");
      cCaptchaUrl = body.substring(regexMatcher.start(), regexMatcher.end());
      cCaptchaUrl = StringUtils.stringBetweenTwoStrings(cCaptchaUrl, "'", "'");
      NULogger.getLogger().log(Level.INFO, "cCaptchaUrl: {0}", cCaptchaUrl);
      return cCaptchaUrl;
    }

    NULogger.getLogger().log(Level.INFO, "kCaptchaUrl: {0}", kCaptchaUrl);

    return cCaptchaUrl;
  }
コード例 #4
0
  private void initialize() throws Exception {
    responseString = NUHttpClientUtils.getData("http://streamin.to?op=upload", httpContext);

    doc = Jsoup.parse(responseString);
    uploadURL = doc.select("form[name=file").first().attr("action");
    sv_id = doc.select("input[name=srv_id").first().attr("value");
    disk_id = doc.select("input[name=disk_id").first().attr("value");
    String uploadId = StringUtils.uuid(12, 10);
    uploadURL += uploadId + "&utype=" + userType + "&disk_id=" + disk_id;
  }
コード例 #5
0
  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to TopUpload1.com");
      httpPost = new NUHttpPost("http://topupload1.com/ajax/_account_login.ajax.php");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("username", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());
      responseString = EntityUtils.toString(httpResponse.getEntity());

      if (StringUtils.stringBetweenTwoStrings(responseString, "\"login_status\":\"", "\"")
          .equals("success")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("TopUpload1.com login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("TopUploadOneAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select(".err").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + error);
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }
コード例 #6
0
  private String captchaSolver() {
    NULogger.getLogger().info("** Ex-Load.com ** => Solving the captcha ...");
    int i = 0;
    String pd_lft = "", capt_digit = "", captcha_code = "";
    for (i = 0; i < 4; i++) {
      pd_lft =
          doc.select("input[name=code]")
              .first()
              .parent()
              .previousElementSibling()
              .select("div")
              .select("span")
              .eq(i)
              .toString();
      pd_lft = StringUtils.stringBetweenTwoStrings(pd_lft, "padding-left:", "px;");

      capt_digit =
          doc.select("input[name=code]")
              .first()
              .parent()
              .previousElementSibling()
              .select("div")
              .select("span")
              .eq(i)
              .text();
      assoc.put(Integer.parseInt(pd_lft), Integer.parseInt(capt_digit));
    }
    NULogger.getLogger().info("** Ex-Load.com ** => Appeared sequence " + assoc.toString());
    Map<Integer, Integer> treeMap = new TreeMap<Integer, Integer>(assoc);
    NULogger.getLogger().info("** Ex-Load.com ** => REAL sequence " + treeMap.toString());

    // iterating over values only
    for (Integer value : treeMap.values()) {
      captcha_code += value.toString();
    }
    return captcha_code;
  }
コード例 #7
0
  @Override
  public void run() {
    try {
      if (privateFilesAccount.loginsuccessful) {
        userType = "reg";
        httpContext = privateFilesAccount.getHttpContext();
        sessionID = CookieUtils.getCookieValue(httpContext, "xfss");
        maxFileSizeLimit = 2147483648L; // 2 GB
      } else {
        host = "PrivateFiles.com";
        uploadInvalid();
        return;
      }

      if (file.length() > maxFileSizeLimit) {
        throw new NUMaxFileSizeException(maxFileSizeLimit, file.getName(), host);
      }
      uploadInitialising();
      initialize();

      long uploadID;
      Random random = new Random();
      uploadID = Math.round(random.nextFloat() * Math.pow(10, 12));
      uploadid_s = String.valueOf(uploadID);

      sess_id =
          StringUtils.stringBetweenTwoStrings(responseString, "name=\"sess_id\" value=\"", "\"");

      srv_tmp_url = uploadURL;

      uploadURL =
          StringUtils.removeLastChars(uploadURL, 3)
              + "cgi-bin/upload.cgi?upload_id="
              + uploadid_s
              + "&js_on=1&utype="
              + userType
              + "&upload_type=file";
      httpPost = new NUHttpPost(uploadURL);
      MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
      mpEntity.addPart("js_on", new StringBody("1"));
      mpEntity.addPart("upload_id", new StringBody(uploadid_s));
      mpEntity.addPart("upload_type", new StringBody("file"));
      mpEntity.addPart("utype", new StringBody(userType));
      mpEntity.addPart("sess_id", new StringBody(sess_id));
      mpEntity.addPart("srv_tmp_url", new StringBody(srv_tmp_url));
      mpEntity.addPart("file_0", createMonitoredFileBody());
      mpEntity.addPart("file_0_descr", new StringBody(""));
      mpEntity.addPart("link_rcpt", new StringBody(""));
      mpEntity.addPart("link_pass", new StringBody(""));
      mpEntity.addPart("to_folder", new StringBody(""));
      mpEntity.addPart("file_1", new StringBody(""));
      mpEntity.addPart("file_0_descr", new StringBody(""));
      httpPost.setEntity(mpEntity);

      NULogger.getLogger().log(Level.INFO, "executing request {0}", httpPost.getRequestLine());
      NULogger.getLogger().info("Now uploading your file into PrivateFiles.com");
      uploading();
      httpResponse = httpclient.execute(httpPost, httpContext);
      responseString = EntityUtils.toString(httpResponse.getEntity());
      doc = Jsoup.parse(responseString);

      // Read the links
      gettingLink();
      upload_fn = doc.select("textarea[name=fn]").val();

      if (upload_fn != null) {
        httpPost = new NUHttpPost("https://www.privatefiles.com/");
        List<NameValuePair> formparams = new ArrayList<NameValuePair>();
        formparams.add(new BasicNameValuePair("fn", upload_fn));
        formparams.add(new BasicNameValuePair("op", "upload_result"));
        formparams.add(new BasicNameValuePair("st", "OK"));

        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
        httpPost.setEntity(entity);
        httpResponse = httpclient.execute(httpPost, httpContext);
        responseString = EntityUtils.toString(httpResponse.getEntity());

        doc = Jsoup.parse(responseString);
        downloadlink = doc.select("textarea").first().val();
        deletelink = doc.select("textarea").eq(3).val();

        NULogger.getLogger().log(Level.INFO, "Delete link : {0}", deletelink);
        NULogger.getLogger().log(Level.INFO, "Download link : {0}", downloadlink);
        downURL = downloadlink;
        delURL = deletelink;

        uploadFinished();
      }
    } catch (NUException ex) {
      ex.printError();
      uploadInvalid();
    } catch (Exception e) {
      Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, e);

      uploadFailed();
    }
  }
コード例 #8
0
 private void initialize() throws Exception {
   responseString = NUHttpClientUtils.getData("http://privatefiles.com", httpContext);
   doc = Jsoup.parse(responseString);
   uploadURL =
       StringUtils.stringBetweenTwoStrings(responseString, "name=\"srv_tmp_url\" value=\"", "\"");
 }