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 {
|
||||
Method string
|
||||
Details interface{}
|
||||
Method string `json:"method"`
|
||||
Url string `json:"url"`
|
||||
Details interface{} `json:"details"`
|
||||
}
|
||||
|
||||
func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, emitter api.Emitter) {
|
||||
@@ -99,7 +100,8 @@ func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, em
|
||||
Payload: AMQPPayload{
|
||||
Type: "basic_publish",
|
||||
Data: &AMQPWrapper{
|
||||
Method: "Basic Publish",
|
||||
Method: basicMethodMap[40],
|
||||
Url: event.Exchange,
|
||||
Details: event,
|
||||
},
|
||||
},
|
||||
@@ -107,7 +109,7 @@ func emitBasicPublish(event BasicPublish, connectionInfo *api.ConnectionInfo, em
|
||||
item := &api.OutputChannelItem{
|
||||
Protocol: protocol,
|
||||
Timestamp: time.Now().UnixNano() / int64(time.Millisecond),
|
||||
ConnectionInfo: nil,
|
||||
ConnectionInfo: connectionInfo,
|
||||
Pair: &api.RequestResponsePair{
|
||||
Request: *request,
|
||||
Response: api.GenericMessage{},
|
||||
@@ -135,7 +137,7 @@ func representBasicPublish(event map[string]interface{}) []interface{} {
|
||||
})
|
||||
rep = append(rep, map[string]string{
|
||||
"type": "table",
|
||||
"title": "Details",
|
||||
"title": "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 {
|
||||
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)
|
||||
service := fmt.Sprintf("amqp")
|
||||
return &api.MizuEntry{
|
||||
@@ -212,19 +212,19 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, entryId string, resolve
|
||||
EntryId: entryId,
|
||||
Entry: string(entryBytes),
|
||||
Url: fmt.Sprintf("%s%s", service, reqDetails["Exchange"].(string)),
|
||||
Method: request["Method"].(string),
|
||||
Method: request["method"].(string),
|
||||
Status: 0,
|
||||
RequestSenderIp: "",
|
||||
RequestSenderIp: item.ConnectionInfo.ClientIP,
|
||||
Service: service,
|
||||
Timestamp: item.Timestamp,
|
||||
Path: reqDetails["Exchange"].(string),
|
||||
ResolvedSource: resolvedSource,
|
||||
ResolvedDestination: resolvedDestination,
|
||||
SourceIp: "",
|
||||
DestinationIp: "",
|
||||
SourcePort: "",
|
||||
DestinationPort: "",
|
||||
IsOutgoing: true,
|
||||
SourceIp: item.ConnectionInfo.ClientIP,
|
||||
DestinationIp: item.ConnectionInfo.ServerIP,
|
||||
SourcePort: item.ConnectionInfo.ClientPort,
|
||||
DestinationPort: item.ConnectionInfo.ServerPort,
|
||||
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{})
|
||||
log.Printf("request: %+v\n", request)
|
||||
var repRequest []interface{}
|
||||
details := request["Details"].(map[string]interface{})
|
||||
switch request["Method"].(string) {
|
||||
case "Basic Publish":
|
||||
details := request["details"].(map[string]interface{})
|
||||
switch request["method"].(string) {
|
||||
case basicMethodMap[40]:
|
||||
repRequest = representBasicPublish(details)
|
||||
break
|
||||
}
|
||||
|
@@ -7,22 +7,22 @@ const SectionsRepresentation: React.FC<any> = ({data, color}) => {
|
||||
const sections = []
|
||||
|
||||
if (data !== undefined) {
|
||||
data.forEach((row) => {
|
||||
for (const [i, row] of data.entries()) {
|
||||
switch (row.type) {
|
||||
case "table":
|
||||
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;
|
||||
case "body":
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return <>{sections}</>;
|
||||
|
Reference in New Issue
Block a user