private boolean getUserLogin() throws IOException, DecrypterException { br.setFollowRedirects(true); String username = null; String password = null; synchronized (LOCK) { username = this.getPluginConfig().getStringProperty("user", null); password = this.getPluginConfig().getStringProperty("pass", null); if (username != null && password != null) { br.postPage( POSTPAGE, "user="******"&passwrd=" + Encoding.urlEncode(password) + "&cookielength=2&hash_passwrd="); } for (int i = 0; i < 3; i++) { boolean valid = false; final Cookies allCookies = this.br.getCookies(MAINPAGE); for (final Cookie c : allCookies.getCookies()) { if (c.getKey().contains("SMFCookie")) { valid = true; break; } } if (!valid) { this.getPluginConfig().setProperty("user", Property.NULL); this.getPluginConfig().setProperty("pass", Property.NULL); username = UserIO.getInstance().requestInputDialog("Enter Loginname for " + DOMAIN + " :"); if (username == null) return false; password = UserIO.getInstance().requestInputDialog("Enter password for " + DOMAIN + " :"); if (password == null) return false; br.postPage( POSTPAGE, "user="******"&passwrd=" + Encoding.urlEncode(password) + "&cookielength=2&hash_passwrd="); } else { this.getPluginConfig().setProperty("user", username); this.getPluginConfig().setProperty("pass", password); this.getPluginConfig().save(); return true; } } } throw new DecrypterException("Login or/and password wrong"); }
@Override public void onAction(ActionEvent e) { if (!UserIO.isOK( UserIO.getInstance() .requestConfirmDialog( UserIO.DONT_SHOW_AGAIN | UserIO.DONT_SHOW_AGAIN_IGNORES_CANCEL, JDL.L( "jd.gui.swing.jdgui.menu.actions.RemoveDisabledAction.message", "Do you really want to remove all disabled DownloadLinks?")))) return; if (!LinkGrabberPanel.getLinkGrabber().isNotVisible()) { synchronized (LinkGrabberController.ControllerLock) { synchronized (LinkGrabberController.getInstance().getPackages()) { ArrayList<LinkGrabberFilePackage> selected_packages = new ArrayList<LinkGrabberFilePackage>( LinkGrabberController.getInstance().getPackages()); selected_packages.add(LinkGrabberController.getInstance().getFilterPackage()); for (LinkGrabberFilePackage fp2 : selected_packages) { ArrayList<DownloadLink> links = new ArrayList<DownloadLink>(fp2.getDownloadLinks()); for (DownloadLink dl : links) { if (!dl.isEnabled()) fp2.remove(dl); } } } } } else { DownloadController dlc = DownloadController.getInstance(); ArrayList<DownloadLink> downloadstodelete = new ArrayList<DownloadLink>(); synchronized (dlc.getPackages()) { for (FilePackage fp : dlc.getPackages()) { synchronized (fp.getDownloadLinkList()) { for (DownloadLink dl : fp.getDownloadLinkList()) { if (!dl.isEnabled()) downloadstodelete.add(dl); } } } } for (DownloadLink dl : downloadstodelete) { dl.getFilePackage().remove(dl); } } }
/** * Ermittelt den Dateityp der Captchas im Captchaordner ist der Ordner leer wird jpg ausgegeben * bzw Bilder geladen wenn showLoadDialog true ist * * @param showLoadDialog * @return captchatyp jpg | png | gif */ public String getCaptchaType(final boolean showLoadDialog) { final File folder2 = this.getCaptchaFolder(); if (showLoadDialog) { if (!folder2.exists() || folder2.list().length < 1) { final int res = UserIO.getInstance() .requestConfirmDialog( 0, JDL.L("easycaptcha.loadcaptchas.title", "Load Captchas"), JDL.L("easycaptcha.needCaptchas", "You need Captchas first!"), null, JDL.L("easycaptcha.openCaptchaFolder", "Open Captcha Folder"), JDL.L("easycaptcha.loadcaptchas", "Load Captchas")); if (JDFlags.hasSomeFlags(res, UserIO.RETURN_OK)) { folder2.mkdir(); this.openCaptchaFolder(); return "jpg"; } else { return new GuiRunnable<String>() { public String runSave() { if (!new LoadCaptchas(EasyCaptchaTool.ownerFrame, EasyMethodFile.this.file.getName()) .start()) { EasyMethodFile.this.openCaptchaFolder(); return "jpg"; } String filetype = "jpg"; final File[] fl = folder2.listFiles(); if (fl[fl.length - 1].getName().toLowerCase().contains("png")) { filetype = "png"; } else if (fl[fl.length - 1].getName().toLowerCase().contains("gif")) { filetype = "gif"; } return filetype; } }.getReturnValue(); } } } String filetype = "jpg"; final File[] fl = folder2.listFiles(); if (fl != null && fl.length > 0) { if (fl[fl.length - 1].getName().toLowerCase().contains("png")) { filetype = "png"; } else if (fl[fl.length - 1].getName().toLowerCase().contains("gif")) { filetype = "gif"; } } return filetype; }
@SuppressWarnings("deprecation") private void getPolicyFiles() throws Exception { int ret = -100; UserIO.setCountdownTime(120); ret = UserIO.getInstance() .requestConfirmDialog( UserIO.STYLE_LARGE, "Java Cryptography Extension (JCE) Error: 32 Byte keylength is not supported!", "At the moment your Java version only supports a maximum keylength of 16 Bytes but the keezmovies plugin needs support for 32 byte keys.\r\nFor such a case Java offers so called \"Policy Files\" which increase the keylength to 32 bytes. You have to copy them to your Java-Home-Directory to do this!\r\nExample path: \"jre6\\lib\\security\\\". The path is different for older Java versions so you might have to adapt it.\r\n\r\nMake sure to download the files that match your current Java version!\r\n\r\nBy clicking on CONFIRM a browser instance will open which leads to the downloadpage of the file.\r\n\r\nThanks for your understanding.", null, "CONFIRM", "Cancel"); if (ret != -100) { if (UserIO.isOK(ret)) { LocalBrowser.openDefaultURL( new URL( "http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html")); LocalBrowser.openDefaultURL(new URL("http://h10.abload.de/img/jcedp50.png")); } else { return; } } }
@Override public void onAction(ActionEvent e) { StringBuilder def = new StringBuilder(); try { String newText = ClipboardHandler.getClipboard().getCurrentClipboardLinks(); String[] links = HTMLParser.getHttpLinks(newText, null); ArrayList<String> pws = HTMLParser.findPasswords(newText); for (String l : links) def.append(l).append("\r\n"); for (String pw : pws) { def.append("password: "******"\r\n"); } } catch (Exception e2) { } String link = UserIO.getInstance().requestInputDialog(UserIO.NO_COUNTDOWN | UserIO.STYLE_LARGE, _GUI._.gui_dialog_addurl_title(), _GUI._.gui_dialog_addurl_message(), def.toString(), NewTheme.I().getIcon("linkgrabber", 32), _GUI._.gui_dialog_addurl_okoption_parse(), null); if (link == null || link.length() == 0) return; if (CNL2.checkText(link)) return; DistributeData tmp = new DistributeData(link, false); tmp.setDisableDeepEmergencyScan(false); tmp.start(); }
// never got one, but left this for future usage public void checkServerErrors() throws NumberFormatException, PluginException { if (new Regex(brbefore, Pattern.compile("No file", Pattern.CASE_INSENSITIVE)).matches()) { throw new PluginException(LinkStatus.ERROR_FATAL, getPhrase("SERVER_ERROR")); } if (new Regex(brbefore, "(Not Found|<h1>(404 )?Not Found</h1>)").matches()) { logger.warning("Server says link offline, please recheck that!"); throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); } if (br.containsHTML("Twój dzienny limit transferu")) { UserIO.getInstance() .requestMessageDialog( 0, getPhrase("PREMIUM_ERROR"), getPhrase("DAILY_LIMIT") + "\r\n" + getPhrase("PREMIUM_DISABLED")); throw new PluginException( LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE); } else if (br.containsHTML( "<input type=\"submit\" class=\"btn btn-large btn-inverse\" style=\"font-size:30px; font-weight: bold; padding:30px\" value=\"Pobierz szybko\" />")) { throw new PluginException(LinkStatus.ERROR_FATAL, getPhrase("LINK_BROKEN")); } }
@SuppressWarnings("deprecation") public void handlePremiumWebsite(final DownloadLink downloadLink, final Account account) throws Exception, PluginException { loginWebsite(account, true); getPage(downloadLink.getDownloadURL()); if (account.getType() == AccountType.FREE) { doFreeWebsite(downloadLink, true, 1); return; } getPage(downloadLink.getDownloadURL()); doSomething(); String dllink = getDllinkWebsite(); if (dllink == null) { if (br.containsHTML("Twój dzienny limit transferu")) { UserIO.getInstance() .requestMessageDialog( 0, getPhrase("PREMIUM_ERROR"), getPhrase("DAILY_LIMIT") + "\r\n" + getPhrase("PREMIUM_DISABLED")); throw new PluginException( LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE); } else if (br.containsHTML("Plik chwilowo niedostępny z powodu awarii")) { throw new PluginException( LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, getPhrase("LINK_BROKEN"), 60 * 60 * 1000l); } else if (br.containsHTML( "<h2>System wykrył naruszenie regulaminu w zakresie dostępu do konta.</h2>")) { UserIO.getInstance() .requestMessageDialog( 0, getPhrase("PREMIUM_ERROR"), getPhrase("ACCOUNT_SHARED") + "\r\n" + getPhrase("PREMIUM_DISABLED")); String[][] blockDateTime = new Regex( br, "konto zostało tymczasowo zablokowane i zostanie odblokowane (\\d{2}-\\d{2}-\\d{4}) o godzinie (\\d{2}:\\d{2})</h3>") .getMatches(); if (blockDateTime.length == 0) { throw new PluginException( LinkStatus.ERROR_PREMIUM, getPhrase("ACCOUNT_SHARED"), 2 * 60 * 60 * 1000l); } else { final DateFormat df = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.ENGLISH); final Date waitUntil = df.parse(blockDateTime[0][0] + " " + blockDateTime[0][1] + ":00"); final long difference = waitUntil.getTime() - (new Date()).getTime(); throw new PluginException( LinkStatus.ERROR_PREMIUM, getPhrase("ACCOUNT_SHARED"), difference); } } else { logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!"); throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, getPhrase("REGEX_ERROR")); } } logger.info("Final downloadlink = " + dllink + " starting the download..."); dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, true, -4); if (dl.getConnection().getContentType().contains("html")) { logger.warning("The final dllink seems not to be a file!"); br.followConnection(); doSomething(); checkServerErrors(); throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, getPhrase("FINAL_LINK_ERROR")); } dl.startDownload(); }
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; } } }
@SuppressWarnings("deprecation") @Override public void handlePremium(final DownloadLink downloadLink, final Account account) throws Exception { String dllink = null; requestFileInformation(downloadLink); if (br.getHttpConnection().getResponseCode() == 502) { throw new PluginException( LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "We are sorry, but HellShare is unavailable in your country", 4 * 60 * 60 * 1000l); } login(account, false); dllink = checkDirectLink(downloadLink, "account_premium_directlink"); if (dllink == null) { changeToEnglish(); if (account.getBooleanProperty("free", false)) { logger.info("Handling free account download"); doFree(downloadLink); return; } br.getPage(downloadLink.getDownloadURL()); br.setFollowRedirects(false); final String filedownloadbutton = br.getURL() + "?do=fileDownloadButton-showDownloadWindow"; URLConnectionAdapter con = openConnection(this.br, filedownloadbutton); if (con.getContentType().contains("html")) { br.followConnection(); dllink = br.getRedirectLocation(); if (dllink == null) { dllink = getJson("redirect"); } if (dllink == null) { if (br.containsHTML("button\\-download\\-full\\-nocredit")) { logger.info("not enough credits to download"); throw new PluginException( LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE); } if (br.containsHTML("Daily limit exceeded")) { logger.info("hellshare: Daily limit exceeded!"); UserIO.getInstance() .requestMessageDialog( 0, "Hellshare.com Premium Error", "Daily limit exceeded!\r\nPremium disabled, will continue downloads as Free User"); throw new PluginException( LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE); // throw new PluginException(LinkStatus.ERROR_PREMIUM, "Daily limit exceeded!"); } // Hellshare Premium sharing not allowed! if (br.containsHTML( "HellShare not allowed to share the login information to the accounts\\.")) { UserIO.getInstance() .requestMessageDialog( 0, "Hellshare.com Premium Error", "HellShare not allowed to share the login information to the accounts!"); throw new PluginException( LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_TEMP_DISABLE); } if (this.br.toString().length() < 30) { /* E.g. empty page */ throw new PluginException( LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Unknown server error"); } logger.warning("dllink (premium) is null..."); throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); } } else { dllink = filedownloadbutton; } try { con.disconnect(); } catch (final Throwable e) { } dllink = dllink.replaceAll("\\\\", ""); } dl = jd.plugins.BrowserAdapter.openDownload( br, downloadLink, dllink, ACCOUNT_PREMIUM_RESUME, ACCOUNT_PREMIUM_MAXCHUNKS); if (dl.getConnection().getResponseCode() == 503) { throw new PluginException( LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "Connection limit reached, please contact our support!", 5 * 60 * 1000l); } if (dl.getConnection().getContentType().contains("html")) { if (dl.getConnection().getResponseCode() == 403) { throw new PluginException( LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l); } else if (dl.getConnection().getResponseCode() == 404) { throw new PluginException( LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l); } logger.warning("The final dllink seems not to be a file!"); br.followConnection(); throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT); } downloadLink.setProperty("account_premium_directlink", dllink); dl.startDownload(); }