This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7db93a
commit 1c38a54
Showing
22 changed files
with
100 additions
and
30 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package CEP.PortScanDetector; | ||
|
||
import Utilities.*; | ||
import com.espertech.esper.compiler.client.*; | ||
import com.espertech.esper.runtime.client.*; | ||
import org.pcap4j.packet.namednumber.*; | ||
|
||
import java.io.*; | ||
import java.net.*; | ||
|
||
public class BlockPortScan { | ||
public BlockPortScan(int alertPeriod, int interval) throws EPCompileException, EPDeployException, IOException, EPCompileException, EPDeployException { | ||
|
||
new EPAdapter().execute("add-horizontal-port-scan", "insert into BlockPortScanAlert\n" + | ||
"select hostPort from HorizontalPortScanAlert#expr(oldest_timestamp > newest_timestamp - 1000)"); | ||
|
||
new EPAdapter().execute("add-vertical-port-scan", "insert into BlockPortScanAlert\n" + | ||
"select hostAddr from VerticalPortScanAlert#expr(oldest_timestamp > newest_timestamp - 1000)"); | ||
|
||
new EPAdapter().execute("alert-block-port-scan", "select * from BlockPortScanAlert#time( " + alertPeriod + " seconds)#expr(oldest_timestamp > newest_timestamp - 1000)\n" + | ||
"where exists(select * from HorizontalPortScanAlert)\n" + | ||
"and exists(select * from VerticalPortScanAlert)\n" | ||
).addListener((newData, __, ___, ____) -> System.out.println("Alert a block scan:" | ||
+ " is happened!")); | ||
// new EPAdapter().execute("alert-block-port-scan", "on BlockPortScanAlert delete from BlockPortScanAlert\n"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/CEP/PortScanDetector/BlockPortScanAlert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package CEP.PortScanDetector; | ||
|
||
import org.pcap4j.packet.namednumber.*; | ||
|
||
import java.net.*; | ||
|
||
public class BlockPortScanAlert { | ||
InetAddress hostAddr; | ||
Port hostPort; | ||
Long timestamp; | ||
|
||
public BlockPortScanAlert(InetAddress hostAddr) { | ||
this.hostAddr = hostAddr; | ||
} | ||
|
||
public BlockPortScanAlert(Port hostPort) { | ||
this.hostPort = hostPort; | ||
} | ||
|
||
public BlockPortScanAlert(Long timestamp) { | ||
this.timestamp = timestamp; | ||
} | ||
|
||
public InetAddress getHostAddr() { | ||
return hostAddr; | ||
} | ||
public Port getHostPort() { | ||
return hostPort; | ||
} | ||
public Long getTimestamp() { return timestamp; } | ||
|
||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file modified
0
src/test/java/CEP/WebserverMonitor/ApacheAccessLogEventTest.java
100644 → 100755
Empty file.
Empty file modified
0
src/test/java/CEP/WebserverMonitor/NeptuneErrorLogEventTest.java
100644 → 100755
Empty file.