|
3 | 3 | File: PowerUpSQL.ps1
|
4 | 4 | Author: Scott Sutherland (@_nullbind), NetSPI - 2023
|
5 | 5 | Major Contributors: Antti Rantasaari and Eric Gruber
|
6 |
| - Version: 1.128 |
| 6 | + Version: 1.129 |
7 | 7 | Description: PowerUpSQL is a PowerShell toolkit for attacking SQL Server.
|
8 | 8 | License: BSD 3-Clause
|
9 | 9 | Required Dependencies: PowerShell v.2
|
@@ -12625,9 +12625,9 @@ Function Get-SQLStoredProcedureCLR
|
12625 | 12625 | # Check count
|
12626 | 12626 | $CLRCount = $TblAssemblyFiles.Rows.Count
|
12627 | 12627 | if ($CLRCount -gt 0){
|
12628 |
| - Write-Verbose "$Instance : Found $CLRCount CLR stored procedures" |
| 12628 | + Write-Verbose "$Instance : - Found $CLRCount CLR stored procedures" |
12629 | 12629 | }else{
|
12630 |
| - Write-Verbose "$Instance : No CLR stored procedures found." |
| 12630 | + Write-Verbose "$Instance : - No CLR stored procedures found." |
12631 | 12631 | }
|
12632 | 12632 |
|
12633 | 12633 | # Return data
|
@@ -26810,7 +26810,12 @@ Function Invoke-SQLDumpInfo
|
26810 | 26810 |
|
26811 | 26811 | [Parameter(Mandatory = $false,
|
26812 | 26812 | HelpMessage = 'Write output to csv files.')]
|
26813 |
| - [switch]$csv |
| 26813 | + [switch]$csv, |
| 26814 | + |
| 26815 | + [Parameter(Mandatory = $false, |
| 26816 | + HelpMessage = 'Crawl available SQL Server links.')] |
| 26817 | + [switch]$CrawlLinks |
| 26818 | + |
26814 | 26819 | )
|
26815 | 26820 |
|
26816 | 26821 | Begin
|
@@ -27071,20 +27076,6 @@ Function Invoke-SQLDumpInfo
|
27071 | 27076 | $Results | Export-Csv -NoTypeInformation $OutPutPath
|
27072 | 27077 | }
|
27073 | 27078 |
|
27074 |
| - # Getting Server Links |
27075 |
| - Write-Verbose -Message "$Instance - Getting server links..." |
27076 |
| - $Results = Get-SQLServerLink -Instance $Instance -Username $Username -Password $Password -Credential $Credential -SuppressVerbose |
27077 |
| - if($xml) |
27078 |
| - { |
27079 |
| - $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links.xml' |
27080 |
| - $Results | Export-Clixml $OutPutPath |
27081 |
| - } |
27082 |
| - else |
27083 |
| - { |
27084 |
| - $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links.csv' |
27085 |
| - $Results | Export-Csv -NoTypeInformation $OutPutPath |
27086 |
| - } |
27087 |
| - |
27088 | 27079 | # Getting Server Credentials
|
27089 | 27080 | Write-Verbose -Message "$Instance - Getting server credentials..."
|
27090 | 27081 | $Results = Get-SQLServerCredential -Instance $Instance -Username $Username -Password $Password -Credential $Credential -SuppressVerbose
|
@@ -27350,7 +27341,37 @@ Function Invoke-SQLDumpInfo
|
27350 | 27341 | {
|
27351 | 27342 | $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_oledbproviders.csv'
|
27352 | 27343 | $Results | Export-Csv -NoTypeInformation $OutPutPath
|
27353 |
| - } |
| 27344 | + } |
| 27345 | + |
| 27346 | + # Getting Server Links |
| 27347 | + Write-Verbose -Message "$Instance - Getting server links..." |
| 27348 | + $Results = Get-SQLServerLink -Instance $Instance -Username $Username -Password $Password -Credential $Credential -SuppressVerbose |
| 27349 | + if($xml) |
| 27350 | + { |
| 27351 | + $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links.xml' |
| 27352 | + $Results | Export-Clixml $OutPutPath |
| 27353 | + } |
| 27354 | + else |
| 27355 | + { |
| 27356 | + $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links.csv' |
| 27357 | + $Results | Export-Csv -NoTypeInformation $OutPutPath |
| 27358 | + } |
| 27359 | + |
| 27360 | + # Getting Server Links via Crawl |
| 27361 | + if($CrawlLinks){ |
| 27362 | + Write-Verbose -Message "$Instance - Crawling linked servers..." |
| 27363 | + $Results = Get-SQLServerLinkCrawl -Instance $Instance -Username $Username -Password $Password -Credential $Credential -Export2 |
| 27364 | + if($xml) |
| 27365 | + { |
| 27366 | + $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links_crawl.xml' |
| 27367 | + $Results | Export-Clixml $OutPutPath |
| 27368 | + } |
| 27369 | + else |
| 27370 | + { |
| 27371 | + $OutPutPath = "$OutFolder\$OutPutInstance"+'_Server_links_crawl.csv' |
| 27372 | + $Results | Export-Csv -NoTypeInformation $OutPutPath |
| 27373 | + } |
| 27374 | + } |
27354 | 27375 |
|
27355 | 27376 | Write-Verbose -Message "$Instance - END"
|
27356 | 27377 | }
|
|
0 commit comments