Sql存储过程解密方法

在网上查到这样一个存储过程解密的方法,用起来简单,收藏到这里:

Sql存储过程解密方法
 1 CREATE     PROCEDURE   sp_decrypt_sp   (@objectName   varchar(50))  
 2   AS  
 3   ------------------------sql2000大于40000的-----------------  
 4   --原作:j9988   号:J老师  
 5    
 6   begin   tran  
 7   begin  
 8   declare   @objectname1   varchar(100)  
 9   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)      
10   DECLARE     @OrigSpText1   nvarchar(4000),     @OrigSpText2   nvarchar(4000)   ,   @OrigSpText3   nvarchar(4000),   @resultsp   nvarchar(4000)  
11   declare     @i   int   ,   @t   bigint  
12   declare   @m   int,@n   int,@q   int  
13   set   @m=(SELECT   max(colid)   FROM   syscomments     WHERE   id   =   object_id(@objectName))  
14   set   @n=1  
15   --get   encrypted   data  
16   create   table     #temp(colid   int,ctext   varbinary(8000))  
17   insert   #temp   SELECT   colid,ctext   FROM   syscomments     WHERE   id   =   object_id(@objectName)  
18   set   @sql1=ALTER   PROCEDURE   +   @objectName   +   WITH   ENCRYPTION   AS     
19   --set   @sql1=‘ALTER   PROCEDURE   ‘+   @objectName   +‘   WITH   ENCRYPTION   AS   ‘  
20   set   @q=len(@sql1)  
21   set   @sql1=@sql1+REPLICATE(-,4000-@q)  
22   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)  
23   exec(@sql1+@sql2+@sql3+@sql4+@sql5+@sql6+@sql7+@sql8+@sql9+@sql10)  
24   while   @n<=@m  
25   begin  
26   SET   @OrigSpText1=(SELECT   ctext   FROM   #temp     WHERE   colid=@n)  
27   set   @objectname1=@objectname+_t  
28   SET   @OrigSpText3=(SELECT   ctext   FROM   syscomments   WHERE   id=object_id(@objectName)   and   colid=@n)  
29   if   @n=1  
30   begin  
31   SET   @OrigSpText2=CREATE   PROCEDURE   +   @objectName   +   WITH   ENCRYPTION   AS   --  
32   set   @q=4000-len(@OrigSpText2)  
33   set   @OrigSpText2=@OrigSpText2+REPLICATE(-,@q)  
34   end  
35   else  
36   begin  
37   SET   @OrigSpText2=REPLICATE(-,   4000)  
38   end  
39   --start   counter  
40   SET   @i=1  
41   --fill   temporary   variable  
42   SET   @resultsp   =   replicate(NA,   (datalength(@OrigSpText1)   /   2))  
43    
44   --loop  
45   WHILE   @i<=datalength(@OrigSpText1)/2  
46   BEGIN  
47   --reverse   encryption   (XOR   original+bogus+bogus   encrypted)  
48   SET   @resultsp   =   stuff(@resultsp,   @i,   1,   NCHAR(UNICODE(substring(@OrigSpText1,   @i,   1))   ^  
49                                                                   (UNICODE(substring(@OrigSpText2,   @i,   1))   ^  
50                                                                   UNICODE(substring(@OrigSpText3,   @i,   1)))))  
51           SET   @i=@i+1  
52   END  
53   --drop   original   SP  
54   --EXECUTE   (‘drop   PROCEDURE   ‘+   @objectName)  
55   --remove   encryption  
56   --preserve   case  
57   SET   @resultsp=REPLACE((@resultsp),WITH   ENCRYPTION,   ‘‘)  
58   SET   @resultsp=REPLACE((@resultsp),With   Encryption,   ‘‘)  
59   SET   @resultsp=REPLACE((@resultsp),with   encryption,   ‘‘)  
60   IF   CHARINDEX(WITH   ENCRYPTION,UPPER(@resultsp)   )>0    
61       SET   @resultsp=REPLACE(UPPER(@resultsp),WITH   ENCRYPTION,   ‘‘)  
62   --replace   Stored   procedure   without   enryption  
63   print   @resultsp  
64   --execute(   @resultsp)  
65   set   @n=@n+1  
66   end  
67   drop   table   #temp  
68   end  
69   rollback   tran  
70   --适合40000字符。  
71   --每次4000 print出来,自已贴。  
72   --切记:我见过的解过程都是对原过程进行破坏。破解前一定要备份!!!!  
73   --超过40000的,自已加SQL(我上面用SQL.SQL2--SQL10)  
74   --超长的可加SQL11--sql20........  
75    
76    
77   GO
Sql存储过程解密方法

 

Sql存储过程解密方法,布布扣,bubuko.com

Sql存储过程解密方法

上一篇:Spring连接数据库


下一篇:oracle disable constraint 或者删除primary key 是否删除索引