From a35a3046bff1c2509aaa53165aa13af85b17c457 Mon Sep 17 00:00:00 2001 From: mauricelambert <50479118+mauricelambert@users.noreply.github.com> Date: Tue, 15 Mar 2022 22:41:36 +0100 Subject: [PATCH] First commit --- EicarSpam.c | 27 +++++++++++ EicarSpam.go | 29 +++++++++++ EicarSpam.pl | 6 +++ EicarSpam.ps1 | 5 ++ EicarSpam.py | 5 ++ EicarSpam.rb | 7 +++ EicarSpam.sh | 6 +++ README.md | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 217 insertions(+) create mode 100644 EicarSpam.c create mode 100644 EicarSpam.go create mode 100644 EicarSpam.pl create mode 100644 EicarSpam.ps1 create mode 100644 EicarSpam.py create mode 100644 EicarSpam.rb create mode 100644 EicarSpam.sh create mode 100644 README.md diff --git a/EicarSpam.c b/EicarSpam.c new file mode 100644 index 0000000..a068f06 --- /dev/null +++ b/EicarSpam.c @@ -0,0 +1,27 @@ +#include + +int main() { + FILE *file; + char filename[12]; + + for(int i = 0; i < 300; i++) { + snprintf(filename, 12, "test%d.txt", i); + file = fopen(filename, "w"); + + if(file == NULL) { + printf("file can't be opened\n"); + return 1; + } + + fprintf( + file, + "%sEICAR-STANDARD-ANTIVIRUS-TEST-FILE%s", + "X5O!P%@AP[4\\PZX54(P^)7CC)7}$", + "!$H+H*" + ); + } + + fclose(file); + + return 0; +} \ No newline at end of file diff --git a/EicarSpam.go b/EicarSpam.go new file mode 100644 index 0000000..f5924d7 --- /dev/null +++ b/EicarSpam.go @@ -0,0 +1,29 @@ +package main + +import ( + "log" + "os" + "fmt" +) + + +func main() { + var datas [3]string + datas[0] = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$" + datas[1] = "EICAR-STANDARD-ANTIVIRUS-TEST-FILE" + datas[2] = "!$H+H*" + + for i := 0; i < 300; i++ { + file, err := os.Create(fmt.Sprintf("./test%d.txt", i)) + + if err != nil { + log.Fatal(err) + } + + defer file.Close() + + for _, data := range datas { + file.WriteString(data) + } + } +} \ No newline at end of file diff --git a/EicarSpam.pl b/EicarSpam.pl new file mode 100644 index 0000000..a0ac91a --- /dev/null +++ b/EicarSpam.pl @@ -0,0 +1,6 @@ +foreach my $i ((1..300)) { + # open a filehandle for your file + open my $file, '>', "test$i.txt" or die "test$i.txt: $!"; + printf $file '%sEICAR-STANDARD-ANTIVIRUS-TEST-FILE%s', 'X5O!P%@AP[4\PZX54(P^)7CC)7}$', '!$H+H*'; + close $file; +} \ No newline at end of file diff --git a/EicarSpam.ps1 b/EicarSpam.ps1 new file mode 100644 index 0000000..144fb4b --- /dev/null +++ b/EicarSpam.ps1 @@ -0,0 +1,5 @@ +$string = 'X5O!P%@AP[4\PZX54(P^)7CC)7}$_!$H+H*'.replace('_', 'EICAR-STANDARD-ANTIVIRUS-TEST-FILE') + +for($i = 0; $i -lt 300; $i++){ + Set-Content "test$i.txt" $string +} \ No newline at end of file diff --git a/EicarSpam.py b/EicarSpam.py new file mode 100644 index 0000000..fb34c0a --- /dev/null +++ b/EicarSpam.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +for a in range(300): + with open(f"test{a}","w") as f: + _ = f.write("X5O!P%@AP[4\\PZX54(P^)7CC)7}$_!$H+H*".replace("_", "EICAR-STANDARD-ANTIVIRUS-TEST-FILE")) \ No newline at end of file diff --git a/EicarSpam.rb b/EicarSpam.rb new file mode 100644 index 0000000..9bba461 --- /dev/null +++ b/EicarSpam.rb @@ -0,0 +1,7 @@ +300.times { + |i| File.open("tmp#{i}.txt", 'w') do |f| + f.write('X5O!P%@AP[4\PZX54(P^)7CC)7}$') + f.write('EICAR-STANDARD-ANTIVIRUS-TEST-FILE') + f.write('!$H+H*') + end +} \ No newline at end of file diff --git a/EicarSpam.sh b/EicarSpam.sh new file mode 100644 index 0000000..41cee91 --- /dev/null +++ b/EicarSpam.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +a='X5O!P%@AP[4\PZX54(P^)7CC)7}$_!$H+H*' +for i in {0..300}; do + echo "${a/_/EICAR-STANDARD-ANTIVIRUS-TEST-FILE}" > "test${i}.txt" +done \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6a0462e --- /dev/null +++ b/README.md @@ -0,0 +1,132 @@ +# Tests antivirus + +## Python + +```python +for a in range(300): + with open(f"test{a}","w") as f: + _ = f.write("X5O!P%@AP[4\\PZX54(P^)7CC)7}$_!$H+H*".replace("_", "EICAR-STANDARD-ANTIVIRUS-TEST-FILE")) +``` + +## Powershell + +```powershell +$string = 'X5O!P%@AP[4\PZX54(P^)7CC)7}$_!$H+H*'.replace('_', 'EICAR-STANDARD-ANTIVIRUS-TEST-FILE') + +for($i = 0; $i -lt 300; $i++){ + Set-Content "test$i.txt" $string +} +``` + +## Bash + +```bash +a='X5O!P%@AP[4\PZX54(P^)7CC)7}$_!$H+H*' +for i in {0..300}; do + echo "${a/_/EICAR-STANDARD-ANTIVIRUS-TEST-FILE}" > "test${i}.txt" +done +``` + +```bash +echo 'X5O!P%@AP[4\PZX54(P^)7CC)7}$'"EICAR-STANDARD-ANTIVIRUS-TEST-FILE"'!$H+H*' > "test.txt" +``` + +## Batch + +```bash +@echo off +SET a=X5O!P%@AP[4\PZX54(P^)7CC)7}$ +SET b=EICAR-STANDARD-ANTIVIRUS-TEST-FILE +SET c=!$H+H* + +for /L %D in (1,1,300) do echo %a%%b%%c% > test%D.txt +``` + +## Ruby + +```rb +300.times { + |i| File.open("tmp#{i}.txt", 'w') do |f| + f.write('X5O!P%@AP[4\PZX54(P^)7CC)7}$') + f.write('EICAR-STANDARD-ANTIVIRUS-TEST-FILE') + f.write('!$H+H*') + end +} +``` + +## Perl + +```perl +foreach my $i ((1..300)) { + # open a filehandle for your file + open my $file, '>', "test$i.txt" or die "test$i.txt: $!"; + printf $file '%sEICAR-STANDARD-ANTIVIRUS-TEST-FILE%s', 'X5O!P%@AP[4\PZX54(P^)7CC)7}$', '!$H+H*'; + close $file; +} +``` + +## Go + +```go +package main + +import ( + "log" + "os" + "fmt" +) + + +func main() { + var datas [3]string + datas[0] = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$" + datas[1] = "EICAR-STANDARD-ANTIVIRUS-TEST-FILE" + datas[2] = "!$H+H*" + + for i := 0; i < 300; i++ { + file, err := os.Create(fmt.Sprintf("./test%d.txt", i)) + + if err != nil { + log.Fatal(err) + } + + defer file.Close() + + for _, data := range datas { + file.WriteString(data) + } + } +} +``` + +## C + +```c +#include + +int main() { + FILE *file; + char filename[12]; + + for(int i = 0; i < 300; i++) { + snprintf(filename, 12, "test%d.txt", i); + file = fopen(filename, "w"); + + if(file == NULL) { + printf("file can't be opened\n"); + return 1; + } + + fprintf( + file, + "%sEICAR-STANDARD-ANTIVIRUS-TEST-FILE%s", + "X5O!P%@AP[4\\PZX54(P^)7CC)7}$", + "!$H+H*" + ); + } + + fclose(file); + + return 0; +} +``` \ No newline at end of file