-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added handler for HTTP2/PRI #178
base: main
Are you sure you want to change the base?
Conversation
protocols/protocols.go
Outdated
@@ -75,7 +75,7 @@ func MapTCPProtocolHandlers(log interfaces.Logger, h interfaces.Honeypot) map[st | |||
return nil | |||
} | |||
// poor mans check for HTTP request | |||
httpMap := map[string]bool{"GET ": true, "POST": true, "HEAD": true, "OPTI": true, "CONN": true} | |||
httpMap := map[string]bool{"GET ": true, "POST": true, "HEAD": true, "OPTI": true, "CONN": true,"PRI": true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use go fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatted the code
protocols/tcp/http.go
Outdated
|
||
reader := bufio.NewReader(conn) | ||
preface,err := reader.Peek(24) | ||
if err==nil && bytes.Equal(preface, []byte("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n")){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in go we handle the error case in the conditional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors handled in conditional
@glaslos I modified code as stated if anything needed to be still changed please let me know. |
Please add a test for your change. |
fixes #159
Key Changes
PRI
inprotocols.go
tohttpMap
such that it detects HTTP/2 connectionsHandleHTTP
function intcp/http.go
PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n
) and checks if data matches with HTTP/2 preface@glaslos
If there are any changes to be made I am ready to modify them.