Prechádzať zdrojové kódy

Add level on basic public-key encryption

Vecna 11 mesiacov pred
rodič
commit
66a4d85de7

+ 24 - 0
levels/01 Basics/level06.html

@@ -0,0 +1,24 @@
+
+<p>Routers and modems can read the contents of packets they relay. To protect confidentiality on the Internet, we should thus use <strong>encryption</strong> 
+ to make our messages look like nonsense to outsiders. In this level, we introduce a simple encryption protocol that allows two parties to communicate 
+ privately.</p>
+
+<p>This "encryption" protocol involves packets with three different types of messages (specified at the application layer):</p>
+<ul>
+  <li><strong>keyrequest</strong> is used to specify one's own key and request the other party's key.</li>
+  <li><strong>keyresponse</strong> is a response to a <strong>keyrequest</strong> and includes only one's own key.</li>
+  <li>After these first two steps have occurred, the two parties can exchange <strong>message</strong> packets, encrypted with the recipient's key.</li>
+</ul>
+
+<p>To pass this level, send an <strong>encrypted message</strong> from Alice's computer to Bob's computer. You must first have Alice and Bob exchange keys. 
+Alice's encryption key is <strong>12345</strong>.</p>
+ 
+<p><em><strong>Hint:</strong> there is an example of how the encryption protocol works at the top of the field.  Use the <span class="button">pause</span> 
+button to see what the values of the packet headers are in the protocol.</em></p>
+
+ <h3>Level Objectives</h3>
+
+<ul>
+  <li>have Alice and Bob exchange encryption keys</li>
+  <li>send an encrypted message from Alice to Bob</li>
+</ul>

+ 102 - 0
levels/01 Basics/level06.json

@@ -0,0 +1,102 @@
+{
+	devices:[
+		{
+			id:"Example Alice",
+			ports:1,
+			x:0.25,
+			y:0.35,
+                        script: deviceScripts.encryption
+		},
+		{
+			id:"Example Bob",
+                        image: "iphone-1",
+			ports:1,
+			x:0.75,
+			y:0.35,
+                        script: deviceScripts.encryption
+		},
+		{
+			id:"Alice",
+			ports:1,
+			x:0.25,
+			y:0.6,
+                        player: true
+		},
+		{
+			id:"Router",
+                        image: "router",
+			ports:2,
+			x:0.5,
+			y:0.6,
+                        script: deviceScripts.manualRouter,
+			rules:[
+				{dstip:"Alice", portNum:0},
+				{dstip:"Bob", portNum:1}
+			]
+		},
+		{
+			id:"Bob",
+                        image: "iphone-1",
+			ports:1,
+			x:0.75,
+			y:0.6,
+                        script: deviceScripts.encryption
+		}
+	],
+	links:[
+		{
+			src:"Alice", srcport:0,
+			dst:"Router", dstport:0
+		},
+		{
+			src:"Router", srcport:1,
+			dst:"Bob", dstport:0
+		},
+		{
+			src:"Example Alice", srcport:0,
+			dst:"Example Bob", dstport:0
+		}
+	],
+	timeline:[
+		{
+			type:"packet",
+			at:500,
+			from:"Example Alice",
+			payload:{
+				network:{srcip:"Example Alice",dstip:"Example Bob"},
+				transport:{proto:"encryption"},
+				application:{type:"keyrequest",key:"12345"}
+			}
+		}
+	],
+	triggers:[
+	        {
+        	    type:"packet",
+	            device:"Bob",
+        	    payload:{
+	                network:{srcip:"Alice",dstip:"Bob"},
+        	        transport:{proto:"encryption"},
+	                application:{type:"keyrequest",key:"12345"}
+        	    }
+	        },
+		{
+			type:"packet",
+			device:"Alice",
+			payload:{
+				network:{srcip:"Bob",dstip:"Alice"},
+				transport:{proto:"encryption"},
+				application:{type:"keyresponse",key:"67890"}
+			}
+		},
+		{
+			type:"packet",
+			device:"Bob",
+			payload:{
+				network:{srcip:"Alice", dstip: "Bob"},
+				transport:{proto:"encryption"},
+				application:{type:"message",key:"67890"}
+			}
+		}
+        ],
+	nextLevel:7
+}

+ 1 - 1
levels/02 Spoofs/spoofs01.json

@@ -137,5 +137,5 @@
 			}
 		}
 	],
-	nextLevel:7
+	nextLevel:8
 }

+ 1 - 1
levels/02 Spoofs/spoofs02.json

@@ -112,5 +112,5 @@
 			}
 	    }
         ],
-	nextLevel: 8
+	nextLevel: 9
 }

+ 1 - 1
levels/03 DoS/dos01.json

@@ -30,5 +30,5 @@
 			device:"Google",
 		}
 	],
-	nextLevel:9
+	nextLevel:10
 }

+ 1 - 1
levels/03 DoS/dos02.json

@@ -90,5 +90,5 @@
 			device:"Google"
 	    }
         ],
-	nextLevel:10
+	nextLevel:11
 }

+ 1 - 1
levels/03 DoS/dos03.json

@@ -84,5 +84,5 @@
 			device:"Google"
 		}
         ],
-	nextLevel:11
+	nextLevel:12
 }

+ 1 - 1
levels/04 Attacks/attacks01.json

@@ -112,5 +112,5 @@
 			}
 		}
         ],
-	nextLevel:12
+	nextLevel:13
 }

+ 1 - 1
levels/04 Attacks/attacks02.json

@@ -95,5 +95,5 @@
 			}
 		}
         ],
-	nextLevel:13
+	nextLevel:14
 }

+ 1 - 1
login.inc.php

@@ -14,7 +14,7 @@ if (!file_exists(DB_FILE)) {
 		$db->exec("CREATE TABLE category (id integer PRIMARY KEY,name text,orderby integer)");
 		$db->exec("INSERT INTO category (name, orderby) VALUES('Basics', 1),('Spoofs', 2),('Denial of Service', 3),('Attacks', 4)");
 		$db->exec("CREATE TABLE level (id integer PRIMARY KEY,category_id integer,name text,orderby integer,filename text)");
-		$db->exec("INSERT INTO level (category_id, name, orderby, filename) VALUES(1, 'Getting started', 1, '01 Basics/level01'),(1, 'Packet fields', 2, '01 Basics/level02'),(1, 'Ping', 3, '01 Basics/level03'),(1, 'Routing', 4, '01 Basics/level04'),(1, 'Modems', 5, '01 Basics/level05'),(2, 'IP Spoofing', 1, '02 Spoofs/spoofs01'),(2, 'Stealing packets', 2, '02 Spoofs/spoofs02'),(3, 'Basic DoS', 1, '03 DoS/dos01'),(3, 'Distributed DoS', 2, '03 DoS/dos02'),(3, 'Smurf attack', 3, '03 DoS/dos03'),(4, 'Mallory-in-the-middle', 1, '04 Attacks/attacks01'),(4, 'Censorship', 2, '04 Attacks/attacks02'), (4, 'Traceroute', 3, '04 Attacks/attacks03')");
+		$db->exec("INSERT INTO level (category_id, name, orderby, filename) VALUES(1, 'Getting started', 1, '01 Basics/level01'),(1, 'Packet fields', 2, '01 Basics/level02'),(1, 'Ping', 3, '01 Basics/level03'),(1, 'Routing', 4, '01 Basics/level04'),(1, 'Modems', 5, '01 Basics/level05'),(1, 'Encryption', 6, '01 Basics/level06'),(2, 'IP Spoofing', 1, '02 Spoofs/spoofs01'),(2, 'Stealing packets', 2, '02 Spoofs/spoofs02'),(3, 'Basic DoS', 1, '03 DoS/dos01'),(3, 'Distributed DoS', 2, '03 DoS/dos02'),(3, 'Smurf attack', 3, '03 DoS/dos03'),(4, 'Mallory-in-the-middle', 1, '04 Attacks/attacks01'),(4, 'Censorship', 2, '04 Attacks/attacks02'), (4, 'Traceroute', 3, '04 Attacks/attacks03')");
 		$db->exec("CREATE TABLE solns (id integer PRIMARY KEY,user_id integer,level_id integer,completed integer,json text)");
 
 		echo "<p>The database was initialized successfully! <a href=\"./\">Continue...</a></p>\n";