Decryption of Encrypted Stored Procedures

  • Hi,

    Is there anyway to get the text in an encrypted stored procedures?

  • Yes, there are tools on the internet and some simple code at Planet-Source-Code to do this sorrt of thing. Note however some do it by changing the SP to garbage and comparing offsets so make sure you backup first and make sure you do not violate any license agreements you have, this should only be used strictly for recover of lost code for yourself or group.

  • But in most cases you must have sysadmin right to use such app. There are also stored procedures to decrypt encrypted procedures.

  • I found this from Planet Source Code. CHeck you adequate rights to use it.

    CREATE PROCEDURE DECRYPTSP2K

    @objName varchar(50)

    AS

    DECLARE @a nvarchar(4000), @b-2 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-2='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-2='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 @i0

    SET @d=REPLACE(UPPER(@d),'WITH ENCRYPTION', '')

    --replace SP

    execute( @d)

    GO

  • I use dSQLSRVD

    http://www.geocities.com/d0mn4r/dSQLSRVD.html


    -- Amit



    "There is no 'patch' for stupidity."



    Download the Updated SQL Server 2005 Books Online.

  •  Hi,

    As said by Antares686 i found number of scripts and tools for decryption in planet-source-code site. Thanks for eswar for providing 'DECRYPTSP2K' it is working really fine.

    I tried dSQLSRVD but it is giving some ADO Recordset error.

    Thanks for your responses.

  • Might try giving this product a shot. http://decryptor.orbitaltechnologies.org

  • Thank you very much for DECRYPTSP2K!

     

  • These Decrypting tools are successfull in many times. Dont You think then SQL

    not that much secured. Suppose if some body wants to hide the logical steps then they usually encrypt the stored procedure.

     

    With decryption they can always come to know what is there in the procedure

    Is there any way to avoid this

  • You might be noticed that above does not work for SQL Server 2005.

    A tool for SQL Server 2005: http://www.elitude.net

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply