Heim > Datenbank > MySQL-Tutorial > 解密存储过程,视图,触发器

解密存储过程,视图,触发器

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-07 14:54:37
Original
1293 Leute haben es durchsucht

解密存储过程,视图,触发器 存储过程 视图 触发器 此存储过程解密比较短的存储过程可以,运行前先备份存储过程,否则可能无法恢复。 Decrypt Stored Procedures, Views and TriggersScript Rating Total number of votes [11] By: jgama This SP will decry

解密存储过程,视图,触发器 存储过程 视图 触发器

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

此存储过程解密比较短的存储过程可以,运行前先备份存储过程,否则可能无法恢复。

 

Decrypt Stored Procedures, Views and Triggers

Script Rating       Total number of votes [11]

By: jgama

This SP will decrypt Stored Procedures, Views or Triggers that were encrypted using "with encryption" There are 2 versions: one for SP''s only and the other one for SP''s, triggers and views version 1: INPUT: object name (stored procedure, view or trigger) version 2: INPUT: object name (stored procedure, view or trigger), object type(''T''-trigger, ''P''-stored procedure or ''V''-view) Original idea: shoeboy?Copyright ?1999-2002 SecurityFocus

Stored procedures coded by Joseph Gama ?

 

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS OFF

GO

 

CREATE PROCEDURE DECRYPT2K (@objName varchar(50), @type char(1) )

--INPUT: object name (stored procedure,

--     view or trigger), object type (''S''-store

--     d procedure, ''V''view or ''T''-trigger)

--Original idea: shoeboy <shoeboy@ade

--     quacy.org>

--Copyright ?1999-2002 SecurityFocus

--adapted by Joseph Gama

--Planet Source Code, my employer and my

--     self are not responsible for the use of

--     this code

--This code is provided as is and for ed

--     ucational purposes only

--Please test it and share your results

 AS

DECLARE @a nvarchar(4000), @b nvarchar(4000), @c nvarchar(4000), @d nvarchar(4000), @i int, @t bigint, @tablename varchar(255), @trigtype varchar(6)

SET @type=UPPER(@type)

IF @type=''T''

 BEGIN

 SET @tablename=(SELECT sysobjects_1.name

 FROM dbo.sysobjects INNER JOIN

  dbo.sysobjects sysobjects_1 ON dbo.sysobjects.parent_obj = sysobjects_1.id

 WHERE (dbo.sysobjects.type = ''TR'') AND (dbo.sysobjects.name = @objName))

 SET @trigtype=(SELECT CASE WHEN dbo.sysobjects.deltrig > 0 THEN ''DELETE''

     WHEN dbo.sysobjects.instrig > 0 THEN ''INSERT''

     WHEN dbo.sysobjects.updtrig > 0 THEN ''UPDATE'' END

   FROM dbo.sysobjects INNER JOIN

    dbo.sysobjects sysobjects_1 ON dbo.sysobjects.parent_obj = sysobjects_1.id

   WHERE (dbo.sysobjects.type = ''TR'') AND (dbo.sysobjects.name = @objName))

 END

--get encrypted data

SET @a=(SELECT ctext FROM syscomments WHERE id = object_id(@objName))

SET @b=case @type

  WHEN ''S'' THEN ''ALTER PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62)

  WHEN ''V'' THEN ''ALTER VIEW ''+ @objName +'' WITH ENCRYPTION AS SELECT dbo.dtproperties.* FROM dbo.dtproperties''+REPLICATE(''-'', 4000-150)

  WHEN ''T'' THEN ''ALTER TRIGGER ''+@objName+'' ON ''+ @tablename+'' WITH ENCRYPTION FOR ''+@trigtype+'' AS PRINT ''''a''''''+REPLICATE(''-'', 4000-150)

  END

EXECUTE (@b)

--get encrypted bogus SP

SET @c=(SELECT ctext FROM syscomments WHERE id = object_id(@objName))

SET @b=case @type

 WHEN ''S'' THEN ''CREATE PROCEDURE ''+ @objName +'' WITH ENCRYPTION AS ''+REPLICATE(''-'', 4000-62)

 WHEN ''V'' THEN ''CREATE VIEW ''+ @objName +'' WITH ENCRYPTION AS SELECT dbo.dtproperties.* FROM dbo.dtproperties''+REPLICATE(''-'', 4000-150)

 WHEN ''T'' THEN ''CREATE TRIGGER ''+@objName+'' ON ''+ @tablename+'' WITH ENCRYPTION FOR ''+@trigtype+'' AS PRINT ''''a''''''+REPLICATE(''-'', 4000-150)

 END

--start counter

SET @i=1

--fill temporary variable

SET @d = replicate(N''A'', (datalength(@a) / 2))

--loop

WHILE @i<=datalength(@a)/2

 BEGIN

--xor original+bogus+bogus encrypted

SET @d = stuff(@d, @i, 1,

 NCHAR(UNICODE(substring(@a, @i, 1)) ^

 (UNICODE(substring(@b, @i, 1)) ^

 UNICODE(substring(@c, @i, 1)))))

 SET @i=@i+1

 END

--drop original SP

IF @type=''S''

 EXECUTE (''drop PROCEDURE ''+ @objName)

ELSE

 IF @type=''V''

  EXECUTE (''drop VIEW ''+ @objName)

 ELSE

  IF @type=''T''

   EXECUTE (''drop TRIGGER ''+ @objName)

--remove encryption

--try to preserve case

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

SET @d=REPLACE((@d),''With Encryption'', '''')

SET @d=REPLACE((@d),''with encryption'', '''')

IF CHARINDEX(''WITH ENCRYPTION'',UPPER(@d) )>0

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

--replace SP

execute( @d)

 

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

 

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS OFF

GO

 

CREATE PROCEDURE DECRYPTSP2K (@objName varchar(50))

--INPUT: object name (stored procedure,

--    

-- view or trigger)

--Original idea: shoeboy <shoeboy@a

-- dequacy.org>

--Copyright ?1999-2002 SecurityFocus

--adapted by Joseph Gama

--Planet Source Code, my employer and my

--    

-- self are not responsible for the use

--     of

-- this code

--This code is provided as is and for ed

--    

-- ucational purposes only

--Please test it and share your results

 AS

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

 BEGIN

--xor original+bogus+bogus encrypted

SET @d = stuff(@d, @i, 1,

 NCHAR(UNICODE(substring(@a, @i, 1)) ^

 (UNICODE(substring(@b, @i, 1)) ^

 UNICODE(substring(@c, @i, 1)))))

 SET @i=@i+1

 END

--drop original SP

EXECUTE (''drop PROCEDURE ''+ @objName)

--remove encryption

--try to preserve case

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

SET @d=REPLACE((@d),''With Encryption'', '''')

SET @d=REPLACE((@d),''with encryption'', '''')

IF CHARINDEX(''WITH ENCRYPTION'',UPPER(@d) )>0

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

--replace SP

execute( @d)

 

GO

SET QUOTED_IDENTIFIER OFF

GO

SET ANSI_NULLS ON

GO

Nach dem Login kopieren
Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage