代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
MSSQL
】
查看SQL SERVER 加密存储过程,函数,触发器,视图
作者:
Dezai.CN
/ 发布于
2012/2/9
/
955
<div>create PROCEDURE sp_decrypt(@objectname varchar(50)) AS begin set nocount on --CSDN:j9988 copyright:2004.07.15 --V3.2 --破解字节不受限制,适用于SQLSERVER2000存储过程,函数,视图,触发器 --修正上一版"视图触发器"不能正确解密错误 --发现有错,请E_MAIL:<a href="mailto:CSDNj9988@tom.com">CSDNj9988@tom.com</a> begin tran declare @objectname1 varchar(100),@orgvarbin varbinary(8000) declare @sql1 nvarchar(4000),@sql2 varchar(8000),@sql3 nvarchar(4000),@sql4 nvarchar(4000) DECLARE @OrigSpText1 nvarchar(4000), @OrigSpText2 nvarchar(4000) , @OrigSpText3 nvarchar(4000), @resultsp nvarchar(4000) declare @i int,@status int,@type varchar(10),@parentid int declare @colid int,@n int,@q int,@j int,@k int,@encrypted int,@number int select @type=xtype,@parentid=parent_obj from sysobjects where id=object_id(@objectname)</div> <div>create table #temp(number int,colid int,ctext varbinary(8000),encrypted int,status int) insert #temp SELECT number,colid,ctext,encrypted,status FROM syscomments WHERE id = object_id(@objectname) select @number=max(number) from #temp set @k=0</div> <div>while @k<<a href="mailto:=@number">=@number</a> begin if exists(select 1 from syscomments where id=object_id(@objectname) and <a href="mailto:number=@k">number=@k</a>) begin if @type='P' set @sql1=(case when @number>1 then 'ALTER PROCEDURE '+ @objectname +';'+rtrim(@k)+' WITH ENCRYPTION AS ' else 'ALTER PROCEDURE '+ @objectname+' WITH ENCRYPTION AS ' end)</div> if @type='TR' begin declare @parent_obj varchar(255),@tr_parent_xtype varchar(10) select @parent_obj=parent_obj from sysobjects where id=object_id(@objectname) select @tr_parent_xtype=xtype from sysobjects where <a href="mailto:id=@parent_obj">id=@parent_obj</a> if @tr_parent_xtype='V' begin set @sql1='ALTER TRIGGER <a href="mailto:'+@objectname+'">'+@objectname+'</a> ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTERD OF INSERT AS PRINT 1 ' end else begin set @sql1='ALTER TRIGGER <a href="mailto:'+@objectname+'">'+@objectname+'</a> ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 ' end</div> <div>end if @type='FN' or @type='TF' or @type='IF' set @sql1=(case @type when 'TF' then 'ALTER FUNCTION '+ @objectname+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end ' when 'FN' then 'ALTER FUNCTION '+ @objectname+'(@a char(1)) returns char(1) with encryption as begin return @a end' when 'IF' then 'ALTER FUNCTION '+ @objectname+'(@a char(1)) returns table with encryption as return select @a as a' end)</div> if @type='V' set @sql1='ALTER VIEW <a href="mailto:'+@objectname+'">'+@objectname+'</a> WITH ENCRYPTION AS SELECT 1 as f'</div> <div>set @q=len(@sql1) set @sql1=@sql1+REPLICATE('-',4000-@q) select @sql2=REPLICATE('-',8000) set @sql3='exec(@sql1' select @colid=max(colid) from #temp where <a href="mailto:number=@k">number=@k</a> set @n=1 while @n<=CEILING(1.0*(@colid-1)/2) and len(@sql3)<=3996 begin set @sql3=@sql3+'+@' set @n=@n+1 end set @sql3=@sql3+')' exec sp_executesql @sql3,N'@sql1 nvarchar(4000),@ varchar(8000)',@sql1=@sql1,@=@sql2</div> <div>end set @k=@k+1 end</div> <div>set @k=0 while @k<<a href="mailto:=@number">=@number</a> begin</div> if exists(select 1 from syscomments where id=object_id(@objectname) and <a href="mailto:number=@k">number=@k</a>) begin select @colid=max(colid) from #temp where <a href="mailto:number=@k">number=@k</a> set @n=1</div> <div>while @n<<a href="mailto:=@colid">=@colid</a> begin select @OrigSpText1=ctext,@encrypted=encrypted,@status=status FROM #temp WHERE <a href="mailto:colid=@n">colid=@n</a> and <a href="mailto:number=@k">number=@k</a></div> <div>SET @OrigSpText3=(SELECT ctext FROM syscomments WHERE id=object_id(@objectname) and <a href="mailto:colid=@n">colid=@n</a> and <a href="mailto:number=@k">number=@k</a>) if @n=1 begin if @type='P' SET @OrigSpText2=(case when @number>1 then 'CREATE PROCEDURE '+ @objectname +';'+rtrim(@k)+' WITH ENCRYPTION AS ' else 'CREATE PROCEDURE '+ @objectname +' WITH ENCRYPTION AS ' end)</div> <div> if @type='FN' or @type='TF' or @type='IF' SET @OrigSpText2=(case @type when 'TF' then 'CREATE FUNCTION '+ @objectname+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end ' when 'FN' then 'CREATE FUNCTION '+ @objectname+'(@a char(1)) returns char(1) with encryption as begin return @a end' when 'IF' then 'CREATE FUNCTION '+ @objectname+'(@a char(1)) returns table with encryption as return select @a as a' end)</div> if @type='TR' begin</div> if @tr_parent_xtype='V' begin set @OrigSpText2='CREATE TRIGGER <a href="mailto:'+@objectname+'">'+@objectname+'</a> ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTEAD OF INSERT AS PRINT 1 ' end else begin set @OrigSpText2='CREATE TRIGGER <a href="mailto:'+@objectname+'">'+@objectname+'</a> ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 ' end</div> <div>end</div> if @type='V' set @OrigSpText2='CREATE VIEW <a href="mailto:'+@objectname+'">'+@objectname+'</a> WITH ENCRYPTION AS SELECT 1 as f'</div> <div>set @q=4000-len(@OrigSpText2) set @OrigSpText2=@OrigSpText2+REPLICATE('-',@q) end else begin SET @OrigSpText2=REPLICATE('-', 4000) end SET @i=1</div> <div>SET @resultsp = replicate(N'A', (datalength(@OrigSpText1) / 2))</div> <div>WHILE @i<=datalength(@OrigSpText1)/2 BEGIN</div> <div>SET @resultsp = stuff(@resultsp, @i, 1, NCHAR(UNICODE(substring(@OrigSpText1, @i, 1)) ^ (UNICODE(substring(@OrigSpText2, @i, 1)) ^ UNICODE(substring(@OrigSpText3, @i, 1))))) SET @i=@i+1 END set @orgvarbin=cast(@OrigSpText1 as varbinary(8000)) set @resultsp=(case when @encrypted=1 then @resultsp else convert(nvarchar(4000),case when @status&2=2 then uncompress(@orgvarbin) else @orgvarbin end) end) print @resultsp</div> <div>set @n=@n+1</div> <div>end</div> <div>end set @k=@k+1 end</div> <div>drop table #temp rollback tran end</div> <div></div>
试试其它关键字
同语言下
.
SQL查询 多列合并成一行用逗号隔开
.
查看存储过程修改时间,最近执行时间
.
设置手动批量删除数据库相关进程
.
获取某个表中特定字段的所有字符串形式
.
SQL 如何去除重复的字符串
.
怎么去掉一个字段中的重复数据
.
String 去除空格 回车 换行 水平制表符
.
SQL查询和替换含有回车,空格,TAB
.
SQL SERVER 查询每日新增用户数量、次留数量
.
判断两个字符串是否存在相同的内容
可能有用的
.
SQL查询 多列合并成一行用逗号隔开
.
查看存储过程修改时间,最近执行时间
.
设置手动批量删除数据库相关进程
.
获取某个表中特定字段的所有字符串形式
.
SQL 如何去除重复的字符串
.
怎么去掉一个字段中的重复数据
.
String 去除空格 回车 换行 水平制表符
.
SQL查询和替换含有回车,空格,TAB
.
SQL SERVER 查询每日新增用户数量、次留数量
.
判断两个字符串是否存在相同的内容
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3