Add network activity map overlay and configurable monitoring filters
This commit is contained in:
@@ -15,7 +15,7 @@ func TestTrafficPreview(t *testing.T) {
|
||||
t.Skip("manual visual preview")
|
||||
}
|
||||
s, a := trafficFixture(t)
|
||||
s.SaveTrafficSettings(TrafficSettings{Enabled: true, NetworkEnabled: true, AgentID: a.ID, ServerCountry: "RU"})
|
||||
s.SaveTrafficSettings(TrafficSettings{Enabled: true, NetworkEnabled: true, MonitoringRules: []MonitoringRule{{IP: "192.168.0.10"}}, AgentID: a.ID, ServerCountry: "RU"})
|
||||
mux := http.NewServeMux()
|
||||
trafficRoutes(mux, s)
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -54,6 +54,20 @@ func TestTrafficPreview(t *testing.T) {
|
||||
if k%5 == 0 && f.Protocol == "tcp" {
|
||||
f.State = "SYN_SENT"
|
||||
}
|
||||
if k%7 == 0 {
|
||||
f.Protocol = "icmp"
|
||||
f.State = "TRACKED"
|
||||
f.SourcePort = 0
|
||||
f.DestinationPort = 0
|
||||
f.ReplySourcePort = 0
|
||||
f.ReplyDestinationPort = 0
|
||||
}
|
||||
if k == 11 {
|
||||
f.Source = "192.168.0.12"
|
||||
f.Destination = "1.1.1.1"
|
||||
f.ReplySource = "1.1.1.1"
|
||||
f.ReplyDestination = "192.168.0.12"
|
||||
}
|
||||
flows = append(flows, f)
|
||||
}
|
||||
s.SaveNetwork(a.ID, NetworkSnapshot{At: time.Now().Unix(), Flows: flows, FirewallAt: time.Now().Unix(), Firewall: []FirewallCounter{{Name: "DEMO ip/crowdsec/drop #3", Packets: 12345, Bytes: 654321}}})
|
||||
|
||||
Reference in New Issue
Block a user