rendered paste body// jDownloader - Downloadmanager
// Copyright (C) 2008 JD-Team jdownloader@freenet.de
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.plugins.decrypt;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Vector;
import java.util.regex.Pattern;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import jd.config.Configuration;
import jd.controlling.JDController;
import jd.crypt.AESdecrypt;
import jd.crypt.Base16Decoder;
import jd.crypt.BaseDecoder.IllegalAlphabetException;
import jd.plugins.DownloadLink;
import jd.plugins.Plugin;
import jd.plugins.PluginForDecrypt;
import jd.plugins.PluginStep;
import jd.utils.JDLocale;
import jd.utils.JDUtilities;
// http://crypt-it.com/s/BXYMBR
// http://crypt-it.com/s/B44Z4A
public class CryptItCom extends PluginForDecrypt {
static private final String HOST = "crypt-it.com";
private String VERSION = "0.3.0";
private String CODER = "jD-Team";
static private final Pattern patternSupported = getSupportPattern("(http|ccf)://[*]crypt-it.com/(s|e|d|c)/[a-zA-Z0-9]+");
private static final String PATTERN_PW = "Passworteingabe";
private static final String PATTERN_FLASH = "<object data=\"../load_";
private String PASSWORD_PROTECTED = "Passworteingabe erforderlich";
public CryptItCom() {
super();
steps.add(new PluginStep(PluginStep.STEP_DECRYPT, null));
currentStep = steps.firstElement();
}
@Override
public String getCoder() {
return CODER;
}
@Override
public String getHost() {
return HOST;
}
@Override
public String getPluginID() {
return HOST + "-" + VERSION;
}
@Override
public String getPluginName() {
return HOST;
}
@Override
public Pattern getSupportedLinks() {
return patternSupported;
}
@Override
public String getVersion() {
return VERSION;
}
@Override
public PluginStep doStep(PluginStep step, String parameter) {
if (step.getStep() == PluginStep.STEP_DECRYPT) {
// surpress jd warning
Vector<DownloadLink> decryptedLinks = new Vector<DownloadLink>();
step.setParameter(decryptedLinks);
parameter = parameter.replace("/s/", "/s/");
parameter = parameter.replace("/e/", "/s/");
parameter = parameter.replace("/c/", "/s/");
parameter = parameter.replace("ccf://", "http://");
try {
requestInfo = getRequest(new URL(parameter), null, null, true);
String cookie = requestInfo.getCookie();
String folderId = parameter.substring(parameter.lastIndexOf("/")+1, parameter.length());
logger.info(folderId);
if (requestInfo.containsHTML(PATTERN_PW)) {
String pass = JDUtilities.getController().getUiInterface().showUserInputDialog(
JDLocale.L("plugins.hoster.general.passwordProtectedInput",
"Die Links sind mit einem Passwort gesch\u00fctzt. Bitte geben Sie das Passwort ein:"));
String postData = "a=pw&pw=" + JDUtilities.urlEncode(pass);
requestInfo = postRequest(new URL(parameter), requestInfo.getCookie(), parameter, null, "a=pw&pw=" + pass, false);
if (requestInfo.containsHTML(PATTERN_PW)) {
logger.warning("Password wrong");
JDUtilities.getController().getUiInterface().showMessageDialog(JDLocale.L("plugins.decrypt.general.passwordWrong", "Passwort falsch"));
step.setStatus(PluginStep.STATUS_ERROR);
return null;
}
}
if ( requestInfo.containsHTML(PATTERN_FLASH) ) {
logger.info("flash");
HashMap<String,String> hm = new HashMap<String,String>();
hm.put("Content-Type","application/x-amf");
Base16Decoder decoder = new Base16Decoder();
byte[] code1 = decoder.decode("0000000000010010637279707469742e67657446696c657300022f310000000e0a00000001020006".toUpperCase().toCharArray());
char[] code2 = new char[code1.length+folderId.length()];
//System.out.println("");
for ( int i=0; i<code1.length; i++ ) {
code2[i] = (char) code1[i];
//System.out.print(code2[i]);
}
for ( int i=code1.length; i<code1.length+folderId.length(); i++ ) {
code2[i] = folderId.charAt(i-code1.length);
//System.out.print(code2[i]);
}
//System.out.println("");
requestInfo = postRequest(new URL("http://crypt-it.com/engine/"), cookie, "", hm, code2, true);
logger.fine(requestInfo.getConnection().getContentLength()+"");
logger.fine(requestInfo.getConnection().getContentType());
InputStream ris = requestInfo.getConnection().getInputStream();
int x;
byte[] y = new byte[requestInfo.getConnection().getContentLength()];
int j = 0;
while ( (x = ris.read()) != -1) {
y[j]=(byte) x;
//System.out.println(y[j]);
j++;
}
while ( x != -1 ) {
// wait until response is read
}
//System.out.println(" ");
char[] keyChar = "77k/lAWHSntRYdontstealpr".toCharArray();
byte[] key = new byte[24];
for ( int i=0; i<keyChar.length; i++ ) {
//System.out.println((byte)keyChar[i]);
key[i] = (byte) keyChar[i];
}
try {
SecretKeySpec finalKey = new SecretKeySpec(key, "AES");
Cipher chiffre = Cipher.getInstance("AES/ECB/NOPADDING");
chiffre.init(Cipher.DECRYPT_MODE, finalKey);
byte[] entschluesselt = chiffre.doFinal(y);
char[] ent2 = new char[entschluesselt.length];
for ( int i=0; i<entschluesselt.length; i++ ) {
System.out.print((char) entschluesselt[i]);
ent2[i] = (char) entschluesselt[i];
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalAlphabetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
@Override
public boolean doBotCheck(File file) {
return false;
}
}