当前位置:首页 » 编程语言 » sql解密
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

sql解密

发布时间: 2022-02-13 02:18:40

sql存储过程可以解密吗

可以,CREATE PROCEDURE sp_decrypt(@objectName varchar(50))
AS
begin
set nocount on
--CSDN:j9988 right:2004.04.15
--V3.1
--破解字节不受限制,适用于SQLSERVER2000存储过程,函数,视图,触发器
--修正上一版视图触发器不能正确解密错误
--发现有错,请E_MAIL:[email protected]
begin tran
declare @objectname1 varchar(100),@orgvarbin varbinary(8000)
declare @sql1 nvarchar(4000),@sql2 varchar(8000),@sql3 nvarchar(4000),@sql4 nvarchar(4000)
DECLARE @OrigSpText1 nvarchar(4000), @OrigSpText2 nvarchar(4000) , @OrigSpText3 nvarchar(4000), @resultsp nvarchar(4000)
declare @i int,@status int,@type varchar(10),@parentid int
declare @colid int,@n int,@q int,@j int,@k int,@encrypted int,@number int
select @type=xtype,@parentid=parent_obj from sysobjects where id=object_id(@ObjectName)

create table #temp(number int,colid int,ctext varbinary(8000),encrypted int,status int)
insert #temp SELECT number,colid,ctext,encrypted,status FROM syscomments WHERE id = object_id(@objectName)
select @number=max(number) from #temp
set @k=0

while @k<=@number
begin
if exists(select 1 from syscomments where id=object_id(@objectname) and number=@k)
begin
if @type='P'
set @sql1=(case when @number>1 then 'ALTER PROCEDURE '+ @objectName +';'+rtrim(@k)+' WITH ENCRYPTION AS '
else 'ALTER PROCEDURE '+ @objectName+' WITH ENCRYPTION AS '
end)

if @type='TR'
begin
declare @parent_obj varchar(255),@tr_parent_xtype varchar(10)
select @parent_obj=parent_obj from sysobjects where id=object_id(@objectName)
select @tr_parent_xtype=xtype from sysobjects where id=@parent_obj
if @tr_parent_xtype='V'
begin
set @sql1='ALTER TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTERD OF INSERT AS PRINT 1 '
end
else
begin
set @sql1='ALTER TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 '
end

end
if @type='FN' or @type='TF' or @type='IF'
set @sql1=(case @type when 'TF' then
'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end '
when 'FN' then
'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end'
when 'IF' then
'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns table with encryption as return select @a as a'
end)

if @type='V'
set @sql1='ALTER VIEW '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f'

set @q=len(@sql1)
set @sql1=@sql1+REPLICATE('-',4000-@q)
select @sql2=REPLICATE('-',8000)
set @sql3='exec(@sql1'
select @colid=max(colid) from #temp where number=@k
set @n=1
while @n<=CEILING(1.0*(@colid-1)/2) and len(@sQL3)<=3996
begin
set @sql3=@sql3+'+@'
set @n=@n+1
end
set @sql3=@sql3+')'
exec sp_executesql @sql3,N'@Sql1 nvarchar(4000),@ varchar(8000)',@sql1=@sql1,@=@sql2

end
set @k=@k+1
end

set @k=0
while @k<=@number
begin

if exists(select 1 from syscomments where id=object_id(@objectname) and number=@k)
begin
select @colid=max(colid) from #temp where number=@k
set @n=1

while @n<=@colid
begin
select @OrigSpText1=ctext,@encrypted=encrypted,@status=status FROM #temp WHERE colid=@n and number=@k

SET @OrigSpText3=(SELECT ctext FROM syscomments WHERE id=object_id(@objectName) and colid=@n and number=@k)
if @n=1
begin
if @type='P'
SET @OrigSpText2=(case when @number>1 then 'CREATE PROCEDURE '+ @objectName +';'+rtrim(@k)+' WITH ENCRYPTION AS '
else 'CREATE PROCEDURE '+ @objectName +' WITH ENCRYPTION AS '
end)

if @type='FN' or @type='TF' or @type='IF'
SET @OrigSpText2=(case @type when 'TF' then
'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b select @a return end '
when 'FN' then
'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end'
when 'IF' then
'CREATE FUNCTION '+ @objectName+'(@a char(1)) returns table with encryption as return select @a as a'
end)

if @type='TR'
begin

if @tr_parent_xtype='V'
begin
set @OrigSpText2='CREATE TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION INSTEAD OF INSERT AS PRINT 1 '
end
else
begin
set @OrigSpText2='CREATE TRIGGER '+@objectname+' ON '+OBJECT_NAME(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 '
end

end

if @type='V'
set @OrigSpText2='CREATE VIEW '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f'

set @q=4000-len(@OrigSpText2)
set @OrigSpText2=@OrigSpText2+REPLICATE('-',@q)
end
else
begin
SET @OrigSpText2=REPLICATE('-', 4000)
end
SET @i=1

SET @resultsp = replicate(N'A', (datalength(@OrigSpText1) / 2))

WHILE @i<=datalength(@OrigSpText1)/2
BEGIN

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
set @orgvarbin=cast(@OrigSpText1 as varbinary(8000))
set @resultsp=(case when @encrypted=1
then @resultsp
else convert(nvarchar(4000),case when @status&2=2 then uncompress(@orgvarbin) else @orgvarbin end)
end)
print @resultsp

set @n=@n+1

end

end
set @k=@k+1
end

drop table #temp
rollback tran
end

② SQL数据库里面后台的密码加密了密文是: 请问如何解密。

数据库里面的数据是吗? 如果是的,就看程序是这么加密的,对应的找出他的解密方法。 如果没有,就要你自己研究了。

③ SQL数据库里的密码解密

什么管理软件啊,都不说。加密算法都没有,建议你直接找如来佛祖帮你搞顶

④ sql server里面的内容加密了,用什么方法可以解密

应该是程序写入数据库前加密的,要解密的话,先要查一下是用什么方式加密的,有没有解决程序。
如md5是没有解密程序的。

⑤ sql server 数据表中用户密码被加密,如何解密

这种是不能解密的,只能把要对比的进行加密,然后对比

⑥ 关于SQL-MD5解密,请高手回答一下!

MD5是不可逆的到这个网站上看行不行,如果你要解的数据那个网站已经记录下来的就可以不过大多是没有的,只有些简单的 http://www.cmd5.com/

⑦ SQL语句解密

你这个是什么加密方式?而且SQL好像没有所谓的解密函数的吧.
如果是MD5解密的话,你网络一下也能找到类似的相关语言的代码.
具体可以参考C#的MD5加密和解密:

http://wenku..com/link?url=xA9UdYn__-Se5tFdNC

⑧ sql server 连接密码破解方法

具体操作如下:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_GetPassword]') and OBJECTPROPERTY(id, N'IsProcere') = 1)
drop procere [dbo].[p_GetPassword]
GO
/*--穷举法破解 SQL Server 用户密码
可以破解中文,特殊字符,字符+尾随空格的密码
为了方便显示特殊字符的密码,在显示结果中,显示了组成密码的ASCII,理论上可以破解任意位数的密码,条件是电脑配置足够,时间足够.
/*--调用示例
exec p_GetPassword
--*/
create proc p_GetPassword
@username sysname=null, --用户名,如果不指定,则列出所有用户
@pwdlen int=2 --要破解的密码的位数,默认是2位及以下的
as
set @pwdlen=case when isnull(@pwdlen,0)<1 then 1 else @pwdlen-1 end
select top 255 id=identity(int,0,1) into #t from syscolumns
alter table #t add constraint pk_#t primary key(id)
select name,password
,type=case when xstatus&2048=2048 then 1 else 0 end
,jm=case when password is null then 1 else 0 end
,pwdstr=cast('' as sysname)
,pwd=cast('' as varchar(8000))
into #pwd
from master.dbo.sysxlogins a
where srvid is null
and name=isnull(@username,name)
declare @s1 varchar(8000),@s2 varchar(8000),@s3 varchar(8000)
declare @l int
select @l=0
,@s1='char(aa.id)'
,@s2='cast(aa.id as varchar)'
,@s3=',#t aa'
exec('
update pwd set jm=1,pwdstr='+@s1+'
,pwd='+@s2+'
from #pwd pwd'+@s3+'
where pwd.jm=0
and pwdcompare('+@s1+',pwd.password,pwd.type)=1
')
while exists(select 1 from #pwd where jm=0 and @l<@pwdlen)
begin
select @l=@l+1
,@s1=@s1+'+char('+char(@l/26+97)+char(@l%26+97)+'.id)'
,@s2=@s2+'+'',''+cast('+char(@l/26+97)+char(@l%26+97)+'.id as varchar)'
,@s3=@s3+',#t '+char(@l/26+97)+char(@l%26+97)
exec('
update pwd set jm=1,pwdstr='+@s1+'
,pwd='+@s2+'
from #pwd pwd'+@s3+'
where pwd.jm=0
and pwdcompare('+@s1+',pwd.password,pwd.type)=1
')
end
select 用户名=name,密码=pwdstr,密码ASCII=pwd
from #pwd
go

⑨ 如何对sql中表的一个字段解密

解密无非就是对字符的替换加减等基本操作
前提是有算法