mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-01 08:50:27 +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 {
|
||||
fmt.Printf("item: %+v\n", item)
|
||||
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)
|
||||
mizuEntry := extension.Dissector.Analyze(item, primitive.NewObjectID().Hex(), resolvedSource, resolvedDestionation)
|
||||
baseEntry := extension.Dissector.Summarize(mizuEntry)
|
||||
fmt.Printf("baseEntry: %+v\n", baseEntry)
|
||||
fmt.Printf("mizuEntry: %+v\n", mizuEntry)
|
||||
mizuEntry.EstimatedSizeBytes = getEstimatedEntrySizeBytes(mizuEntry)
|
||||
database.CreateEntry(mizuEntry)
|
||||
baseEntryBytes, _ := models.CreateBaseEntryWebSocketMessage(baseEntry)
|
||||
|
@ -2,7 +2,6 @@ package api
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"log"
|
||||
"plugin"
|
||||
"time"
|
||||
)
|
||||
@ -77,10 +76,6 @@ type Emitter interface {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, em
|
||||
}
|
||||
|
||||
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)
|
||||
representation := make(map[string]interface{}, 0)
|
||||
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) {
|
||||
|
@ -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 {
|
||||
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
|
||||
for _, header := range item.Pair.Request.Payload.(map[string]interface{})["headers"].([]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 {
|
||||
split := splitIdent(ident)
|
||||
key := genKey(split)
|
||||
// fmt.Printf(">>> request key: %v\n", key)
|
||||
|
||||
requestHTTPMessage := api.GenericMessage{
|
||||
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 {
|
||||
split := splitIdent(ident)
|
||||
key := genKey(split)
|
||||
// fmt.Printf(">>> response key: %v\n", key)
|
||||
|
||||
responseHTTPMessage := api.GenericMessage{
|
||||
IsRequest: false,
|
||||
|
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@ -53,20 +52,3 @@ func (matcher *requestResponseMatcher) preparePair(request *Request, response *R
|
||||
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
|
||||
}
|
||||
|
||||
// reqResPair.debug()
|
||||
|
||||
connectionInfo := &api.ConnectionInfo{
|
||||
ClientIP: tcpID.SrcIP,
|
||||
ClientPort: tcpID.SrcPort,
|
||||
|
Loading…
Reference in New Issue
Block a user