ADD exercices week 2
This commit is contained in:
parent
9df5ce5b66
commit
914fbc5d6d
0
01-VeryEasy2/VE2
Normal file → Executable file
0
01-VeryEasy2/VE2
Normal file → Executable file
0
01-VeryEasy2/VE2.gpr
Normal file
0
01-VeryEasy2/VE2.gpr
Normal file
11
01-VeryEasy2/VE2.rep/idata/00/00000000.prp
Normal file
11
01-VeryEasy2/VE2.rep/idata/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="Program" />
|
||||||
|
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||||
|
<STATE NAME="FILE_ID" TYPE="string" VALUE="a801f6fb66758882284485789" />
|
||||||
|
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||||
|
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||||
|
<STATE NAME="NAME" TYPE="string" VALUE="VE2" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
BIN
01-VeryEasy2/VE2.rep/idata/00/~00000000.db/db.2.gbf
Normal file
BIN
01-VeryEasy2/VE2.rep/idata/00/~00000000.db/db.2.gbf
Normal file
Binary file not shown.
5
01-VeryEasy2/VE2.rep/idata/~index.bak
Normal file
5
01-VeryEasy2/VE2.rep/idata/~index.bak
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
00000000:VE2:a801f6fb66758882284485789
|
||||||
|
NEXT-ID:1
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
5
01-VeryEasy2/VE2.rep/idata/~index.dat
Normal file
5
01-VeryEasy2/VE2.rep/idata/~index.dat
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
00000000:VE2:a801f6fb66758882284485789
|
||||||
|
NEXT-ID:1
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
6
01-VeryEasy2/VE2.rep/project.prp
Normal file
6
01-VeryEasy2/VE2.rep/project.prp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="OWNER" TYPE="string" VALUE="remi" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
15
01-VeryEasy2/VE2.rep/projectState
Normal file
15
01-VeryEasy2/VE2.rep/projectState
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<PROJECT>
|
||||||
|
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||||
|
<SAVE_STATE>
|
||||||
|
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||||
|
<A VALUE="VE2:" />
|
||||||
|
</ARRAY>
|
||||||
|
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||||
|
</SAVE_STATE>
|
||||||
|
</PROJECT_DATA_XML_NAME>
|
||||||
|
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||||
|
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||||
|
</TOOL_MANAGER>
|
||||||
|
</PROJECT>
|
||||||
|
|
11
01-VeryEasy2/VE2.rep/user/00/00000000.prp
Normal file
11
01-VeryEasy2/VE2.rep/user/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="ProgramUserData" />
|
||||||
|
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||||
|
<STATE NAME="FILE_ID" TYPE="string" VALUE="a801f6fa08361347999654449" />
|
||||||
|
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||||
|
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||||
|
<STATE NAME="NAME" TYPE="string" VALUE="udf_a801f6fb66758882284485789" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
BIN
01-VeryEasy2/VE2.rep/user/00/~00000000.db/db.1.gbf
Normal file
BIN
01-VeryEasy2/VE2.rep/user/00/~00000000.db/db.1.gbf
Normal file
Binary file not shown.
4
01-VeryEasy2/VE2.rep/user/~index.bak
Normal file
4
01-VeryEasy2/VE2.rep/user/~index.bak
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
5
01-VeryEasy2/VE2.rep/user/~index.dat
Normal file
5
01-VeryEasy2/VE2.rep/user/~index.dat
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
00000000:udf_a801f6fb66758882284485789:a801f6fa08361347999654449
|
||||||
|
NEXT-ID:1
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
2
01-VeryEasy2/VE2.rep/user/~journal.bak
Normal file
2
01-VeryEasy2/VE2.rep/user/~journal.bak
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
IADD:00000000:/udf_a801f6fb66758882284485789
|
||||||
|
IDSET:/udf_a801f6fb66758882284485789:a801f6fa08361347999654449
|
4
01-VeryEasy2/VE2.rep/versioned/~index.bak
Normal file
4
01-VeryEasy2/VE2.rep/versioned/~index.bak
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
4
01-VeryEasy2/VE2.rep/versioned/~index.dat
Normal file
4
01-VeryEasy2/VE2.rep/versioned/~index.dat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
8
01-VeryEasy2/VE2.txt
Normal file
8
01-VeryEasy2/VE2.txt
Normal file
@ -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
|
43
01-VeryEasy2/code.c
Normal file
43
01-VeryEasy2/code.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
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 <password>\n\n",*param_2);
|
||||||
|
output_value = 1;
|
||||||
|
}
|
||||||
|
return output_value;
|
||||||
|
}
|
16
01-VeryEasy2/foo.c
Normal file
16
01-VeryEasy2/foo.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
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, ...) {
|
||||||
|
|
||||||
|
}
|
0
02-Easy2/E2
Normal file → Executable file
0
02-Easy2/E2
Normal file → Executable file
0
02-Easy2/E2.gpr
Normal file
0
02-Easy2/E2.gpr
Normal file
11
02-Easy2/E2.rep/idata/00/00000000.prp
Normal file
11
02-Easy2/E2.rep/idata/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="Program" />
|
||||||
|
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||||
|
<STATE NAME="FILE_ID" TYPE="string" VALUE="c0a82eeaa7971421479596701" />
|
||||||
|
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||||
|
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||||
|
<STATE NAME="NAME" TYPE="string" VALUE="E2" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
BIN
02-Easy2/E2.rep/idata/00/~00000000.db/db.2.gbf
Normal file
BIN
02-Easy2/E2.rep/idata/00/~00000000.db/db.2.gbf
Normal file
Binary file not shown.
5
02-Easy2/E2.rep/idata/~index.bak
Normal file
5
02-Easy2/E2.rep/idata/~index.bak
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
00000000:E2:c0a82eeaa7971421479596701
|
||||||
|
NEXT-ID:1
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
5
02-Easy2/E2.rep/idata/~index.dat
Normal file
5
02-Easy2/E2.rep/idata/~index.dat
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
00000000:E2:c0a82eeaa7971421479596701
|
||||||
|
NEXT-ID:1
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
6
02-Easy2/E2.rep/project.prp
Normal file
6
02-Easy2/E2.rep/project.prp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="OWNER" TYPE="string" VALUE="remi" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
15
02-Easy2/E2.rep/projectState
Normal file
15
02-Easy2/E2.rep/projectState
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<PROJECT>
|
||||||
|
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||||
|
<SAVE_STATE>
|
||||||
|
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||||
|
<A VALUE="E2:" />
|
||||||
|
</ARRAY>
|
||||||
|
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||||
|
</SAVE_STATE>
|
||||||
|
</PROJECT_DATA_XML_NAME>
|
||||||
|
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||||
|
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||||
|
</TOOL_MANAGER>
|
||||||
|
</PROJECT>
|
||||||
|
|
11
02-Easy2/E2.rep/user/00/00000000.prp
Normal file
11
02-Easy2/E2.rep/user/00/00000000.prp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<FILE_INFO>
|
||||||
|
<BASIC_INFO>
|
||||||
|
<STATE NAME="CONTENT_TYPE" TYPE="string" VALUE="ProgramUserData" />
|
||||||
|
<STATE NAME="PARENT" TYPE="string" VALUE="/" />
|
||||||
|
<STATE NAME="FILE_ID" TYPE="string" VALUE="c0a82ee8e31106056027371797" />
|
||||||
|
<STATE NAME="FILE_TYPE" TYPE="int" VALUE="0" />
|
||||||
|
<STATE NAME="READ_ONLY" TYPE="boolean" VALUE="false" />
|
||||||
|
<STATE NAME="NAME" TYPE="string" VALUE="udf_c0a82eeaa7971421479596701" />
|
||||||
|
</BASIC_INFO>
|
||||||
|
</FILE_INFO>
|
BIN
02-Easy2/E2.rep/user/00/~00000000.db/db.1.gbf
Normal file
BIN
02-Easy2/E2.rep/user/00/~00000000.db/db.1.gbf
Normal file
Binary file not shown.
4
02-Easy2/E2.rep/user/~index.dat
Normal file
4
02-Easy2/E2.rep/user/~index.dat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
2
02-Easy2/E2.rep/user/~journal.dat
Normal file
2
02-Easy2/E2.rep/user/~journal.dat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
IADD:00000000:/udf_c0a82eeaa7971421479596701
|
||||||
|
IDSET:/udf_c0a82eeaa7971421479596701:c0a82ee8e31106056027371797
|
4
02-Easy2/E2.rep/versioned/~index.bak
Normal file
4
02-Easy2/E2.rep/versioned/~index.bak
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
4
02-Easy2/E2.rep/versioned/~index.dat
Normal file
4
02-Easy2/E2.rep/versioned/~index.dat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
VERSION=1
|
||||||
|
/
|
||||||
|
NEXT-ID:0
|
||||||
|
MD5:d41d8cd98f00b204e9800998ecf8427e
|
130
02-Easy2/E2.txt
Normal file
130
02-Easy2/E2.txt
Normal file
@ -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
|
39
02-Easy2/code.c
Normal file
39
02-Easy2/code.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
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 <password>\n\n", *param_2);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
95
02-Easy2/smallGenerator.c
Normal file
95
02-Easy2/smallGenerator.c
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
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
|
Loading…
x
Reference in New Issue
Block a user