瀏覽代碼

fixed a bug i introduced with the modem script in attacks2. updated level names.

Erinn 8 年之前
父節點
當前提交
3de69af959
共有 3 個文件被更改,包括 18 次插入3 次删除
  1. 16 1
      js/devicescripts.js
  2. 1 1
      levels/04 Attacks/attacks02.json
  3. 1 1
      login.inc.php

+ 16 - 1
js/devicescripts.js

@@ -1,9 +1,11 @@
 var deviceScripts = {
 	manualRouter: {
 		onPacketReceived: function(device, packet) {
+			var newpkt = JSON.parse(JSON.stringify(packet));
+
 			for (var i = 0; i < device.rules.length; i++) {
 				if (device.rules[i].dstip == packet.network.dstip) {
-					sendPacket(device.id, device.rules[i].portNum, packet);
+					sendPacket(device.id, device.rules[i].portNum, newpkt);
 				}
 			}
 		}
@@ -15,6 +17,19 @@ var deviceScripts = {
 		}
 	},
 
+	// proxy device for attacks1. again, this is quick'n'dirty for the workshop
+	proxy: {
+		onPacketReceived: function(device, packet, portNum) {
+			var newpkt = JSON.parse(JSON.stringify(packet));
+
+			if (packet.network.dstip == "Proxy") {
+				newpkt.network.dstip = "Blocked Site";
+			}
+
+			sendPacket(device.id, portNum == 0 ? 1 : 0, newpkt);
+		}
+	},
+
     ping: {
 		onPacketReceived: function(device, packet) {
                     if(packet.hasOwnProperty("transport") && packet["transport"].hasOwnProperty("proto")){

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

@@ -43,7 +43,7 @@
 			ports:2,
 			x:0.6,
 			y:0.2,
-                        script: deviceScripts.modem
+                        script: deviceScripts.proxy
 		}
 	],
 	links:[

+ 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, 'Basics 1', 1, '01 Basics/level01'),(1, 'Basics 2', 2, '01 Basics/level02'),(1, 'Basics 3', 3, '01 Basics/level03'),(1, 'Basics 4', 4, '01 Basics/level04'),(1, 'Basics 5', 5, '01 Basics/level05'),(2, 'Spoofs 1', 1, '02 Spoofs/spoofs01'),(2, 'Spoofs 2', 2, '02 Spoofs/spoofs02'),(3, 'DoS 1', 1, '03 DoS/dos01'),(3, 'DoS 2', 2, '03 DoS/dos02'),(3, 'DoS 3', 3, '03 DoS/dos03'),(4, 'Attacks 1', 1, '04 Attacks/attacks01'),(4, 'Attacks 2', 2, '04 Attacks/attacks02')");
+		$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, 'Man-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";