-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
240 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
$repo_base="" | ||
$mythic_code="Payload_Type/thanatos/mythic" | ||
$agent_code="Payload_Type/thanatos/agent" | ||
|
||
|
||
function Get-RepoBase { | ||
$repo_base_dir = Split-Path -Path "$PSScriptRoot/../.." -Resolve | ||
if (-Not (Test-Path -Path "$repo_base_dir/.git")) { | ||
Write-Host "Could not find git repository base" | ||
Exit 1 | ||
} | ||
|
||
$repo_base = $repo_base_dir | ||
} | ||
|
||
function Check-FormatRequirements { | ||
Get-Command gofmt -ErrorAction Stop | Out-Null | ||
Get-Command cargo -ErrorAction Stop | Out-Null | ||
} | ||
|
||
function CheckFormat { | ||
Write-Host "[*] Running code format checks" | ||
|
||
Write-Host "[*] Agent code" | ||
Push-Location -Path $agent_code | ||
$cmd = "cargo build -p genconfig && cargo fmt --all -- --color always --check" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
} | ||
|
||
Get-RepoBase | ||
Check-FormatRequirements | ||
Push-Location $repo_base | ||
CheckFormat | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$repo_base="" | ||
$mythic_code="Payload_Type/thanatos/mythic" | ||
$agent_code="Payload_Type/thanatos/agent" | ||
|
||
|
||
function Get-RepoBase { | ||
$repo_base_dir = Split-Path -Path "$PSScriptRoot/../.." -Resolve | ||
if (-Not (Test-Path -Path "$repo_base_dir/.git")) { | ||
Write-Host "Could not find git repository base" | ||
Exit 1 | ||
} | ||
|
||
$repo_base = $repo_base_dir | ||
} | ||
|
||
Get-RepoBase | ||
Push-Location $repo_base | ||
./.github/scripts/windows/checkformat.ps1 | ||
./.github/scripts/windows/lint.ps1 | ||
./.github/scripts/windows/test.ps1 | ||
./.github/scripts/windows/sanitizers.ps1 | ||
|
||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$repo_base="" | ||
$mythic_code="Payload_Type/thanatos/mythic" | ||
$agent_code="Payload_Type/thanatos/agent" | ||
|
||
|
||
function Get-RepoBase { | ||
$repo_base_dir = Split-Path -Path "$PSScriptRoot/../.." -Resolve | ||
if (-Not (Test-Path -Path "$repo_base_dir/.git")) { | ||
Write-Host "Could not find git repository base" | ||
Exit 1 | ||
} | ||
|
||
$repo_base = $repo_base_dir | ||
} | ||
|
||
function Check-LintRequirements { | ||
Get-Command golangci-lint -ErrorAction Stop | Out-Null | ||
cargo clippy -V | Out-Null | ||
} | ||
|
||
function Lint { | ||
Write-Host "[*] Running lint checks" | ||
|
||
Write-Host "[*] Mythic code" | ||
Push-Location -Path $mythic_code | ||
$cmd = "golangci-lint run" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
|
||
Write-Host "[*] Agent code" | ||
Push-Location -Path $agent_code | ||
$cmd = "cargo build -p genconfig && cargo clippy --workspace --color always --all-features --all-targets -- -D warnings" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
} | ||
|
||
Get-RepoBase | ||
Check-LintRequirements | ||
Push-Location $repo_base | ||
Lint | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
$repo_base="" | ||
$mythic_code="Payload_Type/thanatos/mythic" | ||
$agent_code="Payload_Type/thanatos/agent" | ||
|
||
|
||
function Get-RepoBase { | ||
$repo_base_dir = Split-Path -Path "$PSScriptRoot/../.." -Resolve | ||
if (-Not (Test-Path -Path "$repo_base_dir/.git")) { | ||
Write-Host "Could not find git repository base" | ||
Exit 1 | ||
} | ||
|
||
$repo_base = $repo_base_dir | ||
} | ||
|
||
function Check-SanitizerRequirements { | ||
Get-Command go -ErrorAction Stop | Out-Null | ||
Get-Command cargo -ErrorAction Stop | Out-Null | ||
cargo +nightly -V | Out-Null | ||
Get-Command Get-VSSetupInstance -ErrorAction Stop | Out-Null | ||
Get-VSSetupInstance | Select-VSSetupInstance -Require Microsoft.VisualStudio.Component.VC.ASAN | Out-Null | ||
} | ||
|
||
function Sanitizers { | ||
Write-Host "[*] Running sanitizer tests" | ||
|
||
$vspath = (Get-VSSetupInstance | Select-VSSetupInstance -Require Microsoft.VisualStudio.Component.VC.ASAN).InstallationPath | ||
Import-Module $vspath/Common7/Tools/Microsoft.VisualStudio.DevShell.dll | ||
Enter-VsDevShell -VsInstallPath $vspath -SkipAutomaticLocation | Out-Null | ||
|
||
if (-Not ($env:PATH -contains "$env:VCToolsInstallDir/bin/Hostx64/x64")) { | ||
$env:PATH="$env:PATH;$env:VCToolsInstallDir/bin/Hostx64/x64" | ||
} | ||
|
||
Push-Location -Path $agent_code | ||
$env:RUSTFLAGS = "-Zsanitizer=address" | ||
$env:CARGO_INCREMENTAL = "0" | ||
$cmd = "cargo +nightly test --color always -p ffiwrappers --all-features --target x86_64-pc-windows-msvc" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
|
||
Remove-Item env:RUSTFLAGS | ||
Remove-Item env:CARGO_INCREMENTAL | ||
} | ||
|
||
Get-RepoBase | ||
Check-SanitizerRequirements | ||
Push-Location $repo_base | ||
Sanitizers | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
$repo_base="" | ||
$mythic_code="Payload_Type/thanatos/mythic" | ||
$agent_code="Payload_Type/thanatos/agent" | ||
|
||
|
||
function Get-RepoBase { | ||
$repo_base_dir = Split-Path -Path "$PSScriptRoot/../.." -Resolve | ||
if (-Not (Test-Path -Path "$repo_base_dir/.git")) { | ||
Write-Host "Could not find git repository base" | ||
Exit 1 | ||
} | ||
|
||
$repo_base = $repo_base_dir | ||
} | ||
|
||
function Check-TestRequirements { | ||
Get-Command go -ErrorAction Stop | Out-Null | ||
Get-Command cargo -ErrorAction Stop | Out-Null | ||
} | ||
|
||
function Test { | ||
Write-Host "[*] Running tests" | ||
|
||
Write-Host "[*] Mythic code" | ||
Push-Location -Path $mythic_code | ||
$cmd = "go test ./commands/..." | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
|
||
$cmd = "go test -run `"^TestPayloadMockBuild/`" ./builder" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
|
||
Write-Host "[*] Agent code" | ||
Push-Location -Path $agent_code | ||
$cmd = "cargo build -p genconfig && cargo test --color always --workspace --exclude genconfig --all-features" | ||
Write-Host "current directory: $pwd" | ||
Write-Host "command: $cmd" | ||
Invoke-Expression -Command $cmd | ||
Pop-Location | ||
} | ||
|
||
Get-RepoBase | ||
Check-TestRequirements | ||
Push-Location $repo_base | ||
Test | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters