mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-15 14:20:57 +00:00
Fix several minor issues
This commit is contained in:
@@ -88,8 +88,9 @@ var txMethodMap = map[int]string{
|
|||||||
}
|
}
|
||||||
|
|
||||||
type AMQPWrapper struct {
|
type AMQPWrapper struct {
|
||||||
Method string
|
Method string `json:"method"`
|
||||||
Details interface{}
|
Url string `json:"url"`
|
||||||
|
Details interface{} `json:"details"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, emitter api.Emitter) {
|
func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, emitter api.Emitter) {
|
||||||
@@ -99,7 +100,8 @@ func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, em
|
|||||||
Payload: AMQPPayload{
|
Payload: AMQPPayload{
|
||||||
Type: "basic_publish",
|
Type: "basic_publish",
|
||||||
Data: &AMQPWrapper{
|
Data: &AMQPWrapper{
|
||||||
Method: "Basic Publish",
|
Method: basicMethodMap[40],
|
||||||
|
Url: event.Exchange,
|
||||||
Details: event,
|
Details: event,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -107,7 +109,7 @@ func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, em
|
|||||||
item := &api.OutputChannelItem{
|
item := &api.OutputChannelItem{
|
||||||
Protocol: protocol,
|
Protocol: protocol,
|
||||||
Timestamp: time.Now().UnixNano() / int64(time.Millisecond),
|
Timestamp: time.Now().UnixNano() / int64(time.Millisecond),
|
||||||
ConnectionInfo: nil,
|
ConnectionInfo: connectionInfo,
|
||||||
Pair: &api.RequestResponsePair{
|
Pair: &api.RequestResponsePair{
|
||||||
Request: *request,
|
Request: *request,
|
||||||
Response: api.GenericMessage{},
|
Response: api.GenericMessage{},
|
||||||
@@ -135,7 +137,7 @@ func representBasicPublish(event map[string]interface{}) []interface{} {
|
|||||||
})
|
})
|
||||||
rep = append(rep, map[string]string{
|
rep = append(rep, map[string]string{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"title": "Details",
|
"title": "details",
|
||||||
"data": string(details),
|
"data": string(details),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -204,7 +204,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, em
|
|||||||
|
|
||||||
func (d dissecting) Analyze(item *api.OutputChannelItem, entryId string, resolvedSource string, resolvedDestination string) *api.MizuEntry {
|
func (d dissecting) Analyze(item *api.OutputChannelItem, entryId string, 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{})
|
||||||
entryBytes, _ := json.Marshal(item.Pair)
|
entryBytes, _ := json.Marshal(item.Pair)
|
||||||
service := fmt.Sprintf("amqp")
|
service := fmt.Sprintf("amqp")
|
||||||
return &api.MizuEntry{
|
return &api.MizuEntry{
|
||||||
@@ -212,19 +212,19 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, entryId string, resolve
|
|||||||
EntryId: entryId,
|
EntryId: entryId,
|
||||||
Entry: string(entryBytes),
|
Entry: string(entryBytes),
|
||||||
Url: fmt.Sprintf("%s%s", service, reqDetails["Exchange"].(string)),
|
Url: fmt.Sprintf("%s%s", service, reqDetails["Exchange"].(string)),
|
||||||
Method: request["Method"].(string),
|
Method: request["method"].(string),
|
||||||
Status: 0,
|
Status: 0,
|
||||||
RequestSenderIp: "",
|
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
||||||
Service: service,
|
Service: service,
|
||||||
Timestamp: item.Timestamp,
|
Timestamp: item.Timestamp,
|
||||||
Path: reqDetails["Exchange"].(string),
|
Path: reqDetails["Exchange"].(string),
|
||||||
ResolvedSource: resolvedSource,
|
ResolvedSource: resolvedSource,
|
||||||
ResolvedDestination: resolvedDestination,
|
ResolvedDestination: resolvedDestination,
|
||||||
SourceIp: "",
|
SourceIp: item.ConnectionInfo.ClientIP,
|
||||||
DestinationIp: "",
|
DestinationIp: item.ConnectionInfo.ServerIP,
|
||||||
SourcePort: "",
|
SourcePort: item.ConnectionInfo.ClientPort,
|
||||||
DestinationPort: "",
|
DestinationPort: item.ConnectionInfo.ServerPort,
|
||||||
IsOutgoing: true,
|
IsOutgoing: item.ConnectionInfo.IsOutgoing,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -260,9 +260,9 @@ func (d dissecting) Represent(entry string) ([]byte, error) {
|
|||||||
request := root["request"].(map[string]interface{})["payload"].(map[string]interface{})
|
request := root["request"].(map[string]interface{})["payload"].(map[string]interface{})
|
||||||
log.Printf("request: %+v\n", request)
|
log.Printf("request: %+v\n", request)
|
||||||
var repRequest []interface{}
|
var repRequest []interface{}
|
||||||
details := request["Details"].(map[string]interface{})
|
details := request["details"].(map[string]interface{})
|
||||||
switch request["Method"].(string) {
|
switch request["method"].(string) {
|
||||||
case "Basic Publish":
|
case basicMethodMap[40]:
|
||||||
repRequest = representBasicPublish(details)
|
repRequest = representBasicPublish(details)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@@ -7,22 +7,22 @@ const SectionsRepresentation: React.FC<any> = ({data, color}) => {
|
|||||||
const sections = []
|
const sections = []
|
||||||
|
|
||||||
if (data !== undefined) {
|
if (data !== undefined) {
|
||||||
data.forEach((row) => {
|
for (const [i, row] of data.entries()) {
|
||||||
switch (row.type) {
|
switch (row.type) {
|
||||||
case "table":
|
case "table":
|
||||||
sections.push(
|
sections.push(
|
||||||
<HAREntryTableSection title={row.title} color={color} arrayToIterate={JSON.parse(row.data)}/>
|
<HAREntryTableSection key={i} title={row.title} color={color} arrayToIterate={JSON.parse(row.data)}/>
|
||||||
)
|
)
|
||||||
break;
|
break;
|
||||||
case "body":
|
case "body":
|
||||||
sections.push(
|
sections.push(
|
||||||
<HAREntryBodySection color={color} content={row.data} encoding={row.encoding} contentType={row.mime_type}/>
|
<HAREntryBodySection key={i} color={color} content={row.data} encoding={row.encoding} contentType={row.mime_type}/>
|
||||||
)
|
)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <>{sections}</>;
|
return <>{sections}</>;
|
||||||
|
Reference in New Issue
Block a user