Procházet zdrojové kódy

updating dos level 3

cecylia před 8 roky
rodič
revize
a021c00577
3 změnil soubory, kde provedl 40 přidání a 25 odebrání
  1. 20 0
      js/devicescripts.js
  2. 7 9
      levels/03 DoS/dos03.html
  3. 13 16
      levels/03 DoS/dos03.json

+ 20 - 0
js/devicescripts.js

@@ -112,6 +112,26 @@ var deviceScripts = {
             }
 
         }
+    },
+    broadcast: {
+        onPacketReceived: function(device, packet, portNum){
+            function checkRules(rule){
+                return rule.dstip == packet.network.dstip;
+            }
+
+            var rule = device.rules.find(checkRules);
+            if (rule != undefined){
+                sendPacket(device.id, rule.portNum, packet);
+            } else {
+                if(packet.network.dstip == "Broadcast"){
+                    for(var i=0; i<device.ports.length; i++){
+                        if(i != portNum){
+                            sendPacket(device.id, i, packet);
+                        }
+                    }
+                }
+            }
+        }
     }
     
 }

+ 7 - 9
levels/03 DoS/dos03.html

@@ -1,25 +1,23 @@
-<link rel="stylesheet" href="../../includes/css/base.css" />
-<link rel="stylesheet" href="../../includes/css/style.css" />
 
 <h1>DoS Level 3</h1>
 
 <p>The router in this level responds to a special type of ping, called a "Broadcast ping".  When a router receives a packet that is addressed
 to the broadcast address, it replicates it and sends it to <em>all</em> the machines on the network.
 
-<p>In this level, Eve's computer has received an <strong>upgrade</strong>: it can no longer be DoS'd from a single computer.  
-Multiple computers will be required to coordinate with each other in order to send her enough traffic.
+<p>In this level, Google has received an <strong>upgrade</strong>: it can no longer be DoS'd from a single computer.  
+Multiple computers will be required to coordinate with each other in order to send enough traffic.
 
 <p>However, you only have control of a single computer!  You will have to implement a <strong>smurf attack</strong>.  In a smurf attack, you leverage 
 other devices to send traffic <em>for you</em>.
 
 <p>Experiment with sending broadcast pings by sending a message with the dstip set to "Broadcast".  
-See if you can overwhelm Eve by combining this with what you learned about spoofing packet source addresses.
+See if you can overwhelm Google by combining this with what you learned about spoofing packet source addresses.
 
 <h3>Level Objectives</h3>
 
 <ul>
-	<li>send a ping to the IP <strong>Broadcast</strong></li>
-	<li>can you get Barbara to send a packet to Eve?</li>
-	<li>overwhelm Eve with traffic</li>
-	<li>try to do this with only one packet in the Editor! (you may use the "repeat" feature)
+	<li>Send a ping to the IP <strong>Broadcast</strong></li>
+	<li>Can you get Barbara to send a packet to Google?</li>
+	<li>Overwhelm Google with traffic</li>
+	<li>Try to do this with only one packet in the Editor! (you may use the "repeat" feature)
 </ul>

+ 13 - 16
levels/03 DoS/dos03.json

@@ -2,7 +2,6 @@
 	devices:[
 		{
 			id:"Alice",
-			type:"NullComputer",
 			ports:1,
 			x:0.25,
 			y:0.3,
@@ -10,45 +9,43 @@
 		},
 		{
 			id:"Barbara",
-			type:"NullComputer",
 			ports:1,
 			x:0.25,
 			y:0.4
 		},
 		{
 			id:"Carol",
-			type:"NullComputer",
 			ports:1,
 			x:0.25,
 			y:0.5
 		},
 		{
 			id:"Darcy",
-			type:"NullComputer",
 			ports:1,
 			x:0.25,
 			y:0.6
 		},
 		{
-			id:"Eve",
-			type:"NullComputer",
+			id:"Google",
+                        image: "server",
 			ports:1,
-			x:0.25,
-			y:0.7,
+			x:0.8,
+			y:0.5,
 			bufferWait:170
 		},
 		{
 			id:"Router",
-			type:"BroadcastRouter",
+                        image: "router",
 			ports:5,
 			x:0.5,
 			y:0.5,
+                        script: deviceScripts.broadcast,
 			rules:[
 				{dstip:"Alice",portNum:0},
 				{dstip:"Barbara",portNum:1},
 				{dstip:"Carol",portNum:2},
 				{dstip:"Darcy",portNum:3},
-				{dstip:"Eve",portNum:4}
+				{dstip:"Google",portNum:4}
 			]
 		}
 	],
@@ -70,17 +67,17 @@
 			dst:"Router", dstport:3
 		},
 		{
-			src:"Eve", srcport:0,
+			src:"Google", srcport:0,
 			dst:"Router", dstport:4
 		}
 	],
 	timeline:[],
-	triggers:{
-		t0:{
+	triggers:[
+		{
 			type:"packet",
-			device:"Eve",
+			device:"Google",
 			times:45
 		}
-	},
-	nextLevel:"04 Attacks/attacks01.json"
+        ],
+	nextLevel:11
 }