fixed websocket output

This commit is contained in:
Mzack9999 2020-06-24 01:45:52 +02:00
parent 0fefc83ece
commit 34543f4f88
2 changed files with 13 additions and 2 deletions

View File

@ -16,7 +16,13 @@ httpx is a fast and multi-purpose HTTP toolkit allow to run multiple probers usi
- [Installation Instructions](#installation-instructions)
- [From Binary](#from-binary)
- [From Source](#from-source)
- [Running httpx](#running-httpx-to-probe-7614-hosts)
- [Running httpX to probe `7614` hosts](#running-httpx-to-probe-7614-hosts)
- [Running httpx with stdin](#running-httpx-with-stdin)
- [Running httpx with file input](#running-httpx-with-file-input)
- [Running httpx with CIDR input](#running-httpx-with-cidr-input)
- [Using httpX with subfinder/chaos and any other similar tool.](#using-httpx-with-subfinderchaos-and-any-other-similar-tool)
- [Running httpX with json output](#running-httpx-with-json-output)
- [Todo](#todo)
- [Thanks](#thanks)
# Features
@ -68,6 +74,7 @@ This will display help for the tool. Here are all the switches it supports.
| -version | Prints current version of the httpx | httpx -version |
| -x | Request Method (default 'GET') | httpx -x HEAD |
| -response-in-stdout | Include response in stdout (only works with -json) | httpx -response-in-stdout |
| -websocket | Prints if a websocket is exposed | httpx -websocket |
# Installation Instructions

View File

@ -62,6 +62,7 @@ func main() {
scanopts.OutputServerHeader = options.OutputServerHeader
scanopts.OutputWithNoColor = options.NoColor
scanopts.ResponseInStdout = options.responseInStdout
scanopts.OutputWebSocket = options.OutputWebSocket
// Try to create output folder if it doesnt exist
if options.StoreResponse && options.StoreResponseDir != "" && options.StoreResponseDir != "." {
@ -185,6 +186,7 @@ type scanOptions struct {
StoreResponse bool
StoreResponseDirectory string
OutputServerHeader bool
OutputWebSocket bool
OutputWithNoColor bool
ResponseInStdout bool
}
@ -296,7 +298,7 @@ retry:
// web socket
isWebSocket := resp.StatusCode == 101
if isWebSocket {
if scanopts.OutputWebSocket && isWebSocket {
builder.WriteString(" [websocket]")
}
@ -363,6 +365,7 @@ type Options struct {
Verbose bool
NoColor bool
OutputServerHeader bool
OutputWebSocket bool
responseInStdout bool
FollowHostRedirects bool
}
@ -394,6 +397,7 @@ func ParseOptions() *Options {
flag.BoolVar(&options.Verbose, "verbose", false, "Verbose Mode")
flag.BoolVar(&options.NoColor, "no-color", false, "No Color")
flag.BoolVar(&options.OutputServerHeader, "web-server", false, "Prints out the Server header content")
flag.BoolVar(&options.OutputWebSocket, "websocket", false, "Prints out if the server exposes a websocket")
flag.BoolVar(&options.responseInStdout, "response-in-json", false, "Server response directly in the tool output (-json only)")
flag.Parse()