From a0ba29cd43b53c149b052658f5d142e58b2e87f7 Mon Sep 17 00:00:00 2001 From: George Allen Date: Sun, 21 Nov 2021 17:01:26 +0000 Subject: [PATCH] adds new tests for compiling C,CC,Go --- atomics/T1027.004/T1027.004.yaml | 75 ++++++++++++++++++++++++- atomics/T1027.004/src/T1027-004-test.c | 6 ++ atomics/T1027.004/src/T1027-004-test.cc | 5 ++ atomics/T1027.004/src/T1027-004-test.go | 7 +++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 atomics/T1027.004/src/T1027-004-test.c create mode 100644 atomics/T1027.004/src/T1027-004-test.cc create mode 100644 atomics/T1027.004/src/T1027-004-test.go diff --git a/atomics/T1027.004/T1027.004.yaml b/atomics/T1027.004/T1027.004.yaml index 541dc48b..27dc3418 100644 --- a/atomics/T1027.004/T1027.004.yaml +++ b/atomics/T1027.004/T1027.004.yaml @@ -57,4 +57,77 @@ atomic_tests: executor: command: | Invoke-Expression #{input_file} - name: powershell \ No newline at end of file + name: powershell + +- name: C compile + description: | + Compile a c file with either gcc or clang on Linux or Macos. + supported_platforms: + - linux + - macos + input_arguments: + input_file: + description: source file + type: Path + default: PathToAtomicsFolder/T1027.004/src/T1027-004-test.c + dependency_executor_name: powershell + dependencies: + - description: | + the source file must exist on disk at specified location (#{input_file}) + prereq_command: | + if (Test-Path #{input_file}) {exit 0} else {exit 1} + get_prereq_command: | + Invoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.c -OutFile #{input_file} + executor: + command: | + gcc #{input_file} && ./a.out + clang #{input_file} && ./a.out + name: bash +- name: CC compile + description: | + Compile a c file with either gcc or clang on Linux or Macos. + supported_platforms: + - linux + - macos + input_arguments: + input_file: + description: source file + type: Path + default: PathToAtomicsFolder/T1027.004/src/T1027-004-test.cc + dependency_executor_name: powershell + dependencies: + - description: | + the source file must exist on disk at specified location (#{input_file}) + prereq_command: | + if (Test-Path #{input_file}) {exit 0} else {exit 1} + get_prereq_command: | + Invoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.c -OutFile #{input_file} + executor: + command: | + g++ #{input_file} && ./a.out + clang++ #{input_file} && ./a.out + name: bash +- name: Go compile + description: | + Compile a c file with either gcc or clang on Linux or Macos. + supported_platforms: + - linux + - macos + input_arguments: + input_file: + description: source file + type: Path + default: PathToAtomicsFolder/T1027.004/src/T1027-004-test.go + dependency_executor_name: powershell + dependencies: + - description: | + the source file must exist on disk at specified location (#{input_file}) + prereq_command: | + if (Test-Path #{input_file}) {exit 0} else {exit 1} + get_prereq_command: | + Invoke-WebRequest https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1027.004/src/T1027-004-test.c -OutFile #{input_file} + executor: + command: | + go run #{input_file} + name: bash + diff --git a/atomics/T1027.004/src/T1027-004-test.c b/atomics/T1027.004/src/T1027-004-test.c new file mode 100644 index 00000000..f51330e7 --- /dev/null +++ b/atomics/T1027.004/src/T1027-004-test.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("T1027-004-test.c has compiled and executed"); + return 0; +} diff --git a/atomics/T1027.004/src/T1027-004-test.cc b/atomics/T1027.004/src/T1027-004-test.cc new file mode 100644 index 00000000..d6cce944 --- /dev/null +++ b/atomics/T1027.004/src/T1027-004-test.cc @@ -0,0 +1,5 @@ +#include +int main() { + std::cout << "T1027-004-test.cc has compiled and executed\n"; + return 0; +} diff --git a/atomics/T1027.004/src/T1027-004-test.go b/atomics/T1027.004/src/T1027-004-test.go new file mode 100644 index 00000000..e99b0276 --- /dev/null +++ b/atomics/T1027.004/src/T1027-004-test.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("T1027-004-test.go has compiled and executed") +}