当前位置: 首页 > ops >正文

获取ACCESS2000密码 [C#]

Access 的一些早期版本使用异或方法进行简单加密,当忘记密码时可以用同样的办法进行恢复.

以Access2000版本为例,从42H字节开始的后40字节为unicode存储的密码信息,与字节组

0x0b,0x6d ,0xec ,0x37 ,0xd0 ,0xd2 ,0x9c ,0xfa ,0x4b ,0xc8 ,0x28 ,0xe6 ,0x9e ,0x20 ,0x8a ,

0x60 ,0xd9 ,0x02 ,0x7b ,0x36 ,0x78 ,0xe4 ,0xdf ,0xb1 ,0xfa ,0x62 ,0x13 ,0x43 ,0x42 ,0x39 ,

0xb1 ,0x33 ,0xb9 ,0xf7 ,0x79 ,0x5b ,0x1f ,0x23 ,0x7c ,0x2c

异或后即可还原.上述密钥字节组可通过新建ACCESS文件后查看得知.

Access是以轻量化为目的设计的数据库,在重要应用中应该采用更专业的数据库产品,如Microsoft SQL Server.

以下以C#为例,说明获取Access2000密码的方法. 注意:解密结果应用Unicode解码输出,以保证正常显示.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication1
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.OpenFileDialog openFileDialog1;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.Container components = null;

  public Form1()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }

  #region Windows Form Designer generated code
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.button1 = new System.Windows.Forms.Button();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.button2 = new System.Windows.Forms.Button();
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(24, 80);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(232, 88);
   this.button1.TabIndex = 0;
   this.button1.Text = "解";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(24, 16);
   this.textBox1.Name = "textBox1";
   this.textBox1.ReadOnly = true;
   this.textBox1.Size = new System.Drawing.Size(376, 21);
   this.textBox1.TabIndex = 1;
   this.textBox1.Text = "";
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(408, 16);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(88, 24);
   this.button2.TabIndex = 2;
   this.button2.Text = "浏览";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(24, 48);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(272, 21);
   this.textBox2.TabIndex = 3;
   this.textBox2.Text = "";
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(640, 181);
   this.Controls.AddRange(new System.Windows.Forms.Control[] {
                    this.textBox2,
                    this.button2,
                    this.textBox1,
                    this.button1});
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
   this.Name = "Form1";
   this.Text = "解";
   this.ResumeLayout(false);

  }
  #endregion

  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new Form1());
  }

  private void button2_Click(object sender, System.EventArgs e)
  {
   if(this.openFileDialog1.ShowDialog()==System.Windows.Forms.DialogResult.OK)
   {
    this.textBox1.Text=this.openFileDialog1.FileName;
    this.textBox2.Text ="";
   }
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
  
           
   
   try
   {
    this.textBox2.Text =getPassWord2000(this.textBox1.Text);
   }
   catch(System.Exception ee)
   {
    System.Windows.Forms.MessageBox.Show(ee.Message);
   }


  }

  //
  public static string getPassWord2000(string FilePath)
  {
   byte[] key={0x0b,0x6d ,0xec ,0x37 ,0xd0 ,0xd2 ,0x9c ,0xfa ,0x4b ,0xc8 ,0x28 ,0xe6 ,0x9e ,0x20 ,0x8a ,0x60 ,0xd9 ,0x02 ,0x7b ,0x36 ,0x78 ,0xe4 ,0xdf ,0xb1 ,0xfa ,0x62 ,0x13 ,0x43 ,0x42 ,0x39 ,0xb1 ,0x33 ,0xb9 ,0xf7 ,0x79 ,0x5b ,0x1f ,0x23 ,0x7c ,0x2c};

   string result="";
           
   System.Exception ex;
   try
   {
    if(FilePath.Trim()=="")
    {
     ex=new Exception("未选定文件");
    }
    else if(System.IO.File.Exists(FilePath.Trim()))
    {
     ex=new Exception("文件不存在");
    }
   

    System.IO.BinaryReader br=new System.IO.BinaryReader(new System.IO.FileStream(FilePath.Trim(),System.IO.FileMode.Open));
    byte[] db=new byte[40];
    int ix=0;
    while((ix++)<0x42)
    {
     br.ReadByte();
    }
   
    db=br.ReadBytes(40);
     
    br.Close();

   
    for(int i=0;i<40;i++)
    {
    
     byte b=(byte)(db[i]^key[i]);
     db[i]=b;
                   
    }
   
    System.IO.MemoryStream m=new System.IO.MemoryStream(db,0,40,false,true);
   
   

    System.IO.StreamReader s=new System.IO.StreamReader(m,System.Text.Encoding.Unicode);    
           
   

    result =s.ReadToEnd();

   
    s.Close();
    m.Close();

   }
   catch(System.Exception ee)
   {
    throw ee;
   }

   return result;
  }

 }
}

http://www.xdnf.cn/news/11174.html

相关文章:

  • 图形学中的不变矩方法及其matlab实现
  • 推荐一款基于Java的音视频处理开源项目--JAVE
  • 转贴:网友【原创·教程】 SRT外挂字幕时间轴调整及合并中英文同步字幕制作方法
  • C++ QT结合FFmpeg实战开发视频播放器-08播放器项目的整体UI架构
  • 当你在浏览器输入www.xxx.com的时候会发生什么?
  • linux 防火墙firewall详解
  • MSDE2000安装
  • 信息论:熵与互信息
  • 分享一个简洁、优雅且高效的 Hugo 博客主题 - FixIt
  • CSS基础学习--9 边框(Border)
  • Oracle数据库入门教程(作者原创)
  • Linux内核(十)WIFI BT电路解析 对应设备树配置解析
  • Ubuntu安装eclipse
  • 补丁(patch)的制作与应用
  • 什么是原码、反码和补码
  • reviewboard环境搭建(3):创建站点
  • 姓氏的来历
  • 位图是什么
  • PDF 解锁(unlock)
  • Zblog模板:三栏自适应网赚博客主题模板
  • ActivityThread分析—ActivityThread的main方法的执行流程分析
  • Flask——request的form_data_args用法
  • 汇编语言入门教程
  • HttpWatch使用教程
  • 万用表之电压测量原理(基于ICL7107)
  • 多点定位MLAT系统解决方案
  • static 函数和普通函数
  • 归并排序(Merge Sort)
  • C++ assert.h头文件
  • H264解码之TS流解析