ホームページ >データベース >mysql チュートリアル >批量解密SQLSERVER数据库中的各种对象的工具dbForge SQL Decrypt
批量 解密 SQLSERVER 数据库 中的 各种 对象 的 工具 dbForge SQL Decryptor2.1.11 之前写过一篇文章,使用redgate公司的SQL PROMPT 工具 ,但是不太方便 SQLPROMPT5.3对 各种 加密 对象 的 解密 测试 SQL2005 解密 已经被加密的存储过程 昨天ahdung童鞋介绍
之前写过一篇文章,使用redgate公司的SQL PROMPT工具,但是不太方便
SQLPROMPT5.3对各种加密对象的解密测试
SQL2005解密已经被加密的存储过程
昨天ahdung 童鞋介绍了这个工具给我,非常感谢他
dbForge SQL Decryptor这个工具的软件公司是devart,也是跟redgate公司一样,制作各种数据库辅助工具和编程工具的一家比较出名的软件公司
官网:http://www.devart.com/
软件下载地址:
http://www.devart.com/dbforge/sql/sqldecryptor/download.html
http://files.cnblogs.com/lyhabc/sqldecryptor.rar
这个工具是免费的,不用破解,安装完毕,立刻可以用
在SQLSERVER数据库工具当中还提供了另外一个免费工具:dbForge SQL Azure Backup
http://www.devart.com/dbforge/sql/
介绍
先说题外话:大家可以把这些第三方的工具放到外部工具里,这样只要打开SSMS,就不用在桌面找这些工具的图标再打开
相应工具了,速度可以快一倍,我就是这样做的,打开了SSMS就不用到桌面找这个软件,找那个软件
界面使用WPF编写,还是挺好的
登录界面做得挺有意思,可以使用传统的连接方式,也可以使用DAC连接或者自己写连接字符串
我们按照这篇文章创建好各种加密对象:SQLPROMPT5.3对各种加密对象的解密测试
包括视图,存储过程,函数,触发器
功能比较简单,界面跟SSMS差不多
就三个功能
选中你的数据库,然后右键-》Decryption Wizard..
他会列出你所选择要显示的解密对象类型,分别有:存储过程、用户定义函数、视图、表触发器、数据库触发器
你可以将解密的各种对象的脚本保存到同一个脚本中或者每个对象一个脚本,我这里选择都保存在同一个脚本中
点击Execute之后,在桌面就会生成一个脚本.sql文件
把脚本拖到SSMS
<span> 1</span> <span>USE</span><span> pratice </span><span> 2</span> <span>GO</span> <span> 3</span> <span> 4</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span> 5</span> <span>GO</span> <span> 6</span> <span>/*</span><span>**************创建加密的存储过程******************</span><span>*/</span> <span> 7</span> <span>Create</span> <span>Procedure</span><span> CPP_test_Encryption </span><span> 8</span> <span>with</span><span> encryption </span><span> 9</span> <span>AS</span> <span>10</span> <span>--</span><span>--可以换成任意的逻辑</span> <span>11</span> <span>execute</span><span> CPP_test_Original </span><span>12</span> <span>GO</span> <span>13</span> <span>14</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>15</span> <span>GO</span> <span>16</span> <span>CREATE</span> <span>FUNCTION</span> <span>[</span><span>dbo</span><span>]</span>.f_get_page(<span>@page_num</span> <span>BINARY</span>(<span>6</span><span>)) </span><span>17</span> <span>RETURNS</span> <span>VARCHAR</span>(<span>11</span><span>) </span><span>18</span> <span>WITH</span><span> ENCRYPTION </span><span>19</span> <span>AS</span> <span>20</span> <span>BEGIN</span> <span>21</span> <span>RETURN</span>(<span>CONVERT</span>(<span>VARCHAR</span>(<span>2</span>),(<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>6</span>,<span>1</span>))<span>*</span><span>POWER</span>(<span>2</span>,<span>8</span>))<span>+</span> <span>22</span> (<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>5</span>,<span>1</span>))))<span>+</span><span>'</span><span>:</span><span>'</span><span>+</span> <span>23</span> <span>CONVERT</span>(<span>VARCHAR</span>(<span>11</span><span>), </span><span>24</span> (<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>4</span>,<span>1</span>))<span>*</span><span>POWER</span>(<span>2</span>,<span>24</span>))<span>+</span> <span>25</span> (<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>3</span>,<span>1</span>))<span>*</span><span>POWER</span>(<span>2</span>,<span>16</span>))<span>+</span> <span>26</span> (<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>2</span>,<span>1</span>))<span>*</span><span>POWER</span>(<span>2</span>,<span>8</span>))<span>+</span> <span>27</span> (<span>CONVERT</span>(<span>INT</span>,<span>SUBSTRING</span>(<span>@page_num</span>,<span>1</span>,<span>1</span><span>))))) </span><span>28</span> <span>END</span> <span>29</span> <span>GO</span> <span>30</span> <span>31</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>32</span> <span>GO</span> <span>33</span> <span>CREATE</span> <span>VIEW</span><span> aa </span><span>34</span> <span>WITH</span><span> ENCRYPTION </span><span>35</span> <span>AS</span> <span>36</span> <span>SELECT</span> <span>*</span> <span>FROM</span> <span>[</span><span>dbo</span><span>]</span>.<span>[</span><span>Users</span><span>]</span> <span>37</span> <span>GO</span> <span>38</span> <span>39</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>40</span> <span>GO</span> <span>41</span> <span>CREATE</span> <span>TRIGGER</span><span> cc </span><span>42</span> <span>ON</span> <span>[</span><span>dbo</span><span>]</span>.<span>[</span><span>Users</span><span>]</span> <span>43</span> <span>WITH</span><span> ENCRYPTION </span><span>44</span> <span>FOR</span> <span>INSERT</span> <span>45</span> <span>AS</span> <span>RAISERROR</span>(<span>500001</span>,<span>16</span>,<span>10</span><span>) </span><span>46</span> <span>GO</span> <span>47</span> <span>48</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>49</span> <span>GO</span> <span>50</span> <span>Create</span> <span>Procedure</span><span> creat_test_Encryption </span><span>51</span> <span>with</span><span> encryption </span><span>52</span> <span>AS</span> <span>53</span> <span>SELECT</span> <span>TOP</span> <span>100</span> <span>*</span> <span>FROM</span> <span>[</span><span>dbo</span><span>]</span>.<span>[</span><span>test13</span><span>]</span> <span>54</span> <span>55</span> <span>GO</span>
而Decrypt in-place(alter objects)就是把各种对象中的with encryption去掉,不知道f_get_page这个函数会失败
执行Decrypt in-place(alter objects)前
<span>1</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>2</span> <span>GO</span> <span>3</span> <span>ALTER</span> <span>Procedure</span><span> creat_test_Encryption </span><span>4</span> <span>with</span><span> encryption </span><span>5</span> <span>AS</span> <span>6</span> <span>SELECT</span> <span>TOP</span> <span>100</span> <span>*</span> <span>FROM</span> <span>[</span><span>dbo</span><span>]</span>.<span>[</span><span>test13</span><span>]</span> <span>7</span> <span>GO</span>
执行执行Decrypt in-place(alter objects)后
<span>1</span> <span>SET</span> ANSI_NULLS, QUOTED_IDENTIFIER <span>ON</span> <span>2</span> <span>GO</span> <span>3</span> <span>ALTER</span> <span>Procedure</span><span> creat_test_Encryption </span><span>4</span> <span>AS</span> <span>5</span> <span>SELECT</span> <span>TOP</span> <span>100</span> <span>*</span> <span>FROM</span> <span>[</span><span>dbo</span><span>]</span>.<span>[</span><span>test13</span><span>]</span> <span>6</span> <span>GO</span>
你会看到执行Decrypt in-place(alter objects)后,相当于去掉了with encryption
除了那个用户定义函数之后其他的解密出来了,其实你可以drop掉那个函数,然后用解密出来的脚本重新创建函数就可以了
视图,触发器都没有锁小图标了
其他功能
Show DDL script就是把对象的创建脚本显示出来,而Decrypt in-place我就不说了
注意,下面的界面是在dbForge SQL Decryptor工具中的界面,不是在SSMS中的界面,虽然这个工具的界面跟SQL2012 的SSMS界面很像
总结
DBA有了这个工具之后,就不怕开发人员随意加密他们自己写的函数、存储过程、触发器了
也能减轻DBA的负担
如有不对的地方,欢迎大家拍砖o(∩_∩)o