Skip to content

Commit

Permalink
updated dependencies and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Apr 3, 2023
1 parent b517f24 commit e0fe6fb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 41 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/mosajjal/tcpshark
go 1.19

require (
github.com/gopacket/gopacket v1.0.0
github.com/gopacket/gopacket v1.1.0
github.com/jessevdk/go-flags v1.5.0
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40
github.com/rs/zerolog v1.29.0
Expand All @@ -14,11 +14,11 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ github.com/gopacket/gopacket v0.1.0 h1:Gtjoa9MKRR/uBFHXDB8VxPkfk1fHOKhZcWLhUqb1l
github.com/gopacket/gopacket v0.1.0/go.mod h1:DlRRfaM/QjAu2ADqraIure1Eif0HpNL8hmyVQ+qci5Y=
github.com/gopacket/gopacket v1.0.0 h1:MmpNzkTD7fO4U+BTauN2eZ5XYprvL6j4Nz2JMcKuXzY=
github.com/gopacket/gopacket v1.0.0/go.mod h1:DlRRfaM/QjAu2ADqraIure1Eif0HpNL8hmyVQ+qci5Y=
github.com/gopacket/gopacket v1.1.0 h1:zKPCsVPcVt1B2AJyzSM44iaFVuFFSIyu0imExpPmyAk=
github.com/gopacket/gopacket v1.1.0/go.mod h1:HavMeONEl7W9036of9LbSWoonqhH7HA1+ZRO+rMIvFs=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40 h1:EnfXoSqDfSNJv0VBNqY/88RNnhSGYkrHaO0mmFGbVsc=
Expand All @@ -21,6 +23,8 @@ github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peK
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -60,6 +64,8 @@ golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -82,6 +88,10 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
4 changes: 2 additions & 2 deletions tcpshark.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ function tcpshark.dissector(buffer, pinfo, tree)

-- -4: skip the FCS
local trailer = buffer(iplen+ethernet_header_size ,trailerlength )

-- simple sanity check with the magic number
local magic = trailer(0, 4):uint()
if(magic ~= TCPSHARK_MAGIC) then
return
end

local pid = trailer(4, 4):uint()

local subtree = tree:add(tcpshark, buffer(), string.format("Tcpshark, pid: %d",pid))
subtree:add(fields.pid, pid)
local cmdLen = trailer(8, 1):uint()
Expand Down
35 changes: 0 additions & 35 deletions trailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,6 @@ type EthernetWithTrailer struct {
// LayerType returns LayerTypeEthernet
func (e *EthernetWithTrailer) LayerType() gopacket.LayerType { return layers.LayerTypeEthernet }

// func (e *EthernetWithTrailer) linkFlow() gopacket.Flow {
// return gopacket.NewFlow(layers.EndpointMAC, e.SrcMAC, e.DstMAC)
// }

// func (e *EthernetWithTrailer) decodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
// if len(data) < 14 {
// return errors.New("Ethernet packet too small")
// }
// e.DstMAC = net.HardwareAddr(data[0:6])
// e.SrcMAC = net.HardwareAddr(data[6:12])
// e.EthernetType = layers.EthernetType(binary.BigEndian.Uint16(data[12:14]))
// e.BaseLayer = layers.BaseLayer{Contents: data[:14], Payload: data[14:]}
// e.Length = 0
// if e.EthernetType < 0x0600 {
// e.Length = uint16(e.EthernetType)
// e.EthernetType = layers.EthernetTypeLLC
// if cmp := len(e.Payload) - int(e.Length); cmp < 0 {
// df.SetTruncated()
// } else if cmp > 0 {
// // Strip off bytes at the end, since we have too many bytes
// e.Payload = e.Payload[:len(e.Payload)-cmp]
// }
// // fmt.Println(eth)
// }
// return nil
// }

// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
Expand Down Expand Up @@ -111,12 +84,4 @@ func (e *EthernetWithTrailer) SerializeTo(b gopacket.SerializeBuffer, opts gopac
return nil
}

// func (e *EthernetWithTrailer) canDecode() gopacket.LayerClass {
// return layers.LayerTypeEthernet
// }

// func (e *EthernetWithTrailer) nextLayerType() gopacket.LayerType {
// return e.EthernetType.LayerType()
// }

var lotsOfZeros [1024]byte

0 comments on commit e0fe6fb

Please sign in to comment.