Browse Source

Processeur securisé

Paul Faure 2 years ago
parent
commit
1ec8f84f21
4 changed files with 50 additions and 3 deletions
  1. 1
    1
      Interpreteur
  2. 1
    1
      InterpreteurRegistres
  3. 1
    1
      Processeur
  4. 47
    0
      prog_vulnerable.c

+ 1
- 1
Interpreteur

@@ -1 +1 @@
1
-Subproject commit 95409eb5bff39457f161a6b93c2024d2fe8a90d1
1
+Subproject commit 725e0125079b6bde8ad032a3be21910980900ec4

+ 1
- 1
InterpreteurRegistres

@@ -1 +1 @@
1
-Subproject commit a4ecb5505dc66b71aee4d3d9ccccdbe17079f3d9
1
+Subproject commit bff261fa01129da9135f95f16bf4124366ea24fe

+ 1
- 1
Processeur

@@ -1 +1 @@
1
-Subproject commit f25ee2735abfbaf0cd46ea0236f2ef267e752ec7
1
+Subproject commit a70b442150f8ff4e8974c10559c3db47109a5609

+ 47
- 0
prog_vulnerable.c View File

@@ -0,0 +1,47 @@
1
+int lire_tableau() {
2
+	int tab[5] = {0,0,0,0,0};
3
+	printf(255);
4
+	stop(20);
5
+	printf(0);
6
+	stop(20);
7
+	printf(255);
8
+	stop(20);
9
+	printf(0);
10
+	stop(200);
11
+	int val = get();
12
+	int i = 0;
13
+	while (i<7) {
14
+		tab[5-i] = i; 
15
+		i = i + 1;
16
+	}
17
+	int i = 0;
18
+	while (i<5) {
19
+		printf(tab[i]);
20
+		i = i + 1;
21
+	}
22
+}
23
+
24
+int youVeBeenHacked() {
25
+	while (1) {
26
+		printf(0);
27
+		stop(20);
28
+		printf(255);
29
+		stop(20);
30
+	}
31
+}
32
+
33
+int legitimeFunction() {
34
+	int val = 1;
35
+	int i = 0;
36
+	while (i<8) {
37
+		printf(val);
38
+		stop(20);
39
+		val = val * 2;
40
+		i = i + 1;
41
+	}
42
+}
43
+
44
+int main() {
45
+	lire_tableau();
46
+	legitimeFunction();
47
+}

Loading…
Cancel
Save