ADD week 4

This commit is contained in:
2025-03-31 16:31:52 +02:00
parent 84135a321e
commit 86f265f22d
119 changed files with 2243 additions and 0 deletions

0
02-Easy4/E4 Normal file → Executable file
View File

26
02-Easy4/E4.txt Normal file
View File

@ -0,0 +1,26 @@
1. Was this executable stripped?
yes
2. How are the password checking functionalities entangled with the operating system?
3. What is the algorithm used to check the validity of a password?
4. Can you break this password checker, i.e., implementing a generator of valid passwords? You must send 16 different valid passwords by email to pascal+sre25@mod-p.ch before Mar. 24th, 2025, 12h00 CET to validate this lab and get 5 points.
3A3A3A3A3A3A
3A4B5C6D7E8F
SaSaSaSaSaSa
SaTbUcVdWeXf
+9+9+9+9+9+9
+99GGUUccq4B
!//==KKYYggu
>L3AGUES3AN\
HVESDRHVESDR
8F7E6D5C4B3A
XfWeVdUcTbSa
4BcqUcGU9G+9
guYgKY=K/=!/
N\3AESGU3A>L
DRESHVDRESHV
#1HVESLZP^#1

61
02-Easy4/code.c Normal file
View File

@ -0,0 +1,61 @@
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
static char* input_pw;
static char return_check_pw;
void check_pw(void) {
uint8_t bVar1;
char *pcVar2;
char *pcVar3;
bVar1 = 0;
pcVar2 = input_pw;
do {
pcVar3 = pcVar2 + 2;
bVar1 = bVar1 | ((pcVar2[1] - 14) - pcVar2[0]);
pcVar2 = pcVar3;
} while (input_pw + 12 != pcVar3);
return_check_pw = (int)(char)bVar1;
return;
}
void print_check_pw(void) {
if (return_check_pw != 0) {
fwrite("\nWrong password ! Try again...\n\n",1,0x20,stderr);
return;
}
fprintf(stderr,"\nCongratulations ! A right password is indeed %s :-)\n\n",input_pw);
return;
}
uint64_t main(int param_1,char* *param_2) {
char *__s;
size_t sVar1;
if (param_1 == 2) {
__s = (char *)param_2[1];
sVar1 = strlen(__s);
if (sVar1 == 12) {
input_pw = __s;
signal(10,check_pw);
signal(12,print_check_pw);
kill(0,10);
kill(0,12);
return 0;
}
fwrite("\nWrong password ! Try again...\n\n",1,0x20,stderr);
} else {
fwrite("\nMSE-SRE Challenge E4 --- Enjoy !\n",1,0x22,stderr);
fwrite("\nWhat I need is 1024 passwords passing the check!\n",1,0x32,stderr);
fprintf(stderr,"\nUsage: %s <password>\n\n",*param_2);
}
return 1;
}