代码语言
.
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
】
解密存储过程,视图,触发器
作者:
疯狂的流浪
/ 发布于
2011/1/10
/
1123
<div>此存储过程解密比较短的存储过程可以,运行前先备份存储过程,否则可能无法恢复。</div> <div>Decrypt Stored Procedures, Views and Triggers Script Rating Total number of votes [11] By: jgama This SP will decrypt Stored Procedures, Views or Triggers that were encrypted using "with encryption" There are 2 versions: one for SP''s only and the other one for SP''s, triggers and views version 1: INPUT: object name (stored procedure, view or trigger) version 2: INPUT: object name (stored procedure, view or trigger), object type(''T''-trigger, ''P''-stored procedure or ''V''-view) Original idea: shoeboy?Copyright ?1999-2002 SecurityFocus Stored procedures coded by Joseph Gama ?</div> <div>SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO</div> <div>CREATE PROCEDURE DECRYPT2K (@objName varchar(50), @type char(1) ) --INPUT: object name (stored procedure, -- view or trigger), object type (''S''-store -- d procedure, ''V''view or ''T''-trigger) --Original idea: shoeboy <<a href="mailto:shoeboy@ade">shoeboy@ade</a> -- quacy.org> --Copyright ?1999-2002 SecurityFocus --adapted by Joseph Gama --Planet Source Code, my employer and my -- self are not responsible for the use of -- this code --This code is provided as is and for ed -- ucational purposes only --Please test it and share your results AS DECLARE @a nvarchar(4000), @b nvarchar(4000), @c nvarchar(4000), @d nvarchar(4000), @i int, @t bigint, @tablename varchar(255), @trigtype varchar(6) SET @type=UPPER(@type) IF @type=''T'' BEGIN SET @tablename=(SELECT sysobjects_1.name FROM dbo.sysobjects INNER JOIN dbo.sysobjects sysobjects_1 ON dbo.sysobjects.parent_obj = sysobjects_1.id WHERE (dbo.sysobjects.type = ''TR'') AND (dbo.sysobjects.name = @objName)) SET @trigtype=(SELECT CASE WHEN dbo.sysobjects.deltrig > 0 THEN ''DELETE'' WHEN dbo.sysobjects.instrig > 0 THEN ''INSERT'' WHEN dbo.sysobjects.updtrig > 0 THEN ''UPDATE'' END FROM dbo.sysobjects INNER JOIN dbo.sysobjects sysobjects_1 ON dbo.sysobjects.parent_obj = sysobjects_1.id WHERE (dbo.sysobjects.type = ''TR'') AND (dbo.sysobjects.name = @objName)) END --get encrypted data SET @a=(SELECT ctext FROM syscomments WHERE id = object_id(@objName)) SET @b=case @type WHEN ''S'' THEN ''ALTER PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62) WHEN ''V'' THEN ''ALTER VIEW ''+ @objName +'' WITH ENCRYPTION AS SELECT dbo.dtproperties.* FROM dbo.dtproperties''+REPLICATE(''-'', 4000-150) WHEN ''T'' THEN ''ALTER TRIGGER <a href="mailto:''+@objName+''">''+@objName+''</a> ON ''+ @tablename+'' WITH ENCRYPTION FOR <a href="mailto:''+@trigtype+''">''+@trigtype+''</a> AS PRINT ''''a''''''+REPLICATE(''-'', 4000-150) END EXECUTE (@b) --get encrypted bogus SP SET @c=(SELECT ctext FROM syscomments WHERE id = object_id(@objName)) SET @b=case @type WHEN ''S'' THEN ''CREATE PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62) WHEN ''V'' THEN ''CREATE VIEW ''+ @objName +'' WITH ENCRYPTION AS SELECT dbo.dtproperties.* FROM dbo.dtproperties''+REPLICATE(''-'', 4000-150) WHEN ''T'' THEN ''CREATE TRIGGER <a href="mailto:''+@objName+''">''+@objName+''</a> ON ''+ @tablename+'' WITH ENCRYPTION FOR <a href="mailto:''+@trigtype+''">''+@trigtype+''</a> AS PRINT ''''a''''''+REPLICATE(''-'', 4000-150) END --start counter SET @i=1 --fill temporary variable SET @d = replicate(N''A'', (datalength(@a) / 2)) --loop WHILE @i<=datalength(@a)/2 BEGIN --xor original+bogus+bogus encrypted SET @d = stuff(@d, @i, 1, NCHAR(UNICODE(substring(@a, @i, 1)) ^ (UNICODE(substring(@b, @i, 1)) ^ UNICODE(substring(@c, @i, 1))))) SET @i=@i+1 END --drop original SP IF @type=''S'' EXECUTE (''drop PROCEDURE ''+ @objName) ELSE IF @type=''V'' EXECUTE (''drop VIEW ''+ @objName) ELSE IF @type=''T'' EXECUTE (''drop TRIGGER ''+ @objName) --remove encryption --try to preserve case SET @d=REPLACE((@d),''WITH ENCRYPTION'', '''') SET @d=REPLACE((@d),''With Encryption'', '''') SET @d=REPLACE((@d),''with encryption'', '''') IF CHARINDEX(''WITH ENCRYPTION'',UPPER(@d) )>0 SET @d=REPLACE(UPPER(@d),''WITH ENCRYPTION'', '''') --replace SP execute( @d)</div> <div>GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO</div> <div>SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO</div> <div>CREATE PROCEDURE DECRYPTSP2K (@objName varchar(50)) --INPUT: object name (stored procedure, -- -- view or trigger) --Original idea: shoeboy <<a href="mailto:shoeboy@a">shoeboy@a</a> -- dequacy.org> --Copyright ?1999-2002 SecurityFocus --adapted by Joseph Gama --Planet Source Code, my employer and my -- -- self are not responsible for the use -- of -- this code --This code is provided as is and for ed -- -- ucational purposes only --Please test it and share your results AS DECLARE @a nvarchar(4000), @b nvarchar(4000), @c nvarchar(4000), @d nvarchar(4000), @i int, @t bigint --get encrypted data SET @a=(SELECT ctext FROM syscomments WHERE id = object_id(@objName)) SET @b=''ALTER PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62) EXECUTE (@b) --get encrypted bogus SP SET @c=(SELECT ctext FROM syscomments WHERE id = object_id(@objName)) SET @b=''CREATE PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62) --start counter SET @i=1 --fill temporary variable SET @d = replicate(N''A'', (datalength(@a) / 2)) --loop WHILE @i<=datalength(@a)/2 BEGIN --xor original+bogus+bogus encrypted SET @d = stuff(@d, @i, 1, NCHAR(UNICODE(substring(@a, @i, 1)) ^ (UNICODE(substring(@b, @i, 1)) ^ UNICODE(substring(@c, @i, 1))))) SET @i=@i+1 END --drop original SP EXECUTE (''drop PROCEDURE ''+ @objName) --remove encryption --try to preserve case SET @d=REPLACE((@d),''WITH ENCRYPTION'', '''') SET @d=REPLACE((@d),''With Encryption'', '''') SET @d=REPLACE((@d),''with encryption'', '''') IF CHARINDEX(''WITH ENCRYPTION'',UPPER(@d) )>0 SET @d=REPLACE(UPPER(@d),''WITH ENCRYPTION'', '''') --replace SP execute( @d)</div> <div>GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO</div>
试试其它关键字
解密存储过程
同语言下
.
SQL查询 多列合并成一行用逗号隔开
.
查看存储过程修改时间,最近执行时间
.
设置手动批量删除数据库相关进程
.
获取某个表中特定字段的所有字符串形式
.
SQL 如何去除重复的字符串
.
怎么去掉一个字段中的重复数据
.
String 去除空格 回车 换行 水平制表符
.
SQL查询和替换含有回车,空格,TAB
.
SQL SERVER 查询每日新增用户数量、次留数量
.
判断两个字符串是否存在相同的内容
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
疯狂的流浪
贡献的其它代码
(
8
)
.
直接在页面上显示Extjs日期控件
.
中国象棋博弈树搜索算法
.
时间操作工具类
.
SQL导出为Word
.
SQL导出为Excel表
.
SQL实现交叉表的方法
.
解密存储过程,视图,触发器
.
去除外键的存储过程
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3