Giter Site home page Giter Site logo

godivert's People

Contributors

abdullah2993 avatar williamfhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

godivert's Issues

Tcp header length calculation may be wrong

When I was using binding. I got this

goroutine 20 [running]:
github.com/williamfhe/godivert/header.NewTCPHeader(...)
        C:/Users/Blueshark-JF/go/src/github.com/williamfhe/godivert/header/tcp.go:16
github.com/williamfhe/godivert.(*Packet).ParseHeaders(0xc000099b60)
        C:/Users/Blueshark-JF/go/src/github.com/williamfhe/godivert/packet.go:42 +0x5a2
github.com/williamfhe/godivert.(*Packet).VerifyParsed(0xc000099b60)
        C:/Users/Blueshark-JF/go/src/github.com/williamfhe/godivert/packet.go:187 +0x47
github.com/williamfhe/godivert.(*Packet).DstIP(0xc000099b60, 0x2, 0x2, 0x7)
        C:/Users/Blueshark-JF/go/src/github.com/williamfhe/godivert/packet.go:102 +0x32
main.checkPacket(0xc000052610, 0xc0000980c0)
        C:/Users/Blueshark-JF/go/src/vtap/old2.go:75 +0x25f
created by main.NewProxy
        C:/Users/Blueshark-JF/go/src/vtap/old2.go:319 +0xff
exit status 2

I found out when I was following the mistake, in github.com\williamfhe\godivert\header

func NewTCPHeader(raw []byte) *TCPHeader {
	hdrLen := raw[12] >> 2
	return &TCPHeader{
		Raw: raw[:hdrLen],
	}
}

I think maybe the following code will be more accurate

(packet.Raw[ipHeaderLenght+12]&0xF>>4) * 5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.