mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 04:52:11 +00:00
update glutton
This commit is contained in:
parent
7c66579baa
commit
0abb518177
2 changed files with 0 additions and 45 deletions
|
@ -23,7 +23,6 @@ RUN apk -U --no-cache add \
|
||||||
cd go.uuid && \
|
cd go.uuid && \
|
||||||
git checkout v1.2.0 && \
|
git checkout v1.2.0 && \
|
||||||
mv /root/dist/system.go /opt/go/src/github.com/mushorg/glutton/ && \
|
mv /root/dist/system.go /opt/go/src/github.com/mushorg/glutton/ && \
|
||||||
mv /root/dist/tcp.go /opt/go/src/github.com/mushorg/glutton/ && \
|
|
||||||
cd /opt/go/src/github.com/mushorg/glutton/ && \
|
cd /opt/go/src/github.com/mushorg/glutton/ && \
|
||||||
make build && \
|
make build && \
|
||||||
cd / && \
|
cd / && \
|
||||||
|
|
44
docker/glutton/dist/tcp.go
vendored
44
docker/glutton/dist/tcp.go
vendored
|
@ -1,44 +0,0 @@
|
||||||
package glutton
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/kung-foo/freki"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
)
|
|
||||||
|
|
||||||
// HandleTCP takes a net.Conn and peeks at the data send
|
|
||||||
func (g *Glutton) HandleTCP(ctx context.Context, conn net.Conn) (err error) {
|
|
||||||
defer func() {
|
|
||||||
err = conn.Close()
|
|
||||||
if err != nil {
|
|
||||||
g.logger.Error(fmt.Sprintf("[log.tcp ] error: %v", err))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
host, port, err := net.SplitHostPort(conn.RemoteAddr().String())
|
|
||||||
if err != nil {
|
|
||||||
g.logger.Error(fmt.Sprintf("[log.tcp ] error: %v", err))
|
|
||||||
}
|
|
||||||
ck := freki.NewConnKeyByString(host, port)
|
|
||||||
md := g.processor.Connections.GetByFlow(ck)
|
|
||||||
buffer := make([]byte, 1024)
|
|
||||||
n, err := conn.Read(buffer)
|
|
||||||
if err != nil {
|
|
||||||
g.logger.Error(fmt.Sprintf("[log.tcp ] error: %v", err))
|
|
||||||
}
|
|
||||||
if n > 0 && n < 1024 {
|
|
||||||
g.logger.Info(
|
|
||||||
fmt.Sprintf("Packet got handled by TCP handler"),
|
|
||||||
zap.String("dest_port", strconv.Itoa(int(md.TargetPort))),
|
|
||||||
zap.String("src_ip", host),
|
|
||||||
zap.String("src_port", port),
|
|
||||||
zap.String("handler", "tcp"),
|
|
||||||
zap.String("payload_hex", hex.EncodeToString(buffer[0:n])),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
Loading…
Reference in a new issue