Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangvanthien committed Nov 8, 2020
1 parent 2606cec commit 762c0c9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
Binary file added Documentation.pdf
Binary file not shown.
3 changes: 0 additions & 3 deletions html/info.php

This file was deleted.

1 change: 1 addition & 0 deletions src/main/java/CEP/PortScanDetector/Detector.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static void execute() throws EPCompileException, IOException, EPDeployExc
System.out.println("Please wait while I'm configuring the Port Scan... ");
SinglePortScanCEP.setup();
VerticalPortScanCEP.setup();
HorizontalPortScanCEP.setup();
// New code below here
if (device == null) {
System.out.println("No device chosen.");
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/CEP/PortScanDetector/HorizontalPortScanCEP.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void setup() throws EPCompileException, EPDeployException {
});

new EPAdapter().execute("select * from HorizontalPortScan_Alert_HighPriority").addListener((data, __, ___, ____) -> {
DashboardAdapter.alertHigh("Port " + data[0].get("targetAddress") + " is under a horizontal port scan.");
DashboardAdapter.alertHigh("Port " + data[0].get("targetPort") + " is under a horizontal port scan.");
});
}
private static void setup(String id, int period, int threshold) throws EPCompileException, EPDeployException {
Expand All @@ -40,7 +40,7 @@ private static void setup(String id, int period, int threshold) throws EPCompile
" select targetPort from "+latest+
" group by targetPort having count(distinct targetAddress) >= " + threshold,

"on "+alert+" as A delete from "+latest+" as B where B.targetAddress=A.targetAddress");
"on "+alert+" as A delete from "+latest+" as B where B.targetPort=A.targetPort");
}

/**
Expand All @@ -56,6 +56,7 @@ public static int[] getPeriod() {
* @param period [period_lowPriority, period_highPriority]
*/
public static void setPeriod(int[] period) {
EPAdapter.destroy();
HorizontalPortScanCEP.period = period;
}

Expand All @@ -72,6 +73,7 @@ public static int[] getThreshold() {
* @param threshold [threshold_lowPriority, threshold_highPriority]
*/
public static void setThreshold(int[] threshold) {
EPAdapter.destroy();
HorizontalPortScanCEP.threshold = threshold;
}
}
2 changes: 2 additions & 0 deletions src/main/java/CEP/PortScanDetector/VerticalPortScanCEP.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static int[] getPeriod() {
* @param period [period_lowPriority, period_highPriority]
*/
public static void setPeriod(int[] period) {
EPAdapter.destroy();
VerticalPortScanCEP.period = period;
}

Expand All @@ -76,6 +77,7 @@ public static int[] getThreshold() {
* @param threshold
*/
public static void setThreshold(int[] threshold) {
EPAdapter.destroy();
VerticalPortScanCEP.threshold = threshold;
}
}
18 changes: 17 additions & 1 deletion src/main/java/Dashboard/Dashboard.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package Dashboard;

import CEP.PortScanDetector.Detector;
import CEP.PortScanDetector.HorizontalPortScanCEP;
import CEP.PortScanDetector.SinglePortScanCEP;
import CEP.PortScanDetector.VerticalPortScanCEP;
import CEP.WebserverMonitor.ApacheAccessLogCEP;
import CEP.WebserverMonitor.Monitor;
import CEP.WebserverMonitor.NeptuneErrorLogCEP;
import Utilities.DashboardAdapter;
import Utilities.EPAdapter;
import com.espertech.esper.common.client.module.ParseException;
import com.espertech.esper.compiler.client.EPCompileException;
import com.espertech.esper.runtime.client.EPDeployException;
import de.siegmar.fastcsv.writer.CsvWriter;
Expand Down Expand Up @@ -375,8 +379,20 @@ public void actionPerformed(ActionEvent e) {
NeptuneErrorLogCEP.setUserBaseScan_threshold(thresholds);
NeptuneErrorLogCEP.setup();
}
case 4 : {
VerticalPortScanCEP.setPeriod(periods);
VerticalPortScanCEP.setThreshold(thresholds);
SinglePortScanCEP.setup();
VerticalPortScanCEP.setup();
}
case 5 : {
HorizontalPortScanCEP.setPeriod(periods);
HorizontalPortScanCEP.setThreshold(thresholds);
SinglePortScanCEP.setup();
HorizontalPortScanCEP.setup();
}
}
} catch (EPCompileException | EPDeployException exception) {
} catch (EPCompileException | EPDeployException | IOException | ParseException exception) {
exception.printStackTrace();
}
}
Expand Down

0 comments on commit 762c0c9

Please sign in to comment.