防止Access 2000密码被破译的方法
时间:2007-12-23 来源:不详 作者:迈克DB
Private Const FILE_SHARE_WRITE = &H2
Private Declare Function SetFileTimeWrite Lib "kernel32" Alias _
"SetFileTime" (ByVal hFile As Long, lpCreateTime As FILETIME, _
ByVal NullP As Long, ByVal NullP2 As Long) As Long
Private Declare Function SystemTimeToFileTime Lib "kernel32" _
(lpSystemTime As SYSTEMTIME, lpFileTime As FILETIME) As Long
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" _
(ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal _
dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal _
dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _
ByVal hTemplateFile As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) _
As Long
Private Declare Function LocalFileTimeToFileTime Lib "kernel32" _
(lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long
Private Sub Command1_Click()
Dim Year As Integer, Month As Integer, Day As Integer 本文来自织梦
Dim Hour As Integer, Minute As Integer, Second As Integer
Dim TimeStamp As Variant, Filename As String, X As Integer
Year = 2001: Month = 3: Day = 13 ' 预备设定的“创建日期”
Hour = 12: Minute = 0: Second = 26
TimeStamp = DateSerial(Year, Month, Day) TimeSerial(Hour, Minute, Second)
Filename = "D:\VB6_Test\MDB_Password\Pass_Protected_DB.mdb" ' 目标文件名
X = ModifyFileStamp(Filename, TimeStamp)
End Sub
Function ModifyFileStamp(Filename As String, TimeStamp As Variant) As Integer
Dim X As Long, Handle As Long, System_Time As SYSTEMTIME
Dim File_Time As FILETIME, Local_Time As FILETIME
System_Time.wYear = Year(TimeStamp): System_Time.wMonth = Month(TimeStamp)
System_Time.wDay = Day(TimeStamp)
System_Time.wDayOfWeek = Weekday(TimeStamp) - 1
System_Time.wHour = Hour(TimeStamp): System_Time.wSecond = Second(TimeStamp)
System_Time.wMilliseconds = 0
X = SystemTimeToFileTime(System_Time, Local_Time)
X = LocalFileTimeToFileTime(Local_Time, File_Time) ' 转换成可用的类型
copyright dedecms
Handle = CreateFile(Filename, GENERIC_WRITE, FILE_SHARE_READ Or _
FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0) ' 打开文件
X = SetFileTimeWrite(Handle, File_Time, ByVal 0&, ByVal 0&) ' 设置日期
CloseHandle Handle ' 关闭文件
End Function
图三显示的是的真实“创建日期”以及经程序二伪装的操作系统级的“假象”日期。
可以看出,隐藏“创建日期”的方法对破译者来说只是增大了破译的工作量,增加了破解试验的次数。只有将该方法与下述的“方法二”相结合,才能达到“既治标又治本”的效果。不过在一般的情况下“方法一”已够用,因为假如破译者起始使用的测试日期与最终的真实日期相差百年,他需要付出数万次的努力!
2、使用用户级安全机制
通过设置不同的用户帐号和组帐号对中的各种资源进行权限治理。这种加强了的安全机制虽然给日常使用(尤其是单用户使用)带来了不便,但在有安全隐患的地方依然有设置的必要。
设置各种帐号及相应权限的简单方法是使用“设置安全机制向导”(见图四)。图四还显示了安全机制启动后要求用户登录的画面。
上一篇:怎样可以从ACCESS中打印一个WORD文档 下一篇:Access安全性之QA详解
文章评论
共有位Admini5网友发表了评论 查看完整内容