mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-03 11:35:12 +00:00
Remove unnecessary fields and split service
into src.name
and dst.name
(#525)
* Remove unnecessary fields and split `service` into `src.name` and `dst.name` * Don't fall back to IP address but instead display `[Unresolved]` text * Fix the CSS issues in the plus icon position and replace the separator `->` text with `SwapHorizIcon`
This commit is contained in:
@@ -136,7 +136,7 @@ func startReadingChannel(outputItems <-chan *tapApi.OutputChannelItem, extension
|
|||||||
|
|
||||||
harEntry, err := utils.NewEntry(mizuEntry.Request, mizuEntry.Response, mizuEntry.StartTime, mizuEntry.ElapsedTime)
|
harEntry, err := utils.NewEntry(mizuEntry.Request, mizuEntry.Response, mizuEntry.StartTime, mizuEntry.ElapsedTime)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
rules, _, _ := models.RunValidationRulesState(*harEntry, mizuEntry.Service)
|
rules, _, _ := models.RunValidationRulesState(*harEntry, mizuEntry.Destination.Name)
|
||||||
baseEntry.Rules = rules
|
baseEntry.Rules = rules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -119,7 +119,7 @@ func GetEntry(c *gin.Context) {
|
|||||||
var isRulesEnabled bool
|
var isRulesEnabled bool
|
||||||
if entry.Protocol.Name == "http" {
|
if entry.Protocol.Name == "http" {
|
||||||
harEntry, _ := utils.NewEntry(entry.Request, entry.Response, entry.StartTime, entry.ElapsedTime)
|
harEntry, _ := utils.NewEntry(entry.Request, entry.Response, entry.StartTime, entry.ElapsedTime)
|
||||||
_, rulesMatched, _isRulesEnabled := models.RunValidationRulesState(*harEntry, entry.Service)
|
_, rulesMatched, _isRulesEnabled := models.RunValidationRulesState(*harEntry, entry.Destination.Name)
|
||||||
isRulesEnabled = _isRulesEnabled
|
isRulesEnabled = _isRulesEnabled
|
||||||
inrec, _ := json.Marshal(rulesMatched)
|
inrec, _ := json.Marshal(rulesMatched)
|
||||||
json.Unmarshal(inrec, &rules)
|
json.Unmarshal(inrec, &rules)
|
||||||
|
@@ -251,12 +251,12 @@ func syncEntriesImpl(token string, model string, envPrefix string, uploadInterva
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if entry.ResolvedSource != "" {
|
if entry.Source.Name != "" {
|
||||||
harEntry.Request.Headers = append(harEntry.Request.Headers, har.Header{Name: "x-mizu-source", Value: entry.ResolvedSource})
|
harEntry.Request.Headers = append(harEntry.Request.Headers, har.Header{Name: "x-mizu-source", Value: entry.Source.Name})
|
||||||
}
|
}
|
||||||
if entry.ResolvedDestination != "" {
|
if entry.Destination.Name != "" {
|
||||||
harEntry.Request.Headers = append(harEntry.Request.Headers, har.Header{Name: "x-mizu-destination", Value: entry.ResolvedDestination})
|
harEntry.Request.Headers = append(harEntry.Request.Headers, har.Header{Name: "x-mizu-destination", Value: entry.Destination.Name})
|
||||||
harEntry.Request.URL = utils.SetHostname(harEntry.Request.URL, entry.ResolvedDestination)
|
harEntry.Request.URL = utils.SetHostname(harEntry.Request.URL, entry.Destination.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// go's default marshal behavior is to encode []byte fields to base64, python's default unmarshal behavior is to not decode []byte fields from base64
|
// go's default marshal behavior is to encode []byte fields to base64, python's default unmarshal behavior is to not decode []byte fields from base64
|
||||||
|
@@ -129,19 +129,10 @@ type MizuEntry struct {
|
|||||||
Response map[string]interface{} `json:"response"`
|
Response map[string]interface{} `json:"response"`
|
||||||
Base *BaseEntryDetails `json:"base"`
|
Base *BaseEntryDetails `json:"base"`
|
||||||
Summary string `json:"summary"`
|
Summary string `json:"summary"`
|
||||||
Url string `json:"url"`
|
|
||||||
Method string `json:"method"`
|
Method string `json:"method"`
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
RequestSenderIp string `json:"requestSenderIp"`
|
|
||||||
Service string `json:"service"`
|
|
||||||
ElapsedTime int64 `json:"elapsedTime"`
|
ElapsedTime int64 `json:"elapsedTime"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
ResolvedSource string `json:"resolvedSource,omitempty"`
|
|
||||||
ResolvedDestination string `json:"resolvedDestination,omitempty"`
|
|
||||||
SourceIp string `json:"sourceIp,omitempty"`
|
|
||||||
DestinationIp string `json:"destinationIp,omitempty"`
|
|
||||||
SourcePort string `json:"sourcePort,omitempty"`
|
|
||||||
DestinationPort string `json:"destinationPort,omitempty"`
|
|
||||||
IsOutgoing bool `json:"isOutgoing,omitempty"`
|
IsOutgoing bool `json:"isOutgoing,omitempty"`
|
||||||
ContractStatus ContractStatus `json:"contractStatus,omitempty"`
|
ContractStatus ContractStatus `json:"contractStatus,omitempty"`
|
||||||
ContractRequestReason string `json:"contractRequestReason,omitempty"`
|
ContractRequestReason string `json:"contractRequestReason,omitempty"`
|
||||||
@@ -160,24 +151,20 @@ type MizuEntryWrapper struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BaseEntryDetails struct {
|
type BaseEntryDetails struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
Protocol Protocol `json:"protocol,omitempty"`
|
Protocol Protocol `json:"protocol,omitempty"`
|
||||||
Url string `json:"url,omitempty"`
|
Url string `json:"url,omitempty"`
|
||||||
RequestSenderIp string `json:"requestSenderIp,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
Service string `json:"service,omitempty"`
|
Summary string `json:"summary,omitempty"`
|
||||||
Path string `json:"path,omitempty"`
|
StatusCode int `json:"statusCode"`
|
||||||
Summary string `json:"summary,omitempty"`
|
Method string `json:"method,omitempty"`
|
||||||
StatusCode int `json:"statusCode"`
|
Timestamp int64 `json:"timestamp,omitempty"`
|
||||||
Method string `json:"method,omitempty"`
|
Source *TCP `json:"src"`
|
||||||
Timestamp int64 `json:"timestamp,omitempty"`
|
Destination *TCP `json:"dst"`
|
||||||
SourceIp string `json:"sourceIp,omitempty"`
|
IsOutgoing bool `json:"isOutgoing,omitempty"`
|
||||||
DestinationIp string `json:"destinationIp,omitempty"`
|
Latency int64 `json:"latency"`
|
||||||
SourcePort string `json:"sourcePort,omitempty"`
|
Rules ApplicableRules `json:"rules,omitempty"`
|
||||||
DestinationPort string `json:"destinationPort,omitempty"`
|
ContractStatus ContractStatus `json:"contractStatus"`
|
||||||
IsOutgoing bool `json:"isOutgoing,omitempty"`
|
|
||||||
Latency int64 `json:"latency"`
|
|
||||||
Rules ApplicableRules `json:"rules,omitempty"`
|
|
||||||
ContractStatus ContractStatus `json:"contractStatus"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ApplicableRules struct {
|
type ApplicableRules struct {
|
||||||
@@ -202,18 +189,13 @@ type DataUnmarshaler interface {
|
|||||||
func (bed *BaseEntryDetails) UnmarshalData(entry *MizuEntry) error {
|
func (bed *BaseEntryDetails) UnmarshalData(entry *MizuEntry) error {
|
||||||
bed.Protocol = entry.Protocol
|
bed.Protocol = entry.Protocol
|
||||||
bed.Id = entry.Id
|
bed.Id = entry.Id
|
||||||
bed.Url = entry.Url
|
|
||||||
bed.RequestSenderIp = entry.RequestSenderIp
|
|
||||||
bed.Service = entry.Service
|
|
||||||
bed.Path = entry.Path
|
bed.Path = entry.Path
|
||||||
bed.Summary = entry.Path
|
bed.Summary = entry.Summary
|
||||||
bed.StatusCode = entry.Status
|
bed.StatusCode = entry.Status
|
||||||
bed.Method = entry.Method
|
bed.Method = entry.Method
|
||||||
bed.Timestamp = entry.Timestamp
|
bed.Timestamp = entry.Timestamp
|
||||||
bed.SourceIp = entry.SourceIp
|
bed.Source = entry.Source
|
||||||
bed.DestinationIp = entry.DestinationIp
|
bed.Destination = entry.Destination
|
||||||
bed.SourcePort = entry.SourcePort
|
|
||||||
bed.DestinationPort = entry.DestinationPort
|
|
||||||
bed.IsOutgoing = entry.IsOutgoing
|
bed.IsOutgoing = entry.IsOutgoing
|
||||||
bed.Latency = entry.ElapsedTime
|
bed.Latency = entry.ElapsedTime
|
||||||
bed.ContractStatus = entry.ContractStatus
|
bed.ContractStatus = entry.ContractStatus
|
||||||
@@ -271,7 +253,6 @@ func (h HTTPPayload) MarshalJSON() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
return json.Marshal(&HTTPWrapper{
|
return json.Marshal(&HTTPWrapper{
|
||||||
Method: harRequest.Method,
|
Method: harRequest.Method,
|
||||||
Url: "",
|
|
||||||
Details: harRequest,
|
Details: harRequest,
|
||||||
RawRequest: &HTTPRequestWrapper{Request: h.Data.(*http.Request)},
|
RawRequest: &HTTPRequestWrapper{Request: h.Data.(*http.Request)},
|
||||||
})
|
})
|
||||||
|
@@ -226,12 +226,6 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
|
|||||||
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
||||||
request := item.Pair.Request.Payload.(map[string]interface{})
|
request := item.Pair.Request.Payload.(map[string]interface{})
|
||||||
reqDetails := request["details"].(map[string]interface{})
|
reqDetails := request["details"].(map[string]interface{})
|
||||||
service := "amqp"
|
|
||||||
if resolvedDestination != "" {
|
|
||||||
service = resolvedDestination
|
|
||||||
} else if resolvedSource != "" {
|
|
||||||
service = resolvedSource
|
|
||||||
}
|
|
||||||
|
|
||||||
summary := ""
|
summary := ""
|
||||||
switch request["method"] {
|
switch request["method"] {
|
||||||
@@ -279,45 +273,31 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
IP: item.ConnectionInfo.ServerIP,
|
IP: item.ConnectionInfo.ServerIP,
|
||||||
Port: item.ConnectionInfo.ServerPort,
|
Port: item.ConnectionInfo.ServerPort,
|
||||||
},
|
},
|
||||||
Outgoing: item.ConnectionInfo.IsOutgoing,
|
Outgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
Request: reqDetails,
|
Request: reqDetails,
|
||||||
Url: fmt.Sprintf("%s%s", service, summary),
|
Method: request["method"].(string),
|
||||||
Method: request["method"].(string),
|
Status: 0,
|
||||||
Status: 0,
|
Timestamp: item.Timestamp,
|
||||||
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
StartTime: item.Pair.Request.CaptureTime,
|
||||||
Service: service,
|
ElapsedTime: 0,
|
||||||
Timestamp: item.Timestamp,
|
Summary: summary,
|
||||||
StartTime: item.Pair.Request.CaptureTime,
|
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
ElapsedTime: 0,
|
|
||||||
Summary: summary,
|
|
||||||
ResolvedSource: resolvedSource,
|
|
||||||
ResolvedDestination: resolvedDestination,
|
|
||||||
SourceIp: item.ConnectionInfo.ClientIP,
|
|
||||||
DestinationIp: item.ConnectionInfo.ServerIP,
|
|
||||||
SourcePort: item.ConnectionInfo.ClientPort,
|
|
||||||
DestinationPort: item.ConnectionInfo.ServerPort,
|
|
||||||
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
||||||
return &api.BaseEntryDetails{
|
return &api.BaseEntryDetails{
|
||||||
Id: entry.Id,
|
Id: entry.Id,
|
||||||
Protocol: protocol,
|
Protocol: protocol,
|
||||||
Url: entry.Url,
|
Summary: entry.Summary,
|
||||||
RequestSenderIp: entry.RequestSenderIp,
|
StatusCode: entry.Status,
|
||||||
Service: entry.Service,
|
Method: entry.Method,
|
||||||
Summary: entry.Summary,
|
Timestamp: entry.Timestamp,
|
||||||
StatusCode: entry.Status,
|
Source: entry.Source,
|
||||||
Method: entry.Method,
|
Destination: entry.Destination,
|
||||||
Timestamp: entry.Timestamp,
|
IsOutgoing: entry.IsOutgoing,
|
||||||
SourceIp: entry.SourceIp,
|
Latency: entry.ElapsedTime,
|
||||||
DestinationIp: entry.DestinationIp,
|
|
||||||
SourcePort: entry.SourcePort,
|
|
||||||
DestinationPort: entry.DestinationPort,
|
|
||||||
IsOutgoing: entry.IsOutgoing,
|
|
||||||
Latency: entry.ElapsedTime,
|
|
||||||
Rules: api.ApplicableRules{
|
Rules: api.ApplicableRules{
|
||||||
Latency: 0,
|
Latency: 0,
|
||||||
Status: false,
|
Status: false,
|
||||||
|
@@ -158,7 +158,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
||||||
var host, authority, path, service string
|
var host, authority, path string
|
||||||
|
|
||||||
request := item.Pair.Request.Payload.(map[string]interface{})
|
request := item.Pair.Request.Payload.(map[string]interface{})
|
||||||
response := item.Pair.Response.Payload.(map[string]interface{})
|
response := item.Pair.Response.Payload.(map[string]interface{})
|
||||||
@@ -191,9 +191,13 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if item.Protocol.Version == "2.0" && !isRequestUpgradedH2C {
|
if item.Protocol.Version == "2.0" && !isRequestUpgradedH2C {
|
||||||
service = authority
|
if resolvedDestination == "" {
|
||||||
|
resolvedDestination = authority
|
||||||
|
}
|
||||||
|
if resolvedDestination == "" {
|
||||||
|
resolvedDestination = host
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
service = host
|
|
||||||
u, err := url.Parse(reqDetails["url"].(string))
|
u, err := url.Parse(reqDetails["url"].(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
path = reqDetails["url"].(string)
|
path = reqDetails["url"].(string)
|
||||||
@@ -221,12 +225,6 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
reqDetails["_queryString"] = reqDetails["queryString"]
|
reqDetails["_queryString"] = reqDetails["queryString"]
|
||||||
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryString"].([]interface{}))
|
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryString"].([]interface{}))
|
||||||
|
|
||||||
if resolvedDestination != "" {
|
|
||||||
service = resolvedDestination
|
|
||||||
} else if resolvedSource != "" {
|
|
||||||
service = resolvedSource
|
|
||||||
}
|
|
||||||
|
|
||||||
method := reqDetails["method"].(string)
|
method := reqDetails["method"].(string)
|
||||||
statusCode := int(resDetails["status"].(float64))
|
statusCode := int(resDetails["status"].(float64))
|
||||||
if item.Protocol.Abbreviation == "gRPC" {
|
if item.Protocol.Abbreviation == "gRPC" {
|
||||||
@@ -255,47 +253,33 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
IP: item.ConnectionInfo.ServerIP,
|
IP: item.ConnectionInfo.ServerIP,
|
||||||
Port: item.ConnectionInfo.ServerPort,
|
Port: item.ConnectionInfo.ServerPort,
|
||||||
},
|
},
|
||||||
Outgoing: item.ConnectionInfo.IsOutgoing,
|
Outgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
Request: reqDetails,
|
Request: reqDetails,
|
||||||
Response: resDetails,
|
Response: resDetails,
|
||||||
Url: fmt.Sprintf("%s%s", service, path),
|
Method: method,
|
||||||
Method: method,
|
Status: statusCode,
|
||||||
Status: statusCode,
|
Timestamp: item.Timestamp,
|
||||||
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
StartTime: item.Pair.Request.CaptureTime,
|
||||||
Service: service,
|
ElapsedTime: elapsedTime,
|
||||||
Timestamp: item.Timestamp,
|
Summary: path,
|
||||||
StartTime: item.Pair.Request.CaptureTime,
|
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
ElapsedTime: elapsedTime,
|
HTTPPair: string(httpPair),
|
||||||
Summary: path,
|
|
||||||
ResolvedSource: resolvedSource,
|
|
||||||
ResolvedDestination: resolvedDestination,
|
|
||||||
SourceIp: item.ConnectionInfo.ClientIP,
|
|
||||||
DestinationIp: item.ConnectionInfo.ServerIP,
|
|
||||||
SourcePort: item.ConnectionInfo.ClientPort,
|
|
||||||
DestinationPort: item.ConnectionInfo.ServerPort,
|
|
||||||
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
|
||||||
HTTPPair: string(httpPair),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
||||||
return &api.BaseEntryDetails{
|
return &api.BaseEntryDetails{
|
||||||
Id: entry.Id,
|
Id: entry.Id,
|
||||||
Protocol: entry.Protocol,
|
Protocol: entry.Protocol,
|
||||||
Url: entry.Url,
|
Path: entry.Path,
|
||||||
RequestSenderIp: entry.RequestSenderIp,
|
Summary: entry.Summary,
|
||||||
Service: entry.Service,
|
StatusCode: entry.Status,
|
||||||
Path: entry.Path,
|
Method: entry.Method,
|
||||||
Summary: entry.Summary,
|
Timestamp: entry.Timestamp,
|
||||||
StatusCode: entry.Status,
|
Source: entry.Source,
|
||||||
Method: entry.Method,
|
Destination: entry.Destination,
|
||||||
Timestamp: entry.Timestamp,
|
IsOutgoing: entry.IsOutgoing,
|
||||||
SourceIp: entry.SourceIp,
|
Latency: entry.ElapsedTime,
|
||||||
DestinationIp: entry.DestinationIp,
|
|
||||||
SourcePort: entry.SourcePort,
|
|
||||||
DestinationPort: entry.DestinationPort,
|
|
||||||
IsOutgoing: entry.IsOutgoing,
|
|
||||||
Latency: entry.ElapsedTime,
|
|
||||||
Rules: api.ApplicableRules{
|
Rules: api.ApplicableRules{
|
||||||
Latency: 0,
|
Latency: 0,
|
||||||
Status: false,
|
Status: false,
|
||||||
|
@@ -65,12 +65,6 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
|
|||||||
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
||||||
request := item.Pair.Request.Payload.(map[string]interface{})
|
request := item.Pair.Request.Payload.(map[string]interface{})
|
||||||
reqDetails := request["details"].(map[string]interface{})
|
reqDetails := request["details"].(map[string]interface{})
|
||||||
service := "kafka"
|
|
||||||
if resolvedDestination != "" {
|
|
||||||
service = resolvedDestination
|
|
||||||
} else if resolvedSource != "" {
|
|
||||||
service = resolvedSource
|
|
||||||
}
|
|
||||||
apiKey := ApiKey(reqDetails["apiKey"].(float64))
|
apiKey := ApiKey(reqDetails["apiKey"].(float64))
|
||||||
|
|
||||||
summary := ""
|
summary := ""
|
||||||
@@ -164,45 +158,31 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
IP: item.ConnectionInfo.ServerIP,
|
IP: item.ConnectionInfo.ServerIP,
|
||||||
Port: item.ConnectionInfo.ServerPort,
|
Port: item.ConnectionInfo.ServerPort,
|
||||||
},
|
},
|
||||||
Outgoing: item.ConnectionInfo.IsOutgoing,
|
Outgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
Request: reqDetails,
|
Request: reqDetails,
|
||||||
Response: item.Pair.Response.Payload.(map[string]interface{})["details"].(map[string]interface{}),
|
Response: item.Pair.Response.Payload.(map[string]interface{})["details"].(map[string]interface{}),
|
||||||
Url: fmt.Sprintf("%s%s", service, summary),
|
Method: apiNames[apiKey],
|
||||||
Method: apiNames[apiKey],
|
Status: 0,
|
||||||
Status: 0,
|
Timestamp: item.Timestamp,
|
||||||
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
StartTime: item.Pair.Request.CaptureTime,
|
||||||
Service: service,
|
ElapsedTime: elapsedTime,
|
||||||
Timestamp: item.Timestamp,
|
Summary: summary,
|
||||||
StartTime: item.Pair.Request.CaptureTime,
|
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
ElapsedTime: elapsedTime,
|
|
||||||
Summary: summary,
|
|
||||||
ResolvedSource: resolvedSource,
|
|
||||||
ResolvedDestination: resolvedDestination,
|
|
||||||
SourceIp: item.ConnectionInfo.ClientIP,
|
|
||||||
DestinationIp: item.ConnectionInfo.ServerIP,
|
|
||||||
SourcePort: item.ConnectionInfo.ClientPort,
|
|
||||||
DestinationPort: item.ConnectionInfo.ServerPort,
|
|
||||||
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
||||||
return &api.BaseEntryDetails{
|
return &api.BaseEntryDetails{
|
||||||
Id: entry.Id,
|
Id: entry.Id,
|
||||||
Protocol: _protocol,
|
Protocol: _protocol,
|
||||||
Url: entry.Url,
|
Summary: entry.Summary,
|
||||||
RequestSenderIp: entry.RequestSenderIp,
|
StatusCode: entry.Status,
|
||||||
Service: entry.Service,
|
Method: entry.Method,
|
||||||
Summary: entry.Summary,
|
Timestamp: entry.Timestamp,
|
||||||
StatusCode: entry.Status,
|
Source: entry.Source,
|
||||||
Method: entry.Method,
|
Destination: entry.Destination,
|
||||||
Timestamp: entry.Timestamp,
|
IsOutgoing: entry.IsOutgoing,
|
||||||
SourceIp: entry.SourceIp,
|
Latency: entry.ElapsedTime,
|
||||||
DestinationIp: entry.DestinationIp,
|
|
||||||
SourcePort: entry.SourcePort,
|
|
||||||
DestinationPort: entry.DestinationPort,
|
|
||||||
IsOutgoing: entry.IsOutgoing,
|
|
||||||
Latency: entry.ElapsedTime,
|
|
||||||
Rules: api.ApplicableRules{
|
Rules: api.ApplicableRules{
|
||||||
Latency: 0,
|
Latency: 0,
|
||||||
Status: false,
|
Status: false,
|
||||||
|
@@ -65,13 +65,6 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
reqDetails := request["details"].(map[string]interface{})
|
reqDetails := request["details"].(map[string]interface{})
|
||||||
resDetails := response["details"].(map[string]interface{})
|
resDetails := response["details"].(map[string]interface{})
|
||||||
|
|
||||||
service := "redis"
|
|
||||||
if resolvedDestination != "" {
|
|
||||||
service = resolvedDestination
|
|
||||||
} else if resolvedSource != "" {
|
|
||||||
service = resolvedSource
|
|
||||||
}
|
|
||||||
|
|
||||||
method := ""
|
method := ""
|
||||||
if reqDetails["command"] != nil {
|
if reqDetails["command"] != nil {
|
||||||
method = reqDetails["command"].(string)
|
method = reqDetails["command"].(string)
|
||||||
@@ -99,46 +92,32 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
IP: item.ConnectionInfo.ServerIP,
|
IP: item.ConnectionInfo.ServerIP,
|
||||||
Port: item.ConnectionInfo.ServerPort,
|
Port: item.ConnectionInfo.ServerPort,
|
||||||
},
|
},
|
||||||
Outgoing: item.ConnectionInfo.IsOutgoing,
|
Outgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
Request: reqDetails,
|
Request: reqDetails,
|
||||||
Response: resDetails,
|
Response: resDetails,
|
||||||
Url: fmt.Sprintf("%s%s", service, summary),
|
Method: method,
|
||||||
Method: method,
|
Status: 0,
|
||||||
Status: 0,
|
Timestamp: item.Timestamp,
|
||||||
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
StartTime: item.Pair.Request.CaptureTime,
|
||||||
Service: service,
|
ElapsedTime: elapsedTime,
|
||||||
Timestamp: item.Timestamp,
|
Summary: summary,
|
||||||
StartTime: item.Pair.Request.CaptureTime,
|
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
ElapsedTime: elapsedTime,
|
|
||||||
Summary: summary,
|
|
||||||
ResolvedSource: resolvedSource,
|
|
||||||
ResolvedDestination: resolvedDestination,
|
|
||||||
SourceIp: item.ConnectionInfo.ClientIP,
|
|
||||||
DestinationIp: item.ConnectionInfo.ServerIP,
|
|
||||||
SourcePort: item.ConnectionInfo.ClientPort,
|
|
||||||
DestinationPort: item.ConnectionInfo.ServerPort,
|
|
||||||
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
func (d dissecting) Summarize(entry *api.MizuEntry) *api.BaseEntryDetails {
|
||||||
return &api.BaseEntryDetails{
|
return &api.BaseEntryDetails{
|
||||||
Id: entry.Id,
|
Id: entry.Id,
|
||||||
Protocol: protocol,
|
Protocol: protocol,
|
||||||
Url: entry.Url,
|
Summary: entry.Summary,
|
||||||
RequestSenderIp: entry.RequestSenderIp,
|
StatusCode: entry.Status,
|
||||||
Service: entry.Service,
|
Method: entry.Method,
|
||||||
Summary: entry.Summary,
|
Timestamp: entry.Timestamp,
|
||||||
StatusCode: entry.Status,
|
Source: entry.Source,
|
||||||
Method: entry.Method,
|
Destination: entry.Destination,
|
||||||
Timestamp: entry.Timestamp,
|
IsOutgoing: entry.IsOutgoing,
|
||||||
SourceIp: entry.SourceIp,
|
Latency: entry.ElapsedTime,
|
||||||
DestinationIp: entry.DestinationIp,
|
|
||||||
SourcePort: entry.SourcePort,
|
|
||||||
DestinationPort: entry.DestinationPort,
|
|
||||||
IsOutgoing: entry.IsOutgoing,
|
|
||||||
Latency: entry.ElapsedTime,
|
|
||||||
Rules: api.ApplicableRules{
|
Rules: api.ApplicableRules{
|
||||||
Latency: 0,
|
Latency: 0,
|
||||||
Status: false,
|
Status: false,
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
.ruleNumberTextSuccess
|
.ruleNumberTextSuccess
|
||||||
color: #219653
|
color: #219653
|
||||||
|
|
||||||
.service
|
.resolvedName
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Moment from 'moment';
|
import Moment from 'moment';
|
||||||
|
import SwapHorizIcon from '@material-ui/icons/SwapHoriz';
|
||||||
import styles from './EntryListItem.module.sass';
|
import styles from './EntryListItem.module.sass';
|
||||||
import StatusCode, {getClassification, StatusCodeClassification} from "../UI/StatusCode";
|
import StatusCode, {getClassification, StatusCodeClassification} from "../UI/StatusCode";
|
||||||
import Protocol, {ProtocolInterface} from "../UI/Protocol"
|
import Protocol, {ProtocolInterface} from "../UI/Protocol"
|
||||||
@@ -12,19 +13,21 @@ import outgoingIconSuccess from "../assets/outgoing-traffic-success.svg"
|
|||||||
import outgoingIconFailure from "../assets/outgoing-traffic-failure.svg"
|
import outgoingIconFailure from "../assets/outgoing-traffic-failure.svg"
|
||||||
import outgoingIconNeutral from "../assets/outgoing-traffic-neutral.svg"
|
import outgoingIconNeutral from "../assets/outgoing-traffic-neutral.svg"
|
||||||
|
|
||||||
|
interface TCPInterface {
|
||||||
|
ip: string
|
||||||
|
port: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
interface Entry {
|
interface Entry {
|
||||||
protocol: ProtocolInterface,
|
protocol: ProtocolInterface,
|
||||||
method?: string,
|
method?: string,
|
||||||
summary: string,
|
summary: string,
|
||||||
service: string,
|
|
||||||
id: number,
|
id: number,
|
||||||
statusCode?: number;
|
statusCode?: number;
|
||||||
url?: string;
|
|
||||||
timestamp: Date;
|
timestamp: Date;
|
||||||
sourceIp: string,
|
src: TCPInterface,
|
||||||
sourcePort: string,
|
dst: TCPInterface,
|
||||||
destinationIp: string,
|
|
||||||
destinationPort: string,
|
|
||||||
isOutgoing?: boolean;
|
isOutgoing?: boolean;
|
||||||
latency: number;
|
latency: number;
|
||||||
rules: Rules;
|
rules: Rules;
|
||||||
@@ -151,17 +154,33 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
</div>}
|
</div>}
|
||||||
<div className={styles.endpointServiceContainer} style={{paddingLeft: endpointServiceContainer}}>
|
<div className={styles.endpointServiceContainer} style={{paddingLeft: endpointServiceContainer}}>
|
||||||
<Summary method={entry.method} summary={entry.summary} updateQuery={updateQuery}/>
|
<Summary method={entry.method} summary={entry.summary} updateQuery={updateQuery}/>
|
||||||
<div className={styles.service}>
|
<div className={styles.resolvedName}>
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`service == "${entry.service}"`}
|
query={`src.name == "${entry.src.name}"`}
|
||||||
|
updateQuery={updateQuery}
|
||||||
|
displayIconOnMouseOver={true}
|
||||||
|
flipped={true}
|
||||||
|
style={{marginTop: "-4px", overflow: "visible"}}
|
||||||
|
iconStyle={{marginTop: "4px", left: "68px", position: "absolute"}}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
title="Source Name"
|
||||||
|
>
|
||||||
|
{entry.src.name ? entry.src.name : "[Unresolved]"}
|
||||||
|
</span>
|
||||||
|
</Queryable>
|
||||||
|
<SwapHorizIcon style={{color: entry.protocol.backgroundColor, marginTop: "-2px"}}></SwapHorizIcon>
|
||||||
|
<Queryable
|
||||||
|
query={`dst.name == "${entry.dst.name}"`}
|
||||||
updateQuery={updateQuery}
|
updateQuery={updateQuery}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
style={{marginTop: "-4px"}}
|
style={{marginTop: "-4px"}}
|
||||||
|
iconStyle={{marginTop: "4px", marginLeft: "-2px"}}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
title="Service Name"
|
title="Destination Name"
|
||||||
>
|
>
|
||||||
{entry.service}
|
{entry.dst.name ? entry.dst.name : "[Unresolved]"}
|
||||||
</span>
|
</span>
|
||||||
</Queryable>
|
</Queryable>
|
||||||
</div>
|
</div>
|
||||||
@@ -182,7 +201,7 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
}
|
}
|
||||||
<div className={styles.separatorRight}>
|
<div className={styles.separatorRight}>
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`src.ip == "${entry.sourceIp}"`}
|
query={`src.ip == "${entry.src.ip}"`}
|
||||||
updateQuery={updateQuery}
|
updateQuery={updateQuery}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
flipped={true}
|
flipped={true}
|
||||||
@@ -192,12 +211,12 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
className={`${styles.tcpInfo} ${styles.ip}`}
|
className={`${styles.tcpInfo} ${styles.ip}`}
|
||||||
title="Source IP"
|
title="Source IP"
|
||||||
>
|
>
|
||||||
{entry.sourceIp}
|
{entry.src.ip}
|
||||||
</span>
|
</span>
|
||||||
</Queryable>
|
</Queryable>
|
||||||
<span className={`${styles.tcpInfo}`} style={{marginTop: "18px"}}>:</span>
|
<span className={`${styles.tcpInfo}`} style={{marginTop: "18px"}}>:</span>
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`src.port == "${entry.sourcePort}"`}
|
query={`src.port == "${entry.src.port}"`}
|
||||||
updateQuery={updateQuery}
|
updateQuery={updateQuery}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
flipped={true}
|
flipped={true}
|
||||||
@@ -207,7 +226,7 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
className={`${styles.tcpInfo} ${styles.port}`}
|
className={`${styles.tcpInfo} ${styles.port}`}
|
||||||
title="Source Port"
|
title="Source Port"
|
||||||
>
|
>
|
||||||
{entry.sourcePort}
|
{entry.src.port}
|
||||||
</span>
|
</span>
|
||||||
</Queryable>
|
</Queryable>
|
||||||
{entry.isOutgoing ?
|
{entry.isOutgoing ?
|
||||||
@@ -243,7 +262,7 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
</Queryable>
|
</Queryable>
|
||||||
}
|
}
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`dst.ip == "${entry.destinationIp}"`}
|
query={`dst.ip == "${entry.dst.ip}"`}
|
||||||
updateQuery={updateQuery}
|
updateQuery={updateQuery}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
flipped={false}
|
flipped={false}
|
||||||
@@ -253,12 +272,12 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
className={`${styles.tcpInfo} ${styles.ip}`}
|
className={`${styles.tcpInfo} ${styles.ip}`}
|
||||||
title="Destination IP"
|
title="Destination IP"
|
||||||
>
|
>
|
||||||
{entry.destinationIp}
|
{entry.dst.ip}
|
||||||
</span>
|
</span>
|
||||||
</Queryable>
|
</Queryable>
|
||||||
<span className={`${styles.tcpInfo}`} style={{marginTop: "18px"}}>:</span>
|
<span className={`${styles.tcpInfo}`} style={{marginTop: "18px"}}>:</span>
|
||||||
<Queryable
|
<Queryable
|
||||||
query={`dst.port == "${entry.destinationPort}"`}
|
query={`dst.port == "${entry.dst.port}"`}
|
||||||
updateQuery={updateQuery}
|
updateQuery={updateQuery}
|
||||||
displayIconOnMouseOver={true}
|
displayIconOnMouseOver={true}
|
||||||
flipped={false}
|
flipped={false}
|
||||||
@@ -267,7 +286,7 @@ export const EntryItem: React.FC<EntryProps> = ({entry, focusedEntryId, setFocus
|
|||||||
className={`${styles.tcpInfo} ${styles.port}`}
|
className={`${styles.tcpInfo} ${styles.port}`}
|
||||||
title="Destination Port"
|
title="Destination Port"
|
||||||
>
|
>
|
||||||
{entry.destinationPort}
|
{entry.dst.port}
|
||||||
</span>
|
</span>
|
||||||
</Queryable>
|
</Queryable>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -244,7 +244,7 @@ export const QueryForm: React.FC<QueryFormProps> = ({query, setQuery, background
|
|||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
isWrapped={false}
|
isWrapped={false}
|
||||||
showLineNumbers={false}
|
showLineNumbers={false}
|
||||||
code={`and service == "carts.sock-shop"`}
|
code={`and dst.name == "carts.sock-shop"`}
|
||||||
language="python"
|
language="python"
|
||||||
/>
|
/>
|
||||||
<Typography id="modal-modal-description">
|
<Typography id="modal-modal-description">
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 46 KiB |
Reference in New Issue
Block a user