mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-07 11:35:36 +00:00
Remove the unnecessary logging
This commit is contained in:
parent
8f9e584025
commit
2c827fc524
@ -110,26 +110,10 @@ func startReadingChannel(outputItems <-chan *tapApi.OutputChannelItem, extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
for item := range outputItems {
|
for item := range outputItems {
|
||||||
fmt.Printf("item: %+v\n", item)
|
|
||||||
extension := extensionsMap[item.Protocol.Name]
|
extension := extensionsMap[item.Protocol.Name]
|
||||||
fmt.Printf("extension: %+v\n", extension)
|
|
||||||
// var req *http.Request
|
|
||||||
// marshedReq, _ := json.Marshal(item.Data.Request.Orig)
|
|
||||||
// json.Unmarshal(marshedReq, &req)
|
|
||||||
// var res *http.Response
|
|
||||||
// marshedRes, _ := json.Marshal(item.Data.Response.Orig)
|
|
||||||
// json.Unmarshal(marshedRes, &res)
|
|
||||||
// // NOTE: With this call, the incoming data is sent to the last WebSocket (that the web UI communicates).
|
|
||||||
// if harEntry, err := models.NewEntry(req, item.Data.Request.CaptureTime, res, item.Data.Response.CaptureTime); err == nil {
|
|
||||||
// saveHarToDb(harEntry, item.ConnectionInfo)
|
|
||||||
// } else {
|
|
||||||
// rlog.Errorf("Error when creating HTTP entry")
|
|
||||||
// }
|
|
||||||
resolvedSource, resolvedDestionation := resolveIP(item.ConnectionInfo)
|
resolvedSource, resolvedDestionation := resolveIP(item.ConnectionInfo)
|
||||||
mizuEntry := extension.Dissector.Analyze(item, primitive.NewObjectID().Hex(), resolvedSource, resolvedDestionation)
|
mizuEntry := extension.Dissector.Analyze(item, primitive.NewObjectID().Hex(), resolvedSource, resolvedDestionation)
|
||||||
baseEntry := extension.Dissector.Summarize(mizuEntry)
|
baseEntry := extension.Dissector.Summarize(mizuEntry)
|
||||||
fmt.Printf("baseEntry: %+v\n", baseEntry)
|
|
||||||
fmt.Printf("mizuEntry: %+v\n", mizuEntry)
|
|
||||||
mizuEntry.EstimatedSizeBytes = getEstimatedEntrySizeBytes(mizuEntry)
|
mizuEntry.EstimatedSizeBytes = getEstimatedEntrySizeBytes(mizuEntry)
|
||||||
database.CreateEntry(mizuEntry)
|
database.CreateEntry(mizuEntry)
|
||||||
baseEntryBytes, _ := models.CreateBaseEntryWebSocketMessage(baseEntry)
|
baseEntryBytes, _ := models.CreateBaseEntryWebSocketMessage(baseEntry)
|
||||||
|
@ -2,7 +2,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"log"
|
|
||||||
"plugin"
|
"plugin"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -77,10 +76,6 @@ type Emitter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *Emitting) Emit(item *OutputChannelItem) {
|
func (e *Emitting) Emit(item *OutputChannelItem) {
|
||||||
log.Printf("item: %+v\n", item)
|
|
||||||
log.Printf("item.Pair: %+v\n", item.Pair)
|
|
||||||
log.Printf("item.Pair.Request.Payload: %v\n", item.Pair.Request.Payload)
|
|
||||||
log.Printf("item.Pair.Response.Payload: %v\n", item.Pair.Response.Payload)
|
|
||||||
e.OutputChannel <- item
|
e.OutputChannel <- item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, em
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// fmt.Printf("unexpected frame: %+v\n", f)
|
// log.Printf("unexpected frame: %+v\n", f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,7 +295,6 @@ func (d dissecting) Represent(entry string) ([]byte, error) {
|
|||||||
json.Unmarshal([]byte(entry), &root)
|
json.Unmarshal([]byte(entry), &root)
|
||||||
representation := make(map[string]interface{}, 0)
|
representation := make(map[string]interface{}, 0)
|
||||||
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)
|
|
||||||
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) {
|
||||||
|
@ -100,8 +100,6 @@ 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 {
|
||||||
fmt.Printf("pair.Request.Payload: %+v\n", item.Pair.Request.Payload)
|
|
||||||
fmt.Printf("item.Pair.Response.Payload: %+v\n", item.Pair.Response.Payload)
|
|
||||||
var host string
|
var host string
|
||||||
for _, header := range item.Pair.Request.Payload.(map[string]interface{})["headers"].([]interface{}) {
|
for _, header := range item.Pair.Request.Payload.(map[string]interface{})["headers"].([]interface{}) {
|
||||||
h := header.(map[string]interface{})
|
h := header.(map[string]interface{})
|
||||||
|
@ -27,7 +27,6 @@ func createResponseRequestMatcher() requestResponseMatcher {
|
|||||||
func (matcher *requestResponseMatcher) registerRequest(ident string, request *http.Request, captureTime time.Time) *api.OutputChannelItem {
|
func (matcher *requestResponseMatcher) registerRequest(ident string, request *http.Request, captureTime time.Time) *api.OutputChannelItem {
|
||||||
split := splitIdent(ident)
|
split := splitIdent(ident)
|
||||||
key := genKey(split)
|
key := genKey(split)
|
||||||
// fmt.Printf(">>> request key: %v\n", key)
|
|
||||||
|
|
||||||
requestHTTPMessage := api.GenericMessage{
|
requestHTTPMessage := api.GenericMessage{
|
||||||
IsRequest: true,
|
IsRequest: true,
|
||||||
@ -57,7 +56,6 @@ func (matcher *requestResponseMatcher) registerRequest(ident string, request *ht
|
|||||||
func (matcher *requestResponseMatcher) registerResponse(ident string, response *http.Response, captureTime time.Time) *api.OutputChannelItem {
|
func (matcher *requestResponseMatcher) registerResponse(ident string, response *http.Response, captureTime time.Time) *api.OutputChannelItem {
|
||||||
split := splitIdent(ident)
|
split := splitIdent(ident)
|
||||||
key := genKey(split)
|
key := genKey(split)
|
||||||
// fmt.Printf(">>> response key: %v\n", key)
|
|
||||||
|
|
||||||
responseHTTPMessage := api.GenericMessage{
|
responseHTTPMessage := api.GenericMessage{
|
||||||
IsRequest: false,
|
IsRequest: false,
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -53,20 +52,3 @@ func (matcher *requestResponseMatcher) preparePair(request *Request, response *R
|
|||||||
Response: *response,
|
Response: *response,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (reqResPair *RequestResponsePair) debug() {
|
|
||||||
req := reqResPair.Request
|
|
||||||
res := reqResPair.Response
|
|
||||||
log.Printf(
|
|
||||||
"\n----------------\n> Request [%d]\nApiKey: %v\nApiVersion: %v\nCorrelationID: %v\nClientID: %v\nPayload: %+v\n> Response [%d]\nCorrelationID: %v\nPayload: %+v\n",
|
|
||||||
req.Size,
|
|
||||||
req.ApiKey,
|
|
||||||
req.ApiVersion,
|
|
||||||
req.CorrelationID,
|
|
||||||
req.ClientID,
|
|
||||||
req.Payload,
|
|
||||||
res.Size,
|
|
||||||
res.CorrelationID,
|
|
||||||
res.Payload,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
@ -246,8 +246,6 @@ func ReadResponse(r io.Reader, tcpID *api.TcpID, emitter api.Emitter) (err error
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// reqResPair.debug()
|
|
||||||
|
|
||||||
connectionInfo := &api.ConnectionInfo{
|
connectionInfo := &api.ConnectionInfo{
|
||||||
ClientIP: tcpID.SrcIP,
|
ClientIP: tcpID.SrcIP,
|
||||||
ClientPort: tcpID.SrcPort,
|
ClientPort: tcpID.SrcPort,
|
||||||
|
Loading…
Reference in New Issue
Block a user