• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

在不破坏原加密存储过程的前提下,解密存_sqlserver

sqlserver 搞代码 3年前 (2018-06-16) 139次浏览 已收录 0个评论

实为 转贴j9988+原创

begin transaction  –playyuer 原创
exec sp_decrypt ‘AppSP_test’ –j9988 原创
rollback transaction –playyuer 原创

http://www.gaodaima.com/35809.html在不破坏原加密存储过程的前提下,解密存_sqlserver

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……..
*/

 

欢迎大家阅读《在不破坏原加密存储过程的前提下,解密存_sqlserver,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址