mirror of https://github.com/daffainfo/nuclei.git
Misc
parent
ba3cab41c0
commit
cafd11a5c4
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -146,7 +145,7 @@ func makePrintCallback() func(stats clistats.StatisticsClient) {
|
|||
builder.WriteRune(')')
|
||||
builder.WriteRune('\n')
|
||||
|
||||
fmt.Fprintf(os.Stderr, "%s", builder.String())
|
||||
gologger.Print().Msgf("%s", builder.String())
|
||||
builder.Reset()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package dns
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/projectdiscovery/gologger"
|
||||
|
@ -33,7 +31,7 @@ func (r *Request) ExecuteWithResults(input string, metadata, previous output.Int
|
|||
|
||||
if r.options.Options.Debug || r.options.Options.DebugRequests {
|
||||
gologger.Info().Str("domain", domain).Msgf("[%s] Dumped DNS request for %s", r.options.TemplateID, domain)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", compiledRequest.String())
|
||||
gologger.Print().Msgf("%s", compiledRequest.String())
|
||||
}
|
||||
|
||||
// Send the request to the target servers
|
||||
|
@ -50,7 +48,7 @@ func (r *Request) ExecuteWithResults(input string, metadata, previous output.Int
|
|||
|
||||
if r.options.Options.Debug || r.options.Options.DebugResponse {
|
||||
gologger.Debug().Msgf("[%s] Dumped DNS response for %s", r.options.TemplateID, domain)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", resp.String())
|
||||
gologger.Print().Msgf("%s", resp.String())
|
||||
}
|
||||
outputEvent := r.responseToDSLMap(compiledRequest, resp, input, input)
|
||||
for k, v := range previous {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package file
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
|
@ -51,7 +50,7 @@ func (r *Request) ExecuteWithResults(input string, metadata, previous output.Int
|
|||
|
||||
if r.options.Options.Debug || r.options.Options.DebugRequests {
|
||||
gologger.Info().Msgf("[%s] Dumped file request for %s", r.options.TemplateID, data)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", dataStr)
|
||||
gologger.Print().Msgf("%s", dataStr)
|
||||
}
|
||||
gologger.Verbose().Msgf("[%s] Sent FILE request to %s", r.options.TemplateID, data)
|
||||
outputEvent := r.responseToDSLMap(dataStr, input, data)
|
||||
|
|
|
@ -19,6 +19,7 @@ Connection: close`, "https://test.com", true)
|
|||
|
||||
request, err = Parse(`POST /login HTTP/1.1
|
||||
Host: {{Hostname}}
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Connection: close
|
||||
|
||||
username=admin&password=login`, "https://test.com", true)
|
||||
|
|
|
@ -2,13 +2,11 @@ package http
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -232,7 +230,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
|
|||
}
|
||||
if r.options.Options.Debug || r.options.Options.DebugRequests {
|
||||
gologger.Info().Msgf("[%s] Dumped HTTP request for %s\n\n", r.options.TemplateID, reqURL)
|
||||
fmt.Fprintf(os.Stderr, "%s", string(dumpedRequest))
|
||||
gologger.Print().Msgf("%s", string(dumpedRequest))
|
||||
}
|
||||
|
||||
var formedURL string
|
||||
|
@ -317,7 +315,7 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, dynam
|
|||
if r.options.Options.Debug || r.options.Options.DebugResponse {
|
||||
dumpedResponse = bytes.ReplaceAll(dumpedResponse, dataOrig, data)
|
||||
gologger.Info().Msgf("[%s] Dumped HTTP response for %s\n\n", r.options.TemplateID, formedURL)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", string(dumpedResponse))
|
||||
gologger.Print().Msgf("%s", string(dumpedResponse))
|
||||
}
|
||||
|
||||
// if nuclei-project is enabled store the response if not previously done
|
||||
|
|
|
@ -40,7 +40,7 @@ func dump(req *generatedRequest, reqURL string) ([]byte, error) {
|
|||
// Create a copy on the fly of the request body - ignore errors
|
||||
bodyBytes, _ := req.request.BodyBytes()
|
||||
req.request.Request.Body = ioutil.NopCloser(bytes.NewReader(bodyBytes))
|
||||
return httputil.DumpRequest(req.request.Request, true)
|
||||
return httputil.DumpRequestOut(req.request.Request, true)
|
||||
}
|
||||
return rawhttp.DumpRequestRaw(req.rawRequest.Method, reqURL, req.rawRequest.Path, generators.ExpandMapValues(req.rawRequest.Headers), ioutil.NopCloser(strings.NewReader(req.rawRequest.Data)))
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package network
|
|||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -104,8 +102,7 @@ func (r *Request) executeAddress(actualAddress, address, input string, previous
|
|||
|
||||
if r.options.Options.Debug || r.options.Options.DebugRequests {
|
||||
gologger.Info().Str("address", actualAddress).Msgf("[%s] Dumped Network request for %s", r.options.TemplateID, actualAddress)
|
||||
|
||||
fmt.Fprintf(os.Stderr, "%s\n", reqBuilder.String())
|
||||
gologger.Print().Msgf("%s", reqBuilder.String())
|
||||
}
|
||||
|
||||
r.options.Output.Request(r.options.TemplateID, actualAddress, "network", err)
|
||||
|
@ -121,7 +118,7 @@ func (r *Request) executeAddress(actualAddress, address, input string, previous
|
|||
|
||||
if r.options.Options.Debug || r.options.Options.DebugResponse {
|
||||
gologger.Debug().Msgf("[%s] Dumped Network response for %s", r.options.TemplateID, actualAddress)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", resp)
|
||||
gologger.Print().Msgf("%s", resp)
|
||||
}
|
||||
outputEvent := r.responseToDSLMap(reqBuilder.String(), resp, input, actualAddress)
|
||||
outputEvent["ip"] = r.dialer.GetDialedIP(hostname)
|
||||
|
|
Loading…
Reference in New Issue