Upload files to 'tasks/Зашифрованный файл/Исходники'
This commit is contained in:
parent
26c8ee6778
commit
35411f7b7d
2 changed files with 32 additions and 0 deletions
31
tasks/Зашифрованный файл/Исходники/encrypt_file.cpp
Normal file
31
tasks/Зашифрованный файл/Исходники/encrypt_file.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
const int maxsize = 33;
|
||||||
|
char line[maxsize+1];
|
||||||
|
char ans[maxsize+1];
|
||||||
|
FILE * file;
|
||||||
|
|
||||||
|
void copying() {
|
||||||
|
for (int i = 0; i < maxsize; ++i) {
|
||||||
|
ans[i] = line[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void orexclusive() {
|
||||||
|
for (int i = 0; i < maxsize; i+=2, ans[i]^='^'-'|'+'&') {}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * argv[]) {
|
||||||
|
file = fopen("flag.txt", "r");
|
||||||
|
if (file == NULL)
|
||||||
|
printf("File does not exist!\n");
|
||||||
|
else {
|
||||||
|
fgets(line, maxsize+1, file);
|
||||||
|
copying();
|
||||||
|
orexclusive();
|
||||||
|
printf("%s\n", ans);
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
1
tasks/Зашифрованный файл/Исходники/flag.txt
Normal file
1
tasks/Зашифрованный файл/Исходники/flag.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ctf{th1s_x0r_1s_s1mpl3}
|
Loading…
Reference in a new issue