Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Encoding #181

Merged
merged 4 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check-installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
}
IEX (IWR 'https://raw.githubusercontent.com/${{ github.event.pull_request.head.repo.full_name }}/${{ github.event.pull_request.head.ref }}/install-atomicsfolder.ps1' -UseBasicParsing);
Install-AtomicsFolder -Force
Invoke-AtomicTest All -ShowDetailsBrief
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running Invoke-AtomicTest to check whether the commands actually work after installing AtomicRedTeam

2 changes: 1 addition & 1 deletion Invoke-AtomicRedTeam.psd1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@{
@{

# Script module or binary module file associated with this manifest.
RootModule = 'Invoke-AtomicRedTeam.psm1'
Expand Down
2 changes: 1 addition & 1 deletion Invoke-AtomicRedTeam.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Foreach ($import in @($Public + $Private)) {
Catch {
Write-Error -Message "Failed to import function $($import.fullname): $_"
}
}
}
2 changes: 1 addition & 1 deletion PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
@{
ExcludeRules=@('PSUseSingularNouns',
'PSAvoidUsingWriteHost')
}
}
2 changes: 1 addition & 1 deletion Private/AtomicClassSchema.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ class AtomicTechnique {
[String[]] $attack_technique
[String] $display_name
[AtomicTest[]] $atomic_tests
}
}
4 changes: 2 additions & 2 deletions Private/Get-PrereqExecutor.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function Get-PrereqExecutor ($test) {
function Get-PrereqExecutor ($test) {
if ($nul -eq $test.dependency_executor_name) { $executor = $test.executor.name }
else { $executor = $test.dependency_executor_name }
$executor
}
}
4 changes: 2 additions & 2 deletions Private/Get-TargetInfo.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-TargetInfo($Session) {
function Get-TargetInfo($Session) {
$tmpDir = "$env:TEMP\"
$isElevated = $false
$targetHostname = hostname
Expand Down Expand Up @@ -40,4 +40,4 @@

}
$targetPlatform, $isElevated, $tmpDir, $targetHostname, $targetUser
}
}
2 changes: 1 addition & 1 deletion Private/Invoke-ExecuteCommand.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-ExecuteCommand ($finalCommand, $executor, $executionPlatform, $TimeoutSeconds, $session = $null, $interactive) {
function Invoke-ExecuteCommand ($finalCommand, $executor, $executionPlatform, $TimeoutSeconds, $session = $null, $interactive) {
$null = @(
if ($null -eq $finalCommand) { return 0 }
$finalCommand = $finalCommand.trim()
Expand Down
2 changes: 1 addition & 1 deletion Private/Invoke-Process.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Invoke-Process function is loosely based on code from https://github.com/guitarrapc/PowerShellUtil/blob/master/Invoke-Process/Invoke-Process.ps1
# The Invoke-Process function is loosely based on code from https://github.com/guitarrapc/PowerShellUtil/blob/master/Invoke-Process/Invoke-Process.ps1
function Invoke-Process {
[OutputType([PSCustomObject])]
[CmdletBinding()]
Expand Down
4 changes: 2 additions & 2 deletions Private/Show-Details.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-CleanupDescription() {
function Invoke-CleanupDescription() {
$ret1 = $test.description.ToString().trim() -replace '(?<!\n)\n(?!\n)', ' ' #replace single linefeeds with a space
$ret1 -replace '\n\n', "`n" #replace double linefeeds with a single linefeed
}
Expand Down Expand Up @@ -48,4 +48,4 @@ function Show-Details ($test, $testCount, $technique, $customInputArgs, $PathToA
# Footer
Write-Host -ForegroundColor Magenta "[!!!!!!!!END TEST!!!!!!!]`n`n"

}
}
2 changes: 1 addition & 1 deletion Private/Write-KeyValue.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ function Write-KeyValue ($key, $value) {
}
}
Write-Host ""
}
}
2 changes: 1 addition & 1 deletion Private/Write-PrereqResults.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ function Write-PrereqResults ($FailureReasons, $testId) {
Write-Host -ForegroundColor Cyan -NoNewline "-GetPrereqs"
Write-Host -ForegroundColor Yellow " switch"
}
}
}
2 changes: 1 addition & 1 deletion Public/Attire-ExecutionLogger.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Attire-ExecutionLogger.psm1
# Attire-ExecutionLogger.psm1
# Copyright 2023 Security Risk Advisors

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”),
Expand Down
4 changes: 2 additions & 2 deletions Public/Default-ExecutionLogger.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {

}

Expand Down Expand Up @@ -28,4 +28,4 @@ function Write-ExecutionLog($startTime, $stopTime, $technique, $testNum, $testNa

function Stop-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $isWindows) {

}
}
2 changes: 1 addition & 1 deletion Public/Get-AtomicTechnique.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
filter Get-AtomicTechnique {
filter Get-AtomicTechnique {
<#
.SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion Public/Get-PreferredIPAddress.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Get-PreferredIPAddress($isWindows) {
function Get-PreferredIPAddress($isWindows) {
if ($isWindows) {
return (Get-NetIPAddress | Where-Object { $_.PrefixOrigin -ne "WellKnown" }).IPAddress
}
Expand Down
4 changes: 2 additions & 2 deletions Public/Invoke-AtomicRunner.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
. "$PSScriptRoot\Invoke-RunnerScheduleMethods.ps1"
. "$PSScriptRoot\Invoke-RunnerScheduleMethods.ps1"

function Invoke-AtomicRunner {
[CmdletBinding(
Expand Down Expand Up @@ -247,4 +247,4 @@ function Invoke-AtomicRunner {
Rename-ThisComputer $tr $artConfig.basehostname

}
}
}
4 changes: 2 additions & 2 deletions Public/Invoke-AtomicTest.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-AtomicTest {
function Invoke-AtomicTest {
[CmdletBinding(DefaultParameterSetName = 'technique',
SupportsShouldProcess = $true,
PositionalBinding = $false,
Expand Down Expand Up @@ -526,4 +526,4 @@

} # End of PROCESS block
END { } # Intentionally left blank and can be removed
}
}
2 changes: 1 addition & 1 deletion Public/Invoke-FetchFromZip.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-FetchFromZip {
function Invoke-FetchFromZip {
Param(
[Parameter(Mandatory = $true, Position = 0)]
[String]
Expand Down
4 changes: 2 additions & 2 deletions Public/Invoke-KickoffAtomicRunner.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-KickoffAtomicRunner {
function Invoke-KickoffAtomicRunner {

#log rotation function
function Rotate-Log {
Expand Down Expand Up @@ -44,4 +44,4 @@ function LogRunnerMsg ($message) {
$now = "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
Write-Host -fore cyan $message
Add-Content $artConfig.logFile "$now`: $message"
}
}
4 changes: 2 additions & 2 deletions Public/Invoke-RunnerScheduleMethods.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Loop through all atomic yaml files to load into list of objects
# Loop through all atomic yaml files to load into list of objects
function Loop($fileList, $atomicType) {
$AllAtomicTests = New-Object System.Collections.ArrayList

Expand Down Expand Up @@ -142,4 +142,4 @@ function Invoke-RefreshExistingSchedule() {
$schedule = Get-ScheduleRefresh
$schedule | Export-Csv $artConfig.scheduleFile -NoTypeInformation
Write-Host -ForegroundColor Green "Refreshed schedule written to $($artConfig.scheduleFile)"
}
}
2 changes: 1 addition & 1 deletion Public/Invoke-SetupAtomicRunner.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-SetupAtomicRunner {
function Invoke-SetupAtomicRunner {

# ensure running with admin privs
if ($artConfig.OS -eq "windows") {
Expand Down
2 changes: 1 addition & 1 deletion Public/Invoke-WebRequestVerifyHash.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-WebRequestVerifyHash ($url, $outfile, $hash) {
function Invoke-WebRequestVerifyHash ($url, $outfile, $hash) {
$success = $false
$null = @(
New-Item -ItemType Directory (Split-Path $outfile) -Force | Out-Null
Expand Down
2 changes: 1 addition & 1 deletion Public/New-Atomic.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The class definitions that these functions rely upon are located in Private\AtomicClassSchema.ps1
# The class definitions that these functions rely upon are located in Private\AtomicClassSchema.ps1

function New-AtomicTechnique {
<#
Expand Down
4 changes: 2 additions & 2 deletions Public/Start-AtomicGUI.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Start-AtomicGUI {
function Start-AtomicGUI {
param (
[Int] $port = 8487
)
Expand Down Expand Up @@ -266,4 +266,4 @@
function Stop-AtomicGUI {
Get-UDDashboard -Name 'AtomicGUI' | Stop-UDDashboard
Write-Host "Stopped all AtomicGUI Dashboards"
}
}
2 changes: 1 addition & 1 deletion Public/Syslog-ExecutionLogger.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {

}

Expand Down
2 changes: 1 addition & 1 deletion Public/WinEvent-ExecutionLogger.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {
function Start-ExecutionLog($startTime, $logPath, $targetHostname, $targetUser, $commandLine, $isWindows) {
if ($isWindows -and -not [System.Diagnostics.EventLog]::Exists('Atomic Red Team')) {
New-EventLog -Source "Applications and Services Logs" -LogName "Atomic Red Team"
}
Expand Down
4 changes: 2 additions & 2 deletions Public/config.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


$artConfig = [PSCustomObject]@{

# [optional] These two configs are calculated programatically, you probably don't need to change them
Expand Down Expand Up @@ -113,4 +113,4 @@ $scriptParam = @{
Name = "logFile"
Value = { Join-Path $artConfig.atomicLogsPath "log-$($artConfig.basehostname).txt" }
}
Add-Member @scriptParam
Add-Member @scriptParam
2 changes: 1 addition & 1 deletion docker/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Write-Output @"
Import-Module "$ARTPath/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force;
`$PSDefaultParameterValues`["Invoke-AtomicTest:PathToAtomicsFolder"] = "$ARTPath/atomics";
`$PSDefaultParameterValues`["Invoke-AtomicTest:ExecutionLogPath"]="1.csv";
"@ > $PROFILE
"@ > $PROFILE
4 changes: 2 additions & 2 deletions sandbox/setupsandbox.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Set-ExecutionPolicy Bypass -Scope Process -Force;
Set-ExecutionPolicy Bypass -Scope Process -Force;
Write-Host "Installing NuGet"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Write-Host "Installing Atomic Red Team"
Expand All @@ -15,4 +15,4 @@ Import-Module "$ARTPath/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force;

. $PROFILE

Set-Location C:\AtomicRedTeam
Set-Location C:\AtomicRedTeam
Loading