实为 转贴j9988+原创
begin transaction --playyuer 原创
exec sp_decrypt 'appsp_test' --j9988 原创
rollback transaction --playyuer 原创
or:或者直接用 transaction 把 j9988 包起来!
begin transaction
j9988
rollback transaction
/************* 解密存储过程 **********
------------------------sql2000大于40000的-----------------
原作:j9988 号:j老师
*/
alter procedure sp_decrypt (@objectname varchar(50))
as
begin
begin transaction --add by playyuer
declare @objectname1 varchar(100)
declare @sql1 nvarchar(4000),@sql2 nvarchar(4000),@sql3 nvarchar(4000),@sql4 nvarchar(4000),@sql5 nvarchar(4000),@sql6 nvarchar(4000),@sql7 nvarchar(4000),@sql8 nvarchar(4000),@sql9 nvarchar(4000),@sql10 nvarchar(4000)
declare @origsptext1 nvarchar(4000), @origsptext2 nvarchar(4000) , @origsptext3 nvarchar(4000), @resultsp nvarchar(4000)
declare @i int , @t bigint
declare @m int,@n int,@q int
set @m=(select max(colid) from syscomments where id = object_id(@objectname))
set @n=1
--get encrypted data
create table #temp(colid int,ctext varbinary(8000))
insert #temp select colid,ctext from syscomments where id = object_id(@objectname)
set @sql1='alter procedure '+ @objectname +' with encryption as '
--set @sql1='alter procedure '+ @objectname +' with encryption as '
set @q=len(@sql1)
set @[email protected]+replicate('-',[email protected])
select @sql2=replicate('-',4000),@sql3=replicate('-',4000),@sql4=replicate('-',4000),@sql5=replicate('-',4000),@sql6=replicate('-',4000),@sql7=replicate('-',4000),@sql8=replicate('-',4000),@sql9=replicate('-',4000),@sql10=replicate('-',4000)
exec(@[email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected])
while @n<[email protected]
begin
set @origsptext1=(select ctext from #temp where [email protected])
set @[email protected]+'_t'
set @origsptext3=(select ctext from syscomments where id=object_id(@objectname) and [email protected])
if @n=1
begin
set @origsptext2='create procedure '+ @objectname +' with encryption as '--
set @q=4000-len(@origsptext2)
set @[email protected]+replicate('-',@q)
end
else
begin
set @origsptext2=replicate('-', 4000)
end
--start counter
set @i=1
--fill temporary variable
set @resultsp = replicate(n'a', (datalength(@origsptext1) / 2))
--loop
while @i<=datalength(@origsptext1)/2
begin
--reverse encryption (xor original+bogus+bogus encrypted)
set @resultsp = stuff(@resultsp, @i, 1, nchar(unicode(substring(@origsptext1, @i, 1)) ^
(unicode(substring(@origsptext2, @i, 1)) ^
unicode(substring(@origsptext3, @i, 1)))))
set @[email protected]+1
end
--drop original sp
--execute ('drop procedure '+ @objectname)
--remove encryption
--preserve case
set @resultsp=replace((@resultsp),'with encryption', '')
set @resultsp=replace((@resultsp),'with encryption', '')
set @resultsp=replace((@resultsp),'with encryption', '')
if charindex('with encryption',upper(@resultsp) )>0
set @resultsp=replace(upper(@resultsp),'with encryption', '')
--replace stored procedure without enryption
print @resultsp
--execute( @resultsp)
set @[email protected]+1
end
drop table #temp
end
rollback transaction --add by playyuer
go
/*
适合40000字符。
每次4000 print出来,自已贴。
切记:我见过的解过程都是对原过程进行破坏。破解前一定要备份!!!!
超过40000的,自已加sql(我上面用sql.sql2--sql10)
超长的可加sql11--sql20........
*/
,欢迎访问网页设计爱好者web开发。