mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-08-17 05:20:29 +03:00
Adding support for custom SNI name
This commit is contained in:
parent
18388fc677
commit
06f1c2c4c5
@ -47,6 +47,7 @@ func New(options *Options) (*HTTPX, error) {
|
||||
if len(options.Resolvers) > 0 {
|
||||
fastdialerOpts.BaseResolvers = options.Resolvers
|
||||
}
|
||||
fastdialerOpts.SNIName = options.SniName
|
||||
dialer, err := fastdialer.NewDialer(fastdialerOpts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not create resolver cache: %s", err)
|
||||
|
@ -40,6 +40,7 @@ type Options struct {
|
||||
UnsafeURI string
|
||||
Resolvers []string
|
||||
customCookies []*http.Cookie
|
||||
SniName string
|
||||
}
|
||||
|
||||
// DefaultOptions contains the default options
|
||||
|
2
go.mod
2
go.mod
@ -16,7 +16,7 @@ require (
|
||||
github.com/projectdiscovery/cdncheck v0.0.3
|
||||
github.com/projectdiscovery/clistats v0.0.8
|
||||
github.com/projectdiscovery/cryptoutil v0.0.0-20210805184155-b5d2512f9345
|
||||
github.com/projectdiscovery/fastdialer v0.0.15
|
||||
github.com/projectdiscovery/fastdialer v0.0.16-0.20220415153642-29a3e094f5d3
|
||||
github.com/projectdiscovery/fdmax v0.0.3
|
||||
github.com/projectdiscovery/fileutil v0.0.0-20210926202739-6050d0acf73c
|
||||
github.com/projectdiscovery/goconfig v0.0.0-20210804090219-f893ccd0c69c
|
||||
|
3
go.sum
3
go.sum
@ -130,6 +130,8 @@ github.com/projectdiscovery/cryptoutil v0.0.0-20210805184155-b5d2512f9345 h1:jT6
|
||||
github.com/projectdiscovery/cryptoutil v0.0.0-20210805184155-b5d2512f9345/go.mod h1:clhQmPnt35ziJW1AhJRKyu8aygXCSoyWj6dtmZBRjjc=
|
||||
github.com/projectdiscovery/fastdialer v0.0.15 h1:vOLk8jty+1H9osPRzUT6acD0XBSaglyLS3MlIQaYczk=
|
||||
github.com/projectdiscovery/fastdialer v0.0.15/go.mod h1:Q28lw9oTpiZHq09uFG6YYYLUsUjsOypZ7PXWwQGBB80=
|
||||
github.com/projectdiscovery/fastdialer v0.0.16-0.20220415153642-29a3e094f5d3 h1:m2z3BKKqDyzY06pTX8stOWKzZuIWSi6FmwT6wRR052E=
|
||||
github.com/projectdiscovery/fastdialer v0.0.16-0.20220415153642-29a3e094f5d3/go.mod h1:wn6jSJ1fIO6kLplFEbFIkRB6Kj/Q6VngnzKuBHLVPiI=
|
||||
github.com/projectdiscovery/fdmax v0.0.3 h1:FM6lv9expZ/rEEBI9tkRh6tx3DV0gtpwzdc0h7bGPqg=
|
||||
github.com/projectdiscovery/fdmax v0.0.3/go.mod h1:NWRcaR7JTO7fC27H4jCl9n7Z+KIredwpgw1fV+4KrKI=
|
||||
github.com/projectdiscovery/fileutil v0.0.0-20210926202739-6050d0acf73c h1:KDmCXhLLnS/Gc1VDyTxxamRzc8OmHCm1X+f8WQoaTRs=
|
||||
@ -204,6 +206,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
github.com/ulule/deepcopier v0.0.0-20200430083143-45decc6639b6 h1:TtyC78WMafNW8QFfv3TeP3yWNDG+uxNkk9vOrnDu6JA=
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"github.com/projectdiscovery/httpx/common/slice"
|
||||
|
||||
"github.com/projectdiscovery/fileutil"
|
||||
"github.com/projectdiscovery/goconfig"
|
||||
"github.com/projectdiscovery/goflags"
|
||||
@ -16,6 +16,7 @@ import (
|
||||
"github.com/projectdiscovery/httpx/common/customlist"
|
||||
customport "github.com/projectdiscovery/httpx/common/customports"
|
||||
fileutilz "github.com/projectdiscovery/httpx/common/fileutil"
|
||||
"github.com/projectdiscovery/httpx/common/slice"
|
||||
"github.com/projectdiscovery/httpx/common/stringz"
|
||||
)
|
||||
|
||||
@ -229,6 +230,7 @@ type Options struct {
|
||||
Hashes string
|
||||
Jarm bool
|
||||
Asn bool
|
||||
SniName string
|
||||
}
|
||||
|
||||
// ParseOptions parses the command line options for application
|
||||
@ -264,6 +266,7 @@ func ParseOptions() *Options {
|
||||
flagSet.BoolVar(&options.Asn, "asn", false, "display host asn information"),
|
||||
flagSet.BoolVar(&options.OutputCDN, "cdn", false, "display cdn in use"),
|
||||
flagSet.BoolVar(&options.Probe, "probe", false, "display probe status"),
|
||||
flagSet.StringVar(&options.SniName, "sni-name", "", "Custom SNI Name"),
|
||||
)
|
||||
|
||||
createGroup(flagSet, "matchers", "Matchers",
|
||||
|
@ -125,6 +125,7 @@ func New(options *Options) (*Runner, error) {
|
||||
value = strings.TrimSpace(tokens[1])
|
||||
httpxOptions.CustomHeaders[key] = value
|
||||
}
|
||||
httpxOptions.SniName = options.SniName
|
||||
|
||||
runner.hp, err = httpx.New(&httpxOptions)
|
||||
if err != nil {
|
||||
@ -1293,7 +1294,7 @@ retry:
|
||||
}
|
||||
jarmhash := ""
|
||||
if r.options.Jarm {
|
||||
jarmhash = hashes.Jarm(fullURL,r.options.Timeout)
|
||||
jarmhash = hashes.Jarm(fullURL, r.options.Timeout)
|
||||
builder.WriteString(" [")
|
||||
if !scanopts.OutputWithNoColor {
|
||||
builder.WriteString(aurora.Magenta(jarmhash).String())
|
||||
|
Loading…
Reference in New Issue
Block a user