This repository was archived by the owner on Nov 22, 2020. It is now read-only.
Description Found a possible issue in ggg-geyi/pcapbeat at beater/pcapbeat.go
The below snippet of Go code triggered static analysis which searches for goroutines and/or defer statements
which capture loop variables.
Click here to see the code in its original context.
Click here to show the 62 line(s) of Go which triggered the analyzer.
for index , filePath := range filePathSlice {
logp .Info ("=========== READY DEAL PCAP FILE =======" )
newPath := ""
// 先将文件重命名dealing。标示这个文件正在被处理
if path , error := utils .RenamePcapFileToDealing (filePath ); error != nil {
logp .Err ("RENAME .PCAP TO .DEALING ERROR.ERROR MSG IS : 。" ,error .Error ())
continue
}else {
newPath = path
logp .Info ("RENAME .PCAP TO .DEALING " , filePath , " ---> " ,newPath )
}
logp .Info ("REANDY DEALING FILE PATH IS : " , index , filePath )
// 创建带缓冲的chan。这个chan用来存放的就是http的req和resp合并之后的记录
packetChan := make (chan http.CombineHttpRecord ,10 )
// 开启一个协程去处理数据
go analysis .ReadPcapAndDealProtocols (packetChan , newPath )
// 开启协程准备发送数据
go func (newPath string , packetChan chan http.CombineHttpRecord ) {
for x := range packetChan {
event := beat.Event {
Timestamp : time .Now (),
Fields : common.MapStr {
//"type": b.Info.Name,
"type" : "http" , // 将协议类型自动修正为http
"filepath" : filePath ,
"client_ip" : x .Pk .Net .Src ().String (),
"server" : x .Pk .Net .Dst ().String (),
"ip" : x .Ip ,
"client_port" : x .Pk .Transport .Src ().String (),
"port" : x .Pk .Transport .Dst ().String (),
"http" : common.MapStr {
"response" : common.MapStr {
"code" : x .HttpResponseCode ,
},
},
"status" : x .Status ,
"bytes_in" : x .BytesIn ,
"bytes_out" : x .BytesOut ,
"path" : x .Path ,
"method" : x .Method ,
"query" : x .Query ,
"responsetime" : x .Responsetime ,
},
}
bt .client .Publish (event )
}
logp .Info ("READY TO RENAME .dealing TO .done" ,newPath )
if _ , error := utils .RenamePcapDealingFileToDone (newPath ); error != nil {
logp .Err ("RENAME .dealing TO .done ERROR. PATH IS : " ,newPath ," AND MESSAGE IS : " ,error .Error ())
}else {
logp .Info ("DONE RENAME .dealing TO .done" ,newPath )
}
}(newPath , packetChan )
}
commit ID: 098b276b09aec2cf4603a11eecd8a7ca484094ce
Reactions are currently unavailable
Found a possible issue in ggg-geyi/pcapbeat at beater/pcapbeat.go
The below snippet of Go code triggered static analysis which searches for goroutines and/or defer statements
which capture loop variables.
Click here to see the code in its original context.
Click here to show the 62 line(s) of Go which triggered the analyzer.
commit ID: 098b276b09aec2cf4603a11eecd8a7ca484094ce