diff --git a/01-VeryEasy2/VE2 b/01-VeryEasy2/VE2 old mode 100644 new mode 100755 diff --git a/01-VeryEasy2/VE2.gpr b/01-VeryEasy2/VE2.gpr new file mode 100644 index 0000000..e69de29 diff --git a/01-VeryEasy2/VE2.rep/idata/00/00000000.prp b/01-VeryEasy2/VE2.rep/idata/00/00000000.prp new file mode 100644 index 0000000..d00260e --- /dev/null +++ b/01-VeryEasy2/VE2.rep/idata/00/00000000.prp @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/01-VeryEasy2/VE2.rep/idata/00/~00000000.db/db.2.gbf b/01-VeryEasy2/VE2.rep/idata/00/~00000000.db/db.2.gbf new file mode 100644 index 0000000..b644cfc Binary files /dev/null and b/01-VeryEasy2/VE2.rep/idata/00/~00000000.db/db.2.gbf differ diff --git a/01-VeryEasy2/VE2.rep/idata/~index.bak b/01-VeryEasy2/VE2.rep/idata/~index.bak new file mode 100644 index 0000000..aa1d2b8 --- /dev/null +++ b/01-VeryEasy2/VE2.rep/idata/~index.bak @@ -0,0 +1,5 @@ +VERSION=1 +/ + 00000000:VE2:a801f6fb66758882284485789 +NEXT-ID:1 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.rep/idata/~index.dat b/01-VeryEasy2/VE2.rep/idata/~index.dat new file mode 100644 index 0000000..aa1d2b8 --- /dev/null +++ b/01-VeryEasy2/VE2.rep/idata/~index.dat @@ -0,0 +1,5 @@ +VERSION=1 +/ + 00000000:VE2:a801f6fb66758882284485789 +NEXT-ID:1 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.rep/project.prp b/01-VeryEasy2/VE2.rep/project.prp new file mode 100644 index 0000000..563fc3a --- /dev/null +++ b/01-VeryEasy2/VE2.rep/project.prp @@ -0,0 +1,6 @@ + + + + + + diff --git a/01-VeryEasy2/VE2.rep/projectState b/01-VeryEasy2/VE2.rep/projectState new file mode 100644 index 0000000..4fbda3a --- /dev/null +++ b/01-VeryEasy2/VE2.rep/projectState @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/01-VeryEasy2/VE2.rep/user/00/00000000.prp b/01-VeryEasy2/VE2.rep/user/00/00000000.prp new file mode 100644 index 0000000..4ef1f62 --- /dev/null +++ b/01-VeryEasy2/VE2.rep/user/00/00000000.prp @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/01-VeryEasy2/VE2.rep/user/00/~00000000.db/db.1.gbf b/01-VeryEasy2/VE2.rep/user/00/~00000000.db/db.1.gbf new file mode 100644 index 0000000..c4d03d1 Binary files /dev/null and b/01-VeryEasy2/VE2.rep/user/00/~00000000.db/db.1.gbf differ diff --git a/01-VeryEasy2/VE2.rep/user/~index.bak b/01-VeryEasy2/VE2.rep/user/~index.bak new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/01-VeryEasy2/VE2.rep/user/~index.bak @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.rep/user/~index.dat b/01-VeryEasy2/VE2.rep/user/~index.dat new file mode 100644 index 0000000..bcc2d06 --- /dev/null +++ b/01-VeryEasy2/VE2.rep/user/~index.dat @@ -0,0 +1,5 @@ +VERSION=1 +/ + 00000000:udf_a801f6fb66758882284485789:a801f6fa08361347999654449 +NEXT-ID:1 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.rep/user/~journal.bak b/01-VeryEasy2/VE2.rep/user/~journal.bak new file mode 100644 index 0000000..88aa52b --- /dev/null +++ b/01-VeryEasy2/VE2.rep/user/~journal.bak @@ -0,0 +1,2 @@ +IADD:00000000:/udf_a801f6fb66758882284485789 +IDSET:/udf_a801f6fb66758882284485789:a801f6fa08361347999654449 diff --git a/01-VeryEasy2/VE2.rep/versioned/~index.bak b/01-VeryEasy2/VE2.rep/versioned/~index.bak new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/01-VeryEasy2/VE2.rep/versioned/~index.bak @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.rep/versioned/~index.dat b/01-VeryEasy2/VE2.rep/versioned/~index.dat new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/01-VeryEasy2/VE2.rep/versioned/~index.dat @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/01-VeryEasy2/VE2.txt b/01-VeryEasy2/VE2.txt new file mode 100644 index 0000000..17a5589 --- /dev/null +++ b/01-VeryEasy2/VE2.txt @@ -0,0 +1,8 @@ +1. Was this executable compiled with debugging symbols? +yes, with debug_info + +2. How is protected the secret password hard-coded into this executable? +By shift of 'W' + +3. What is the secret password hard-coded into this executable? You must send this value by email to pascal+sre25@mod-p.ch before Mar. 3rd, 2025, 12h00 CET to validate this lab and get 1 point. +JSHGnQumN+sQ \ No newline at end of file diff --git a/01-VeryEasy2/code.c b/01-VeryEasy2/code.c new file mode 100644 index 0000000..01e032d --- /dev/null +++ b/01-VeryEasy2/code.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include + +char ENCSECRETPASSWORD[]; + +int main(int param_1, char* *param_2) { + int8_t output_value; + size_t input_length; + char acStack_19 [13]; + + if (param_1 == 2) { + input_length = strlen((char *)param_2[1]); + if (input_length == 12) { + for (uint8_t i = 0; i < 13; i++) { + acStack_19[i] = ENCSECRETPASSWORD[i] + 'W'; // JSHGnQumN+sQ + //f3 fc f1 f0 17 fa 1e 16 f7 d4 1c fa a9 + // + + } + for (uint8_t i = 0; i < 13; i++) { + if (acStack_19[i] != *(char *)((long)i + param_2[1])) { + fwrite("\nWrong password ! Try again...\n\n",1,32,stderr); + return 1; + } + } + fprintf(stderr,"\nCongratulations ! The right password is indeed %s :-)\n\n",param_2[1]); + output_value = 35; + } + else { + fwrite("\nWrong password ! Try again...\n\n",1,32,stderr); + output_value = 1; + } + } + else { + fwrite("\nMSE-SRE Challenge VE2 --- Enjoy !\n",1,35,stderr); + fprintf(stderr,"\nUsage: %s \n\n",*param_2); + output_value = 1; + } + return output_value; +} \ No newline at end of file diff --git a/01-VeryEasy2/foo.c b/01-VeryEasy2/foo.c new file mode 100644 index 0000000..cbb186d --- /dev/null +++ b/01-VeryEasy2/foo.c @@ -0,0 +1,16 @@ +#include +#include + +int main() { + char foo[14] = {0xf3, 0xfc, 0xf1, 0xf0, 0x17, 0xfa, 0x1e, 0x16, 0xf7, 0xd4, 0x1c, 0xfa, 0xa9, '\0'}; + for (uint8_t i = 0; i<13; i++) { + foo[i] += 'W'; + } + foo[13] = '\0'; + printf("%s \r\t", foo); + return 0; +} + +void myfunc(int a, ...) { + +} diff --git a/02-Easy2/E2 b/02-Easy2/E2 old mode 100644 new mode 100755 diff --git a/02-Easy2/E2.gpr b/02-Easy2/E2.gpr new file mode 100644 index 0000000..e69de29 diff --git a/02-Easy2/E2.rep/idata/00/00000000.prp b/02-Easy2/E2.rep/idata/00/00000000.prp new file mode 100644 index 0000000..3c941bf --- /dev/null +++ b/02-Easy2/E2.rep/idata/00/00000000.prp @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/02-Easy2/E2.rep/idata/00/~00000000.db/db.2.gbf b/02-Easy2/E2.rep/idata/00/~00000000.db/db.2.gbf new file mode 100644 index 0000000..92caf86 Binary files /dev/null and b/02-Easy2/E2.rep/idata/00/~00000000.db/db.2.gbf differ diff --git a/02-Easy2/E2.rep/idata/~index.bak b/02-Easy2/E2.rep/idata/~index.bak new file mode 100644 index 0000000..a46b23d --- /dev/null +++ b/02-Easy2/E2.rep/idata/~index.bak @@ -0,0 +1,5 @@ +VERSION=1 +/ + 00000000:E2:c0a82eeaa7971421479596701 +NEXT-ID:1 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/02-Easy2/E2.rep/idata/~index.dat b/02-Easy2/E2.rep/idata/~index.dat new file mode 100644 index 0000000..a46b23d --- /dev/null +++ b/02-Easy2/E2.rep/idata/~index.dat @@ -0,0 +1,5 @@ +VERSION=1 +/ + 00000000:E2:c0a82eeaa7971421479596701 +NEXT-ID:1 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/02-Easy2/E2.rep/project.prp b/02-Easy2/E2.rep/project.prp new file mode 100644 index 0000000..563fc3a --- /dev/null +++ b/02-Easy2/E2.rep/project.prp @@ -0,0 +1,6 @@ + + + + + + diff --git a/02-Easy2/E2.rep/projectState b/02-Easy2/E2.rep/projectState new file mode 100644 index 0000000..cf54059 --- /dev/null +++ b/02-Easy2/E2.rep/projectState @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/02-Easy2/E2.rep/user/00/00000000.prp b/02-Easy2/E2.rep/user/00/00000000.prp new file mode 100644 index 0000000..d4c98e3 --- /dev/null +++ b/02-Easy2/E2.rep/user/00/00000000.prp @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/02-Easy2/E2.rep/user/00/~00000000.db/db.1.gbf b/02-Easy2/E2.rep/user/00/~00000000.db/db.1.gbf new file mode 100644 index 0000000..70fa073 Binary files /dev/null and b/02-Easy2/E2.rep/user/00/~00000000.db/db.1.gbf differ diff --git a/02-Easy2/E2.rep/user/~index.dat b/02-Easy2/E2.rep/user/~index.dat new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/02-Easy2/E2.rep/user/~index.dat @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/02-Easy2/E2.rep/user/~journal.dat b/02-Easy2/E2.rep/user/~journal.dat new file mode 100644 index 0000000..9e1a030 --- /dev/null +++ b/02-Easy2/E2.rep/user/~journal.dat @@ -0,0 +1,2 @@ +IADD:00000000:/udf_c0a82eeaa7971421479596701 +IDSET:/udf_c0a82eeaa7971421479596701:c0a82ee8e31106056027371797 diff --git a/02-Easy2/E2.rep/versioned/~index.bak b/02-Easy2/E2.rep/versioned/~index.bak new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/02-Easy2/E2.rep/versioned/~index.bak @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/02-Easy2/E2.rep/versioned/~index.dat b/02-Easy2/E2.rep/versioned/~index.dat new file mode 100644 index 0000000..b1e697f --- /dev/null +++ b/02-Easy2/E2.rep/versioned/~index.dat @@ -0,0 +1,4 @@ +VERSION=1 +/ +NEXT-ID:0 +MD5:d41d8cd98f00b204e9800998ecf8427e diff --git a/02-Easy2/E2.txt b/02-Easy2/E2.txt new file mode 100644 index 0000000..73a55ec --- /dev/null +++ b/02-Easy2/E2.txt @@ -0,0 +1,130 @@ +1. What is the algorithm used to check the validity of a password? +```c +for (int i = 0; i < 4; i++) { + Seed[i] ^= password[i] ^ password[i + 4] ^ password[i + 8]; +} +``` + +2. 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. 3rd, 2025, 12h00 CET to validate this lab and get 5 points. +c.f. text.c +remiB1RUZO10 +l96nhRI/npqM +hRI/npqMl96n +npqMl96nhRI/ +mjwdb6V1eG/Y +P6TsnIh8Td2G +Imdln4Z1MB0Q +YqgwfAXMU+16 +dE+BV2wwXlR9 +x130TYTwFsiK +OOYaH3gYmg04 +ta8aw8wYiBA4 +9MS867rvea/B +IbY3LH2So1el +Xb/zgHGDU1f2 +Q64Csfi6HKSy + + +remivFRVn813 +n813remivFRV +vFRVn813remi +remiRUR2J+1W +remisFSQk804 +remiOH7+W6TN +remiNGU2V96W +remi3IP5+73P +remiAJP4Y43Q +remipGZSh996 +remiQJ03I4SV +remiQH1QI6R4 +remiB76WZIU2 +remi/8S/7F0J +reminUZ/v+9J +remiq0W/iN4J +remiiI//q7LJ +remiV8+RNFH7 +remiA43JYJP/ +remiHNRSP016 +remiN76UVIU0 +remis06UkNU0 +remiM90UUGS0 +remio8S7wF0R +reminK3Wv5P2 +remiSGVRK957 +remip/6NhQU+ +remij32TrMQ1 +remi7F4//8WJ +remi+9U43G6Q +remiq1+QiOH4 +remivU3Nn+P+ +remiMLR+U21N +remiu8L/mF/J +remiKI11S7RT +remiNGQ5V92P +remiT46/LJUJ +remi+9203GQU +remiQG9UI9Z0 +remiMQS1U/0T +remivF1Vn8R3 +remiZ7S6BI0S +remiU4/6MJLS +remiOLV6W25S +remiYI+RA7H7 +remiWKV6O55S +remiPLV6H25S +remio8WSwF46 +remiV1+1NOHT +remiHK7WP5T2 +remi+N7T30T1 +remi/UPR7+37 +remi33S3+M0V +remiY/27AQQR +remiI1H4QO+Q +remim5/PuKL5 +remin895vFZP +remiuFW7m84R +remii+SRqU07 +remisHSWk602 +remimHTRu677 +remia09PyNZ5 +remioL+Jw2H/ +remiqGZSi996 +remiAI45Y7WP +remiJURWR+12 +remiZIV2B75W +remimMT6u37S +remioLW0w24U +remi30T6+N7S +remip2U6hL6S +remiAQ71Y/TT +remiiG+Vq9H3 +remiiNZ1q09T +remiP5PTHK31 +remiWJU5O46P +remi/UV67+5S +remiyNQ/a02J +remi3M44+3WQ +remil2VUtL50 +remih/90pQZU +remia+3NyUP+ +remiQ1Z7IO9R +remiz3L3bM/V +remiB73RZIP7 +remiKHQSS626 +remiAOVQY154 +remiQFH1I8+T +remiSMPUK330 +remiOF4TW8W1 +remihNP+p03N +remilF5Ut8V0 +remis30+kMSN +remiOH4WW6W2 +remiWK4WO5W2 +remiO534WKPQ +remiv49QnJZ4 +remi3I64+7UQ +remiyO91a1ZT +remipJ21h4QT +remiLLU5T26P +remiwFVUo850 diff --git a/02-Easy2/code.c b/02-Easy2/code.c new file mode 100644 index 0000000..c94c31e --- /dev/null +++ b/02-Easy2/code.c @@ -0,0 +1,39 @@ +#include +#include +#include + + +int main(int param_1,char* *param_2) { + char* input_string; + size_t input_length; + char* pcVar2; + char* pcVar3; + uint32_t uVar4; + + if (param_1 == 2) { + input_string = (char *)param_2[1]; + input_length = strlen(input_string); + if (input_length == 12) { + uVar4 = 0x56253667; + pcVar2 = input_string; + do { + pcVar3 = pcVar2 + 4; + uVar4 = uVar4 ^ ((uint8_t)pcVar2[0] << 24 | (uint8_t)pcVar2[1] << 16 | (uint8_t)pcVar2[2] << 8 | (uint8_t)pcVar2[3]); + pcVar2 = pcVar3; + } while (input_string + 12 != pcVar3); + if (uVar4 == 0x3c3e386b) { + fprintf(stderr,"\nCongratulations ! A right password is indeed %s :-)\n\n",input_string); + return 0; + } + fwrite("\nWrong password ! Try again...\n\n", 1, 0x20,stderr); + } else { + fwrite("\nWrong password length ! Try again...\n\n", 1, 0x20,stderr); + } + } + else { + fwrite("\nMSE-SRE Challenge E2 --- Enjoy !\n", 1, 0x22,stderr); + fwrite("\nWhat I need is 1024 passwords passing the check!\n",1,0x32,stderr); + fprintf(stderr, "\nUsage: %s \n\n", *param_2); + } + return 1; +} diff --git a/02-Easy2/smallGenerator.c b/02-Easy2/smallGenerator.c new file mode 100644 index 0000000..af54e0c --- /dev/null +++ b/02-Easy2/smallGenerator.c @@ -0,0 +1,95 @@ +#include +#include +#include +#include +#include +#include + +const uint16_t NBR_PASSWORDS_REQUESTED = 100; + +bool hash(char* str){ + char* str1 = str; + char* str2 = str; + uint32_t foo = 0x56253667; + + do { + str2 = str1 + 4; + foo = foo ^ ((uint8_t)*str1 << 24 | (uint8_t)str1[1] << 16 | (uint8_t)str1[2] << 8 | (uint8_t)str1[3]); + str1 = str2; + } while (str + 12 != str2); + return foo == 0x3c3e386b ? true : false; +} + +const char list[] = { + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + '/', '+' +}; +char give_char(uint8_t index){ + if (index >= sizeof(list)) { + printf("Error: Index out of bounds, max %zu\n", sizeof(list)); + exit(1); + } + return list[index]; +} + + +int main(int argc, char *argv[]) { + srand(time(NULL)); + + // seed = 0x56253667; + // answer = 0x3c3e386b; + uint8_t mdw[4] = {0x6a, 0x1b, 0x0e, 0x0c}; + + char password[13]; + const uint8_t max_char = sizeof(list); + + password[0] = 'r'; + password[1] = 'e'; + password[2] = 'm'; + password[3] = 'i'; + uint8_t foo[4]; + + for(uint16_t n = 0; n < NBR_PASSWORDS_REQUESTED; n++) { + + for(uint8_t i = 0; i < 4; i++) { + foo[i] = password[i] ^ mdw[i]; + } + for(uint8_t i = 0; i < 4; i++) { + // password[i] = give_char(rand()%max_char); + uint32_t counter = 0; + // for(uint8_t c2 = 0; c2 < max_char; c2++) { + + // } + do{ + password[i+4] = list[rand()%max_char]; + for(uint8_t j = 0; j < max_char; j++) { + password[i+8] = list[j]; + if( ((uint8_t)password[i+4] ^ (uint8_t)password[i+8]) == foo[i]) break; + } + counter++; + } while (( (uint8_t)password[i+4] ^ (uint8_t)password[i+8] ) != foo[i]); + //printf("Counter: %zu\n", counter); + } + password[12] = '\0'; + if (hash(password)) { + printf("%s\n", password); + } else { + printf("Fuck\n"); + } + + } +} + + +// l96n hRI/ npqM 471M +// +// +// 56 25 36 67 +// ----------- +// 6C 39 36 6E +// 68 52 49 2F +// 6E 70 71 4D +// ----------- +// 3c 3e 38 6b