Found, decrypts the SQL2000 stored procedure

Source: Internet
Author: User
Create the following stored procedure
Then call
Exec sp_decrypt @ objectName
(@ ObjectName is the name of the encrypted stored procedure)
Exposed!
This program does not destroy the original stored procedure!
Haha, it's fun!
Create 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), @ resulnvtsp Archar (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'
-- Set @ sql1 = 'alter PROCEDURE '+ @ objectName +' with encryption'
Set @ q = len (@ sql1)
Set @ sql1 = @ sql1 + REPLICATE ('-', 4000-@ q)
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 (@ sql1 + @ sql2 + @ sql3 + @ sql4 + @ sql5 + @ sql6 + @ sql7 + @ sql8 + @ sql9 + @ sql10)
While @ n <= @ m
Begin
SET @ OrigSpText1 = (SELECT ctext FROM # temp WHERE colid = @ n)
Set @ objectname1 = @ objectName + '_ t'
SET @ OrigSpText3 = (SELECT ctext FROM syscomments WHERE id = object_id (@ objectName) and colid = @ n)
If @ n = 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.