Преглед изворни кода

feat : print node totally

master
우인혜 пре 6 година
родитељ
комит
ab8de5f0e4

+ 17
- 1
src/main/java/com/mycompany/app/App.java Прегледај датотеку

@@ -105,8 +105,22 @@ public class App {
105 105
         } catch( IOException e) {
106 106
             e.printStackTrace();
107 107
         }
108
-        
108
+
109
+        //  Print
110
+        for(int i = 0 ; i < networkNode.size(); i++){
111
+            System.out.println("<Node"+(i+1)+"> " + networkNode.elementAt(i).ip);
112
+            System.out.println("Total packet = " + networkNode.elementAt(i).getTotal_pkt());
113
+            System.out.println("Total byte = " + networkNode.elementAt(i).getTotal_bytes());
114
+            System.out.println("<Destination packet>");
115
+            for(int j=0; j< networkNode.elementAt(i).destination.size();j++){
116
+                System.out.println("("+ networkNode.elementAt(i).destination.elementAt(j).ip+","+networkNode.elementAt(i).destination.elementAt(j).port+")");
117
+            }
118
+            System.out.println("<Source port count>");
119
+            System.out.println(networkNode.elementAt(i).source.size());
120
+        }
121
+
109 122
     }
123
+        
110 124
     public static Node findNode(Vector<Node> nodeVector, Object obj){
111 125
         for(int i = 0; i < nodeVector.size(); i++){
112 126
             if(nodeVector.elementAt(i).ip.equals((String)obj)){
@@ -116,12 +130,14 @@ public class App {
116 130
         }
117 131
         return null;
118 132
     }
133
+
119 134
     public static void insertNodeValue(Eips S, Nips D, Packet pkt){
120 135
         S.setSourceIp(pkt.eip);
121 136
         S.setSourcePort(pkt.eport);
122 137
         D.setDestIp(pkt.nip);
123 138
         D.setDestPort(pkt.nport);
124 139
     }
140
+
125 141
     public static void insertAddress(Eips S, Nips D, Node N){
126 142
         N.source.addElement(S);
127 143
         N.destination.addElement(D);

+ 1
- 1
src/main/java/com/mycompany/app/Node.java Прегледај датотеку

@@ -5,7 +5,7 @@ import java.util.Vector;
5 5
 class Node {
6 6
     Vector<Eips> source = new Vector<Eips>();
7 7
     Vector<Nips> destination = new Vector<Nips>(); 
8
-    String ip=null; //  ip
8
+    String ip = null; //  ip
9 9
 
10 10
     double vulnerability = 1/30;   //  inbound value
11 11
     double aggression;      //  outbound value

BIN
target/classes/com/mycompany/app/App.class Прегледај датотеку


Loading…
Откажи
Сачувај