各位高手能帮我看看这段用jad反编译的代码如何还原成正确的代码吗?万分感谢!
public FileID(String contentStr)
{
int firPos;
int endPos;
convertStr = "";
boundary = "file.jsp?ID=";
firPos = 0;
endPos = 0;
_L2:
boolean loopSign;
StringBuffer sb;
firPos = endPos;
loopSign = true;
sb = new StringBuffer();
endPos = contentStr.indexOf(boundary, firPos + 1);
if (endPos < 0)
break MISSING_BLOCK_LABEL_160;
endPos += 18;
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
contentStr.substring(firPos, endPos);
append();
toString();
convertStr;
while (loopSign)
{
char thechar = contentStr.charAt(endPos);
if (ParamUtil.isNumber(thechar))
{
sb.append(thechar);
endPos++;
} else
{
loopSign = false;
}
}
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
EncryptBean.encrypt(sb.toString());
append();
toString();
convertStr;
continue; /* Loop/switch isn't completed */
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
contentStr.substring(firPos);
append();
toString();
convertStr;
if (endPos > = 0) goto _L2; else goto _L1
_L1:
}
public FileID(String contentStr)
{
int firPos;
int endPos;
convertStr = "";
boundary = "file.jsp?ID=";
firPos = 0;
endPos = 0;
_L2:
boolean loopSign;
StringBuffer sb;
firPos = endPos;
loopSign = true;
sb = new StringBuffer();
endPos = contentStr.indexOf(boundary, firPos + 1);
if (endPos < 0)
break MISSING_BLOCK_LABEL_160;
endPos += 18;
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
contentStr.substring(firPos, endPos);
append();
toString();
convertStr;
while (loopSign)
{
char thechar = contentStr.charAt(endPos);
if (ParamUtil.isNumber(thechar))
{
sb.append(thechar);
endPos++;
} else
{
loopSign = false;
}
}
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
EncryptBean.encrypt(sb.toString());
append();
toString();
convertStr;
continue; /* Loop/switch isn't completed */
this;
convertStr;
JVM INSTR new #31 <Class StringBuilder> ;
JVM INSTR dup_x1 ;
JVM INSTR swap ;
String.valueOf();
StringBuilder();
contentStr.substring(firPos);
append();
toString();
convertStr;
if (endPos > = 0) goto _L2; else goto _L1
_L1:
}
public static String encrypt(String str)
{
String retVal = "";
try
{
byte salt[] = new byte[8];
Random random = new Random();
random.nextBytes(salt);
PBEKeySpec keySpec = new PBEKeySpec("6867025".toCharArray());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
javax.crypto.SecretKey key = keyFactory.generateSecret(keySpec);
PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 1000);
Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
cipher.init(1, key, paramSpec);
byte plaintext[] = str.getBytes("UTF8");
byte ciphertext[] = cipher.doFinal(plaintext);
BASE64Encoder encoder = new BASE64Encoder();
String saltStr = encoder.encode(salt);
String cipherStr = encoder.encode(ciphertext);
retVal = (new StringBuilder(String.valueOf(saltStr))).append(cipherStr).toString();
}
catch (Exception e)
{
System.out.println((new StringBuilder("Error in EncryBean_encrypt:")).append(e.getMessage()).toString());
}
return retVal;
}
endPos += 18;
应为:
endPos += 12;
不好意思:)
import util.EncryptBean;
import util.ParamUtil;public class FileID
{ private String convertStr;
private String boundary; public FileID(String contentStr)
{
/*加置顶的代码*/
} public String getEncryptStr()
{
return convertStr;
}
}
说实在的,力不从心。有点怀疑你反编译的有问题。
public FileID(String contentStr) {
convertStr = "";
boundary = "file.jsp?ID=";
int firPos = 0;
int endPos = 0;
while (endPos >= 0) {
boolean loopSign;
StringBuffer sb;
firPos = endPos;
loopSign = true;
sb = new StringBuffer();
endPos = contentStr.indexOf(boundary, firPos + 1);
if (endPos > 0) {
endPos += 18;
sb.append(contentStr.substring(firPos, endPos));
while (loopSign) {
char thechar = contentStr.charAt(endPos);
if (ParamUtil.isNumber(thechar)) {
sb.append(thechar);
endPos++;
} else {
loopSign = false;
}
}
convertStr = EncryptBean.encrypt(sb.toString());
}
}
}
只是从没反出来这么乱的代码。
最多的是异常处理和内部类的问题。
如果在命令提示符下输入jad FileID.class就会报下面的错误:
Parsing FileID.class...The class file version is 49.0 (only 45.3, 4
6.0 and 47.0 are supported)
Generating FileID.jad
Couldn't fully decompile method <init>
jad用了1.5.7g和1.5.8e2版本,都报这个错误。是不是这个原因导致?
Parsing FileID.class... Generating FileID.jad
Couldn't fully decompile method <init>
看来是因为混淆的原因