Explorar el Código

- added error handling for when a packet can't be parsed

Tobias Begalke hace 7 años
padre
commit
593ccea416
Se han modificado 1 ficheros con 10 adiciones y 2 borrados
  1. 10 2
      main.go

+ 10 - 2
main.go

@@ -231,9 +231,17 @@ func processPacket(packet gopacket.Packet) {
 
 	switch config.Protocol {
 	case "http":
-		processHTTP(&request, applicationLayer.Payload())
+		err := processHTTP(&request, applicationLayer.Payload())
+		if err != nil {
+			log.Println(err)
+			return
+		}
 	case "ajp13":
-		processAJP13(&request, applicationLayer.Payload())
+		err := processAJP13(&request, applicationLayer.Payload())
+		if err != nil {
+			log.Println(err)
+			return
+		}
 	}
 
 	if config.UseXForwardedAsSource && request.XForwardedFor != "" {