Skip to content

Commit 17984e3

Browse files
authored
Update PowerUpSQL_PesterDb.sql
1 parent ac1acfe commit 17984e3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/PowerUpSQL_PesterDb.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,21 @@ sp_configure 'xp_cmdshell',1;
232232
RECONFIGURE;
233233
GO
234234

235+
-- Select the master database
236+
USE master
237+
GO
238+
239+
-- Create server link
240+
If Exists (select srvname from master..sysservers where srvname = 'sqlserver1\instance1')
241+
EXEC master.dbo.sp_addlinkedserver
242+
@server = N'sqlserver1\instance1',
243+
@srvproduct=N'SQL Server' ;
244+
GO
245+
246+
-- Add login to link
247+
If Exists (select srvname from master..sysservers where srvname = 'sqlserver1\instance1')
248+
EXEC sp_addlinkedsrvlogin 'sqlserver1\instance1', 'false', NULL, 'linklogin', 'linklogin';
249+
GO
235250

236251
------------------------------------------------------------
237252
-- Create Audit, Server Spec, and Database Spec
@@ -408,6 +423,7 @@ CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'SuperSecretPasswordHere!';
408423
GO
409424

410425
-- Create certificate for the sp_sqli2 procedure
426+
If not Exists (select name from sys.certificates where name = 'sp_sqli2_cert')
411427
CREATE CERTIFICATE sp_sqli2_cert
412428
WITH SUBJECT = 'This should be used to sign the sp_sqli2',
413429
EXPIRY_DATE = '2050-10-20';

0 commit comments

Comments
 (0)