网上有好多破解access密码的小程序,97版本的比较简单,我用java实现了一下,由于java水平很有限,可能有的地方实现的不是最好方法,请大家指出,非常感谢。代码如下
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class AccessPwd {
public static int hex[]={0x86,0xfb,0xec,0x37,0x5d,0x44,0x9c,0xfa,0xc6,0x5e,0x28,0xe6,0x13};
public static int hex2[]={
0x29,0x77,0xEC,0x37,0xF2,0xC8,0x9C,0xFA,0x69,0xD2,
0x28,0xE6,0xBC,0x3A,0x8A,0x60,0xFB,0x18,0x7B,0x36,
0x5A,0xFE,0xDF,0xB1,0xD8,0x78,0x13,0x43,0x60,0x23,
0xB1,0x33,0x9B,0xED,0x79,0x5B,0x3D,0x39,0x7C,0x2A};
private File file;
public AccessPwd(String fileurl)
{
file=new File(fileurl);
}
public String getPwd()
{
int[] b2=new int[13];
try {
FileInputStream ins=new FileInputStream(file);
byte[] b=new byte[100];
ins.read(b);
int j=66;
for(int i=0;i<13;i++)
{
int temp=b[j];
if(temp<0)
temp=256+temp;
b2[i]=temp;
j++;
}
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer sb=new StringBuffer();
for(int i=0;i<13;i++)
{
if((b2[i]^hex[i])!=0)
sb.append((char)(b2[i]^hex[i]));
}
return sb.toString();
}
public String getPwd2()
{
int[] b2=new int[40];
try {
FileInputStream ins=new FileInputStream(file);
byte[] b=new byte[150];
ins.read(b);
int j=66;
for(int i=0;i<40;i++)
{
int temp=b[j];
if(temp<0)
temp=256+temp;
b2[i]=temp;
j++;
}
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer sb=new StringBuffer();
for(int i=0;i<40;i++)
{
if((b2[i]^hex2[i])!=0)
sb.append((char)(b2[i]^hex2[i]));
}
return sb.toString();
}
public static void main(String agrs[])
{
String flag=agrs[0];
String fileurl=agrs[1];
AccessPwd ap=new AccessPwd(fileurl);
if(flag.equals("97"))
System.out.println("密码为:"+ap.getPwd());
else if(flag.equals("2000"))
System.out.println("密码为:"+ap.getPwd2());
else
System.out.println("请指定版本号");
}
}