|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
因此我们看到,这些信息足够让我们对单个操作实现“逆操作”。存储历程|解密
内容来自互联网,作者不明
dropproceduresp_decrypt
go
createPROCEDUREsp_decrypt(@objectNamevarchar(50))
AS
begin
begintransaction--addbyplayyuer
declare@objectname1varchar(100)
declare@sql1nvarchar(4000),@sql2nvarchar(4000),@sql3nvarchar(4000),@sql4nvarchar(4000),@sql5nvarchar(4000),@sql6nvarchar(4000),@sql7nvarchar(4000),@sql8nvarchar(4000),@sql9nvarchar(4000),@sql10nvarchar(4000)
DECLARE@OrigSpText1nvarchar(4000),@OrigSpText2nvarchar(4000),@OrigSpText3nvarchar(4000),@resultspnvarchar(4000)
declare@iint,@tbigint
declare@mint,@nint,@qint
set@m=(SELECTmax(colid)FROMsyscommentsWHEREid=object_id(@objectName))
set@n=1
--getencrypteddata
createtable#temp(colidint,ctextvarbinary(8000))
insert#tempSELECTcolid,ctextFROMsyscommentsWHEREid=object_id(@objectName)
set@sql1=ALTERPROCEDURE+@objectName+WITHENCRYPTIONAS
--set@sql1=ALTERPROCEDURE+@objectName+WITHENCRYPTIONAS
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=(SELECTctextFROM#tempWHEREcolid=@n)
set@objectname1=@objectName+_t
SET@OrigSpText3=(SELECTctextFROMsyscommentsWHEREid=object_id(@objectName)andcolid=@n)
if@n=1
begin
SET@OrigSpText2=CREATEPROCEDURE+@objectName+WITHENCRYPTIONAS--
set@q=4000-len(@OrigSpText2)
set@OrigSpText2=@OrigSpText2+REPLICATE(-,@q)
end
else
begin
SET@OrigSpText2=REPLICATE(-,4000)
end
--startcounter
SET@i=1
--filltemporaryvariable
SET@resultsp=replicate(NA,(datalength(@OrigSpText1)/2))
--loop
WHILE@i<=datalength(@OrigSpText1)/2
BEGIN
--reverseencryption(XORoriginal+bogus+bogusencrypted)
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
--droporiginalSP
--EXECUTE(dropPROCEDURE+@objectName)
--removeencryption
--preservecase
SET@resultsp=REPLACE((@resultsp),WITHENCRYPTION,)
SET@resultsp=REPLACE((@resultsp),WithEncryption,)
SET@resultsp=REPLACE((@resultsp),withencryption,)
IFCHARINDEX(WITHENCRYPTION,UPPER(@resultsp))>0
SET@resultsp=REPLACE(UPPER(@resultsp),WITHENCRYPTION,)
--replaceStoredprocedurewithoutenryption
print@resultsp
--execute(@resultsp)
set@n=@n+1
end
droptable#temp
end
rollbacktransaction--addbyplayyuer
GO
在Windows中MySQL以服务形式存在,在使用前应确保此服务已经启动,未启动可用netstartmysql命令启动。而Linux中启动时可用“/etc/rc.d/init.d/mysqldstart"命令,注意启动者应具有管理员权限。 |
|