Our technical experts provide the complete support for the research scholars to develop the programs based on network intrusion detection system. Now, let’s start this article with java source code for intrusion detection system.
Step: 1 Java Source Code for IDS
The network intrusion detection process is performed through creating the Java based application with WakaAttribute based source code that is highlighted in the following. Then, we have to build and generate the jar.
package Intrusion_Detection;
import weka.attributeSelection.*;
import weka.core.*;
import
weka.core.converters.ConverterUtils.*;
import weka.classifiers.*;
import weka.classifiers.meta.*;
import weka.classifiers.trees.*;
import weka.filters.*;
import java.util.*;
public class AttributeSelectionTest {
protected static void useClassifier(Instances data) throws Exception {
System.out.println("\n1. Meta-classfier");
AttributeSelectedClassifier classifier = new AttributeSelectedClassifier();
CfsSubsetEval eval = new CfsSubsetEval();
GreedyStepwise search = new GreedyStepwise();
search.setSearchBackwards(true);
J48 base = new J48();
classifier.setClassifier(base);
classifier.setEvaluator(eval);
classifier.setSearch(search);
Evaluation evaluation = new Evaluation(data);
evaluation.crossValidateModel(classifier, data, 10, new Random(1));
System.out.println(evaluation.toSummaryString());
}
protected static void useFilter(Instances data) throws Exception {
weka.filters.supervised.attribute.AttributeSelection filter = new
weka.filters.supervised.attribute.AttributeSelection();
CfsSubsetEval eval = new CfsSubsetEval();
GreedyStepwise search = new GreedyStepwise();
search.setSearchBackwards(true);
filter.setEvaluator(eval);
filter.setSearch(search);
filter.setInputFormat(data);
Instances newData = Filter.useFilter(data, filter);
MainView.jTextArea2.append("\n"+newData);
}
protected static void useLowLevel(Instances data) throws Exception {
System.out.println("\n3. Low-level");
AttributeSelection attsel = new AttributeSelection();
CfsSubsetEval eval = new CfsSubsetEval();
GreedyStepwise search = new GreedyStepwise();
search.setSearchBackwards(true);
attsel.setEvaluator(eval);
attsel.setSearch(search);
attsel.SelectAttributes(data);
int[] indices = attsel.selectedAttributes();
System.out.println("selected attribute indices (starting with 0):\n" + Utils.arrayToString(indices));
}
Step: 2 IDS Development
At this movement, we have to develop the network IDS with integration of Java Ns-3 and Java based IDS with Ns-3 through the Java .jar file from the Ns3 main file through using the below mentioned code.
system(“java -jar Attention_Based_ResNet.jar”);
Step: 3 Execute Intrusion Detection System
The intrusion detection system using Ns3 is implemented through the executing the following commands. In addition, we have highlighted the acquired results through the execution of IDS using Java with Ns3.
cd /home/research/ns-allinone-3.26/ns-3.26
sudo ./waf –run IDS_Simulation –vis
The research scholars can reach us to acquire a lot about the implementation of intrusion detection system.