Office中国论坛/Access中国论坛
标题: 自杀性加密 [打印本页]
作者: sf 时间: 2003-7-2 00:31
标题: 自杀性加密
自杀加密原理:(假设您的主机上有网卡)利用网卡ID的全球唯一性,当你的软件启动时,设函数获得本机网卡ID,当获得的网卡ID为允许数值时,软件正常运行,否则自动删除所有窗体、查询、表,即整个数据库。此方案可限制软件非法拷贝后在别的机器上运行。
方案可行,但还没找到用命令删除整个数据库的有效方法,请各大侠解囊献策。。。。
附:李寻欢大师的获取网卡物理地址的方法。
Private Const NCBASTAT = &H33
Private Const NCBNAMSZ = 16
Private Const HEAP_ZERO_MEMORY = &H8
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
Private Const NCBRESET = &H32
Private Type NCB
ncb_command As Byte
ncb_retcode As Byte
ncb_lsn As Byte
ncb_num As Byte
ncb_buffer As Long
ncb_length As Integer
ncb_callname As String * NCBNAMSZ
ncb_name As String * NCBNAMSZ
ncb_rto As Byte
ncb_sto As Byte
ncb_post As Long
ncb_lana_num As Byte
ncb_cmd_cplt As Byte
ncb_reserve(9) As Byte ' Reserved, must be 0
ncb_event As Long
End Type
Private Type ADAPTER_STATUS
adapter_address(5) As Byte
rev_major As Byte
reserved0 As Byte
adapter_type As Byte
rev_minor As Byte
duration As Integer
frmr_recv As Integer
frmr_xmit As Integer
iframe_recv_err As Integer
xmit_aborts As Integer
xmit_success As Long
recv_success As Long
iframe_xmit_err As Integer
recv_buff_unavail As Integer
t1_timeouts As Integer
ti_timeouts As Integer
Reserved1 As Long
free_ncbs As Integer
max_cfg_ncbs As Integer
max_ncbs As Integer
xmit_buf_unavail As Integer
max_dgram_size As Integer
pending_sess As Integer
max_cfg_sess As Integer
max_sess As Integer
max_sess_pkt_size As Integer
name_count As Integer
End Type
Private Type NAME_BUFFER
name As String * NCBNAMSZ
name_num As Integer
name_flags As Integer
End Type
Private Type ASTAT
adapt As ADAPTER_STATUS
NameBuff(30) As NAME_BUFFER
End Type
Private Declare Function Netbios Lib "netapi32.dll" (pncb As NCB) As Byte
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Private Declare Function GetProcessHeap Lib "kernel32" () As Long
Private Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long
Public Function EthernetAddress(LanaNumber As Long) As String
Dim udtNCB As NCB
Dim bytResponse As Byte
Dim udtASTAT As ASTAT
Dim udtTempASTAT As ASTAT
Dim lngASTAT As Long
Dim strOut As String
Dim x As Integer
udtNCB.ncb_command = NCBRESET
bytResponse = Netbios(udtNCB)
udtNCB.ncb_command = NCBASTAT
udtNCB.ncb_lana_num = LanaNumber
udtNCB.ncb_callname = "* "
udtNCB.ncb_length = Len(udtASTAT)
lngASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, udtNCB.ncb_length)
strOut = ""
If lngASTAT Then
udtNCB.ncb_buffer = lngASTAT
bytResponse = Netbios(udtNCB)
CopyMemory udtASTAT, udtNCB.ncb_buffer, Len(udtASTAT)
With udtASTAT.adapt
For x = 0 To 5
strOut = strOut & Right$("00" & Hex$(.adapter_address(x)), 2)
Next x
End With
HeapFree GetProcessHeap(), 0, lngASTAT
End If
EthernetAddress = strOut
End Function
'用法:
'获取第一块网卡物理地址:EthernetAddress(0)
[此贴子已经被作者于2003-7-1 16:46:31编辑过]
作者: 竹笛 时间: 2003-7-2 01:02
没必要吧。
[此贴子已经被作者于2003-7-1 17:01:54编辑过]
作者: sf 时间: 2003-7-2 01:09
偶然想起此想法,只是想验证其可行性。当然还是共享软件软件越多越好!大家提高的都快!
还请大家多赐教!有没有好的方法!
[此贴子已经被作者于2003-7-1 17:13:00编辑过]
作者: sweetduck 时间: 2003-7-2 04:26
你这样限制盗版也太绝了点吧,还不如让盗版的自动格式化硬盘!
作者: 李寻欢 时间: 2003-7-2 07:56
把一些垃圾写到文件中就可以使程序完全自杀,虽然做不到删除自身,但里面的所有东西都没了,不过如果这样做,试用期过后没人敢买你的软件的,谁知道你还会在里面埋了什么陷阱。
下面程序仅从技术角度去讨论这个问题,道德问题见仁见智吧
Dim strFilePath, strJunk As String
strFilePath = currentproject.FullName
Close #1
Open strFilePath For Binary As #1
strJunk = Space(LOF(1))
Put #1, , strJunk
Close #1
docmd.quit
作者: sf 时间: 2003-7-2 17:50
各位仁兄,我只是想用此方法来杜绝公司内部包含机密文件的程序泄漏,引起文件泄密。是为了加强公司内部文件的安全,不是用于非法目的,任何事物都有它的两面性,就像黑客工具,就看用它的人目的如何了,是维护安全,还是破坏安全。
[此贴子已经被作者于2003-7-2 10:04:20编辑过]
作者: sf 时间: 2003-7-2 18:48
李大侠所说的是个好方法,简单有效,顺便请问,我拆分了数据库(如:s.dbf),如何用你所说的方法,填充垃圾的同时,删除所拆分出的存放数据的数据库(如:s_db.dbf)。或者也向此数据库填充垃圾,总之,让其也无法打开即可。
多谢指点!
[此贴子已经被作者于2003-7-2 11:08:15编辑过]
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) |
Powered by Discuz! X3.3 |