Skip to content

Commit 692d5f3

Browse files
committed
script directory clean up
1 parent 37fdfe3 commit 692d5f3

18 files changed

Lines changed: 14853 additions & 31 deletions

images/powerupsql-large.png

18.2 KB
Loading

images/powerupsql-small.png

9.46 KB
Loading

scripts/3rdparty/Inveigh-Relay.ps1

Lines changed: 2084 additions & 0 deletions
Large diffs are not rendered by default.

scripts/3rdparty/Inveigh.ps1

Lines changed: 2451 additions & 0 deletions
Large diffs are not rendered by default.

scripts/3rdparty/Invoke-InveighBruteForce.ps1

Lines changed: 1736 additions & 0 deletions
Large diffs are not rendered by default.

scripts/3rdparty/Invoke-Parallel.ps1

Lines changed: 610 additions & 0 deletions
Large diffs are not rendered by default.

scripts/3rdparty/Invoke-TokenManipulation.ps1

Lines changed: 1917 additions & 0 deletions
Large diffs are not rendered by default.

scripts/3rdparty/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### 3rd Party Scripts
2+
3+
This folder contains scripts written by other authors which are used by some of the PowerUpSQL functions. Summary below.
4+
5+
Author: Warren F. (RamblingCookieMonster)
6+
Source: https://github.com/RamblingCookieMonster/Invoke-Parallel
7+
Imported Scripts: Invoke-Parallel.ps1
8+
PowerUpSQL Functions: Used for threaded functions.
9+
10+
Author: Kevin Robertson
11+
Source: https://github.com/Kevin-Robertson/Inveigh
12+
Imported Scripts: Inveigh.ps1, Inveigh-BruteForce.ps1, and Inveigh-Relay.ps1
13+
PowerUpSQL Functions: Used in Invoke-SQLAuditPrivXpDirtree and Invoke-SQLAuditXpPrivFileExist
14+
15+
Author: Joeseph Bailek
16+
Source: https://github.com/clymb3r/PowerShell/tree/master/Invoke-TokenManipulation
17+
Imported Scripts: Invoke-TokenManipulation.ps1
18+
PowerUpSQL Functions: Pending...
19+
20+
21+
22+

scripts/README.md

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,7 @@
1-
### Stand Alone Scripts
2-
These are scripting that will eventually be turned into PowerUpSQL functions.
1+
### Pedning
2+
These are stand alone scripts that will eventually be turned into PowerUpSQL functions.
33

4-
Author: Antti Rantasaari
5-
Source: Provided directly.
6-
Imported Scripts: Get-SQLServerLinkCrawl.ps1
7-
PowerUpSQL Functions: Pending Get-SQLServerLinkCrawl
8-
9-
Author: Scott Sutherland
10-
Source: Provided directly.
11-
Imported Scripts: Get-SQLServiceAccountPwHashes.ps1
12-
PowerUpSQL Functions: Pending - Invoke-SQLServerUncInject
13-
144
### 3rd Party Scripts
15-
16-
This folder contains scripts written by other authors which are used by some of the PowerUpSQL functions. Summary below.
17-
18-
Author: Warren F. (RamblingCookieMonster)
19-
Source: https://github.com/RamblingCookieMonster/Invoke-Parallel
20-
Imported Scripts: Invoke-Parallel.ps1
21-
PowerUpSQL Functions: Used for threaded functions.
22-
23-
Author: Kevin Robertson
24-
Source: https://github.com/Kevin-Robertson/Inveigh
25-
Imported Scripts: Inveigh.ps1, Inveigh-BruteForce.ps1, and Inveigh-Relay.ps1
26-
PowerUpSQL Functions: Used in Invoke-SQLAuditPrivXpDirtree and Invoke-SQLAuditXpPrivFileExist
27-
28-
Author: Joeseph Bailek
29-
Source: https://github.com/clymb3r/PowerShell/tree/master/Invoke-TokenManipulation
30-
Imported Scripts: Invoke-TokenManipulation.ps1
31-
PowerUpSQL Functions: Pending...
32-
33-
5+
This folder contains scripts written by other authors which are used by some of the PowerUpSQL functions.
346

357

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Script: Get-SQLCompactQuery
2+
# Pseudo Author: Scott Sutherland (@_nullbind), NetSPI 2016
3+
# This script is a slightly modified version of Jeremiah Clark's example code from the reference below.
4+
# Reference: https://blogs.msdn.microsoft.com/miah/2011/08/08/powershell-and-sql-server-compact-4-0-a-happy-mix/
5+
# Reference: https://technet.microsoft.com/en-us/library/gg592946(v=sql.110).aspx
6+
# Example: .\Get-SQLCompactQuery.ps1 -Query "SELECT TABLE_NAME from information_schema.tables" -DbFilePath c:\temp\file.sdf -Password SecretPassword!
7+
# Example: .\Get-SQLCompactQuery.ps1 -Query "SELECT TABLE_NAME, COLUMN_NAME from information_schema.columns" -DbFilePath c:\temp\file.sdf -Password SecretPassword!
8+
9+
[CmdletBinding()]
10+
Param(
11+
[Parameter(Mandatory=$false)]
12+
[string]$LibFilePath,
13+
14+
[Parameter(Mandatory=$true)]
15+
[string]$DbFilePath,
16+
17+
[Parameter(Mandatory=$false)]
18+
[string]$Password,
19+
20+
[Parameter(Mandatory=$false)]
21+
[string]$Query = "SELECT TABLE_NAME, COLUMN_NAME from information_schema.columns"
22+
)
23+
24+
# Define lib path
25+
if (-not $libpath){
26+
$libpath = "C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll"
27+
}
28+
29+
# Import required library
30+
[Reflection.Assembly]::LoadFile("$libpath") | Out-Null
31+
32+
# Setup up password if provided
33+
if($Password){
34+
$DbPass = ";Password=`"$Password`""
35+
}else{
36+
$DbPass = ""
37+
}
38+
39+
# Setup connection string
40+
$connString = "Data Source=`"$DbFilePath`"$DbPass"
41+
$cn = new-object "System.Data.SqlServerCe.SqlCeConnection" $connString
42+
43+
# Create the command
44+
$cmd = new-object "System.Data.SqlServerCe.SqlCeCommand"
45+
$cmd.CommandType = [System.Data.CommandType]"Text"
46+
$cmd.CommandText = "$Query"
47+
$cmd.Connection = $cn
48+
49+
# Create data table to store results
50+
$dt = new-object System.Data.DataTable
51+
52+
# Open connection
53+
$cn.Open()
54+
55+
# Run query
56+
$rdr = $cmd.ExecuteReader()
57+
58+
# Populate data table
59+
$dt.Load($rdr)
60+
$cn.Close()
61+
62+
# Return data
63+
$dt | Out-Default | Format-Table

0 commit comments

Comments
 (0)