Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions cmd/tlsx/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/projectdiscovery/tlsx/internal/runner"
"github.com/projectdiscovery/tlsx/pkg/tlsx/clients"
"github.com/projectdiscovery/tlsx/pkg/tlsx/openssl"
errorutils "github.com/projectdiscovery/utils/errors"
"github.com/projectdiscovery/utils/errkit"
errorutils "github.com/projectdiscovery/utils/errors" //nolint
fileutil "github.com/projectdiscovery/utils/file"
)

Expand All @@ -26,20 +27,20 @@ func main() {

func process() error {
if err := readFlags(); err != nil {
return errorutils.NewWithErr(err).Msgf("could not read flags")
return errkit.Wrapf(err, "could not read flags")
}
runner, err := runner.New(options)
if err != nil {
return errorutils.NewWithErr(err).Msgf("could not create runner")
return errkit.Wrapf(err, "could not create runner")
}
if runner == nil {
return nil
}
if err := runner.Execute(); err != nil {
return errorutils.NewWithErr(err).Msgf("could not execute runner")
return errkit.Wrapf(err, "could not execute runner")
}
if err := runner.Close(); err != nil {
return errorutils.NewWithErr(err).Msgf("could not close runner")
return errkit.Wrapf(err, "could not close runner")
}
return nil
}
Expand Down Expand Up @@ -154,13 +155,13 @@ func readFlags(args ...string) error {

err := flagSet.Parse(args...)
if err != nil {
return errorutils.NewWithErr(err).Msgf("could not parse flags")
return errkit.Wrapf(err, "could not parse flags")
}
hasStdin := fileutil.HasStdin()

// Validation: CT logs mode and input mode cannot be used together
if options.CTLogs && (len(options.Inputs) > 0 || options.InputList != "" || hasStdin) {
return errorutils.NewWithTag("flags", "CT logs mode (-ctl) and input mode (-u/-l/stdin) cannot be used together.")
return errorutils.NewWithTag("flags", "CT logs mode (-ctl) and input mode (-u/-l/stdin) cannot be used together.") //nolint
}

// Enable CT logs mode by default if no input is provided
Expand All @@ -180,7 +181,7 @@ func readFlags(args ...string) error {

if cfgFile != "" {
if err := flagSet.MergeConfigFile(cfgFile); err != nil {
return errorutils.NewWithErr(err).Msgf("could not read config file")
return errkit.Wrapf(err, "could not read config file")
}
}
return nil
Expand All @@ -190,6 +191,6 @@ func init() {
// Feature: Debug Mode
// Errors will include stacktrace when debug mode is enabled
if os.Getenv("DEBUG") != "" {
errorutils.ShowStackTrace = true
errkit.EnableTrace = true
}
}
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/miekg/dns v1.1.62
github.com/projectdiscovery/dnsx v1.2.2
github.com/projectdiscovery/fastdialer v0.4.3
github.com/projectdiscovery/fastdialer v0.4.9
github.com/projectdiscovery/goflags v0.1.74
github.com/projectdiscovery/gologger v1.1.54
github.com/projectdiscovery/mapcidr v1.1.34
github.com/projectdiscovery/utils v0.4.22
github.com/projectdiscovery/utils v0.5.0
github.com/rs/xid v1.5.0
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.0
github.com/tylertreat/BoomFilters v0.0.0-20250630160909-db6545748bc4
github.com/zmap/zcrypto v0.0.0-20231106212110-94c8f62efae4
go.uber.org/multierr v1.11.0
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/gaissmai/bart v0.20.5 // indirect
github.com/gaissmai/bart v0.24.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
Expand Down Expand Up @@ -114,14 +114,14 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/projectdiscovery/blackrock v0.0.1 // indirect
github.com/projectdiscovery/cdncheck v1.1.29 // indirect
github.com/projectdiscovery/hmap v0.0.92 // indirect
github.com/projectdiscovery/networkpolicy v0.1.18 // indirect
github.com/projectdiscovery/retryabledns v1.0.105 // indirect
github.com/projectdiscovery/retryablehttp-go v1.0.119
github.com/projectdiscovery/cdncheck v1.1.35 // indirect
github.com/projectdiscovery/hmap v0.0.93 // indirect
github.com/projectdiscovery/networkpolicy v0.1.23 // indirect
github.com/projectdiscovery/retryabledns v1.0.106 // indirect
github.com/projectdiscovery/retryablehttp-go v1.0.120
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/weppos/publicsuffix-go v0.40.3-0.20250408071509-6074bbe7fd39 // indirect
github.com/zmap/rc2 v0.0.0-20190804163417-abaa70531248 // indirect
go.etcd.io/bbolt v1.4.0 // indirect
Expand Down
42 changes: 22 additions & 20 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gaissmai/bart v0.20.5 h1:ehoWZWQ7j//qt0K0Zs4i9hpoPpbgqsMQiR8W2QPJh+c=
github.com/gaissmai/bart v0.20.5/go.mod h1:cEed+ge8dalcbpi8wtS9x9m2hn/fNJH5suhdGQOHnYk=
github.com/gaissmai/bart v0.24.0 h1:HOq5aXDBa4d376KkuxD+xnS9DQWWJtD4zgDNoGV0KrQ=
github.com/gaissmai/bart v0.24.0/go.mod h1:RpLtt3lWq1BoRz3AAyDAJ7jhLWBkYhVCfi+ximB2t68=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
Expand Down Expand Up @@ -262,30 +262,30 @@ github.com/projectdiscovery/asnmap v1.1.1 h1:ImJiKIaACOT7HPx4Pabb5dksolzaFYsD1kI
github.com/projectdiscovery/asnmap v1.1.1/go.mod h1:QT7jt9nQanj+Ucjr9BqGr1Q2veCCKSAVyUzLXfEcQ60=
github.com/projectdiscovery/blackrock v0.0.1 h1:lHQqhaaEFjgf5WkuItbpeCZv2DUIE45k0VbGJyft6LQ=
github.com/projectdiscovery/blackrock v0.0.1/go.mod h1:ANUtjDfaVrqB453bzToU+YB4cUbvBRpLvEwoWIwlTss=
github.com/projectdiscovery/cdncheck v1.1.29 h1:A+wPQyi2OKikHigD91Y2y7NxCwVGhnjjnv7bqcDE9N8=
github.com/projectdiscovery/cdncheck v1.1.29/go.mod h1:dFEGsG0qAJY0AaRr2N1BY0OtZiTxS4kYeT5+OkF8t1U=
github.com/projectdiscovery/cdncheck v1.1.35 h1:xyMnIWf2wzKH4Ii3lBNb73b/n9ee/baEiS3Ao23pyco=
github.com/projectdiscovery/cdncheck v1.1.35/go.mod h1:dFEGsG0qAJY0AaRr2N1BY0OtZiTxS4kYeT5+OkF8t1U=
github.com/projectdiscovery/dnsx v1.2.2 h1:ZjUov0GOyrS8ERlKAAhk+AOkqzaYHBzCP0qZfO+6Ihg=
github.com/projectdiscovery/dnsx v1.2.2/go.mod h1:3iYm86OEqo0WxeGDkVl5WZNmG0qYE5TYNx8fBg6wX1I=
github.com/projectdiscovery/fastdialer v0.4.3 h1:pHU5M3rngY5QuXPFy+azovpETKxUW/Si+Q1y0gOGVDQ=
github.com/projectdiscovery/fastdialer v0.4.3/go.mod h1:g7o6bF9XX8tPZvVIsEOCyfxo1BEh/BRCnNUSQPWnDfQ=
github.com/projectdiscovery/fastdialer v0.4.9 h1:/CTzoEsayQOrYJjB0CCa/0iNX7LSMeml6XmeyxX8ZVA=
github.com/projectdiscovery/fastdialer v0.4.9/go.mod h1:/4f7ELi6M5sr5XOpt+q0OpP4sQV36f3bOG23n7GOQUw=
github.com/projectdiscovery/goflags v0.1.74 h1:n85uTRj5qMosm0PFBfsvOL24I7TdWRcWq/1GynhXS7c=
github.com/projectdiscovery/goflags v0.1.74/go.mod h1:UMc9/7dFz2oln+10tv6cy+7WZKTHf9UGhaNkF95emh4=
github.com/projectdiscovery/gologger v1.1.54 h1:WMzvJ8j/4gGfPKpCttSTaYCVDU1MWQSJnk3wU8/U6Ws=
github.com/projectdiscovery/gologger v1.1.54/go.mod h1:vza/8pe2OKOt+ujFWncngknad1XWr8EnLKlbcejOyUE=
github.com/projectdiscovery/hmap v0.0.92 h1:NHGDFVJzc7b8bDuIjss7SxX5LJla9py/RxC4lri+uBo=
github.com/projectdiscovery/hmap v0.0.92/go.mod h1:IKezuOhPPwrmPusmhLuwuGsD8+fniyy6jx4gFTOZOnI=
github.com/projectdiscovery/hmap v0.0.93 h1:iIRdioT4byGJ4Hz5cOjo1fd3HFFi1MUFPv+EGYc1yng=
github.com/projectdiscovery/hmap v0.0.93/go.mod h1:oKgtWo2QMD7BkW25ezYbFCqKO3IctZ2ByEaG2XWW0t0=
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983 h1:ZScLodGSezQVwsQDtBSMFp72WDq0nNN+KE/5DHKY5QE=
github.com/projectdiscovery/machineid v0.0.0-20240226150047-2e2c51e35983/go.mod h1:3G3BRKui7nMuDFAZKR/M2hiOLtaOmyukT20g88qRQjI=
github.com/projectdiscovery/mapcidr v1.1.34 h1:udr83vQ7oz3kEOwlsU6NC6o08leJzSDQtls1wmXN/kM=
github.com/projectdiscovery/mapcidr v1.1.34/go.mod h1:1+1R6OkKSAKtWDXE9RvxXtXPoajXTYX0eiEdkqlhQqQ=
github.com/projectdiscovery/networkpolicy v0.1.18 h1:DAeP73SvcuT4evaohNS7BPELw+VtvcVt4PaTK3fC1qA=
github.com/projectdiscovery/networkpolicy v0.1.18/go.mod h1:2yWanKsU2oBZ75ch94IsEQy6hByFp+3oTiSyC6ew3TE=
github.com/projectdiscovery/retryabledns v1.0.105 h1:G8ln01igkNTQ5xvMY5K4cx5XIfKGTwGH6aZxWxBKMqc=
github.com/projectdiscovery/retryabledns v1.0.105/go.mod h1:3EZKhRL1rokqYR4q5qKK1eLBEe8mSzgtzkMOJilO1Ok=
github.com/projectdiscovery/retryablehttp-go v1.0.119 h1:Lpjb6gCWpIvCCX8GultM8zlaQEmFOci1dS33k9Ll4gw=
github.com/projectdiscovery/retryablehttp-go v1.0.119/go.mod h1:x29gqkLERRzw0znJDu5ORhphBaVin8FtK0+jCvCx4os=
github.com/projectdiscovery/utils v0.4.22 h1:OO3FU2uX967sQxu5JtpdBZNzOevvKHAhWqkoTGl+C0A=
github.com/projectdiscovery/utils v0.4.22/go.mod h1:3l84gpCwL9KG1/ZmslOBABCrk84CcpGWJZfR8wZysR4=
github.com/projectdiscovery/networkpolicy v0.1.23 h1:+MVm9xHCfzmZG5WhUtjAGFvNiQNKOgxZDDed1QfpLXI=
github.com/projectdiscovery/networkpolicy v0.1.23/go.mod h1:ILun9d4jgAfLOYf/NYjV+sKyW3tZTLMl+HyvaZuXZo0=
github.com/projectdiscovery/retryabledns v1.0.106 h1:repm5aGq5ge6fNJQbPNux7vyUhtUju7aIMEXZD9FX0A=
github.com/projectdiscovery/retryabledns v1.0.106/go.mod h1:1W3ogENvt3Pb+Ju4AN0aE2lZy+D76Yzxsz51DqFCIk8=
github.com/projectdiscovery/retryablehttp-go v1.0.120 h1:kH4D0MwKV6a0U6YbBQ8cBD+tT0U3zrwudTPCFVSaZg8=
github.com/projectdiscovery/retryablehttp-go v1.0.120/go.mod h1:jR3eJLdCEvW3Xz0LOQldxNc+MHHY61qZh9k3Sz7U40U=
github.com/projectdiscovery/utils v0.5.0 h1:DN7mg2DpyObLByuObXzAFEkdNRDoPUnqE5N2szd3b3c=
github.com/projectdiscovery/utils v0.5.0/go.mod h1:eCAWMmyaNxyPWbiKv1oeYJLIKpxceHE2+NWx3Jodhqk=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/refraction-networking/utls v1.7.1 h1:dxg+jla3uocgN8HtX+ccwDr68uCBBO3qLrkZUbqkcw0=
github.com/refraction-networking/utls v1.7.1/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ=
Expand Down Expand Up @@ -322,8 +322,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.0 h1:ib4sjIrwZKxE5u/Japgo/7SJV3PvgjGiRNAvTVGqQl8=
github.com/stretchr/testify v1.11.0/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw=
Expand Down Expand Up @@ -359,8 +359,10 @@ github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9f
github.com/tylertreat/BoomFilters v0.0.0-20250630160909-db6545748bc4 h1:NY8dlg1XXMOf6B7rTYTESijQt5eZQTSRnSiM+eydx/o=
github.com/tylertreat/BoomFilters v0.0.0-20250630160909-db6545748bc4/go.mod h1:OYRfF6eb5wY9VRFkXJH8FFBi3plw2v+giaIu7P054pM=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.14 h1:uv/0Bq533iFdnMHZdRBTOlaNMdb1+ZxXIlHDZHIHcvg=
github.com/ulikunitz/xz v0.5.14/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/weppos/publicsuffix-go v0.13.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k=
github.com/weppos/publicsuffix-go v0.30.2-0.20230730094716-a20f9abcc222/go.mod h1:s41lQh6dIsDWIC1OWh7ChWJXLH0zkJ9KHZVqA7vHyuQ=
github.com/weppos/publicsuffix-go v0.40.3-0.20250408071509-6074bbe7fd39 h1:Bz/zVM/LoGZ9IztGBHrq2zlFQQbEG8dBYnxb4hamIHM=
Expand Down
10 changes: 5 additions & 5 deletions internal/runner/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
errorutils "github.com/projectdiscovery/utils/errors"
"github.com/projectdiscovery/utils/errkit"
fileutil "github.com/projectdiscovery/utils/file"
updateutils "github.com/projectdiscovery/utils/update"
)
Expand Down Expand Up @@ -33,10 +33,10 @@ func (r *Runner) validateOptions() error {
}
probeSpecified := r.options.SO || r.options.TLSVersion || r.options.Cipher || r.options.Expired || r.options.SelfSigned || r.options.Hash != "" || r.options.Jarm || r.options.MisMatched || r.options.Revoked || r.options.WildcardCertCheck
if r.options.RespOnly && probeSpecified {
return errorutils.New("resp-only flag can only be used with san and cn flags")
return errkit.New("resp-only flag can only be used with san and cn flags")
}
if (r.options.SAN || r.options.CN) && probeSpecified {
return errorutils.New("san or cn flag cannot be used with other probes")
return errkit.New("san or cn flag cannot be used with other probes")
}

// Enable CT logs mode by default if no input is provided
Expand All @@ -47,15 +47,15 @@ func (r *Runner) validateOptions() error {

// Check if we still have no input after auto-enabling CT logs
if !r.options.CTLogs && !r.hasStdin && len(r.options.Inputs) == 0 && r.options.InputList == "" {
return errorutils.New("no input provided for enumeration")
return errkit.New("no input provided for enumeration")
}

if len(r.options.Ports) == 0 {
// Append port 443 for default ports
r.options.Ports = append(r.options.Ports, "443")
}
if r.options.CertsOnly && (r.options.ScanMode != "ztls" && r.options.ScanMode != "auto") {
return errorutils.New("scan-mode must be ztls or auto with certs-only option")
return errkit.New("scan-mode must be ztls or auto with certs-only option")
}
if r.options.CertsOnly || r.options.Ja3 || r.options.Ja3s {
r.options.ScanMode = "ztls" // force setting ztls when using certs-only
Expand Down
18 changes: 9 additions & 9 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/projectdiscovery/tlsx/pkg/tlsx"
"github.com/projectdiscovery/tlsx/pkg/tlsx/clients"
"github.com/projectdiscovery/tlsx/pkg/tlsx/openssl"
errorutil "github.com/projectdiscovery/utils/errors"
"github.com/projectdiscovery/utils/errkit" //nolint
iputil "github.com/projectdiscovery/utils/ip"
sliceutil "github.com/projectdiscovery/utils/slice"
updateutils "github.com/projectdiscovery/utils/update"
Expand Down Expand Up @@ -79,7 +79,7 @@ func New(options *clients.Options) (*Runner, error) {

runner := &Runner{options: options}
if err := runner.validateOptions(); err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not validate options")
return nil, errkit.Wrap(err, "could not validate options")
}

dialerTimeout := time.Duration(options.Timeout) * time.Second
Expand All @@ -88,14 +88,14 @@ func New(options *clients.Options) (*Runner, error) {
if options.Proxy != "" {
proxyURL, err := url.Parse(options.Proxy)
if err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not parse proxy")
return nil, errkit.Wrap(err, "could not parse proxy")
}
dialer, err := proxy.FromURL(proxyURL, &net.Dialer{
Timeout: dialerTimeout,
DualStack: true,
})
if err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not create proxy dialer")
return nil, errkit.Wrap(err, "could not create proxy dialer")
}
proxyDialer = &dialer
}
Expand All @@ -112,7 +112,7 @@ func New(options *clients.Options) (*Runner, error) {
}
fastDialer, err := fastdialer.NewDialer(dialerOpts)
if err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not create dialer")
return nil, errkit.Wrap(err, "could not create dialer")
}
runner.fastDialer = fastDialer
runner.options.Fastdialer = fastDialer
Expand All @@ -131,7 +131,7 @@ func New(options *clients.Options) (*Runner, error) {

outputWriter, err := output.New(options)
if err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not create output writer")
return nil, errkit.Wrap(err, "could not create output writer")
}
runner.outputWriter = outputWriter
if options.TlsCiphersEnum && !options.Silent {
Expand Down Expand Up @@ -244,7 +244,7 @@ func (r *Runner) executeCTLogsMode() error {
// Display CT log progress information in verbose mode
if r.options.Verbose {
progressPercent := float64(meta.Index) / float64(meta.TreeSize) * 100
gologger.Info().Msgf("[CT] %s: Index %d/%d (%.1f%%), Lag: %d, URL: %s",
gologger.Info().Msgf("[CT] %s: Index %d/%d (%.1f%%), Lag: %d, URL: %s",
meta.SourceDesc, meta.Index, meta.TreeSize, progressPercent, meta.Lag, meta.LogURL)
}

Expand All @@ -267,7 +267,7 @@ func (r *Runner) executeCTLogsMode() error {

ctService, err := ctlogs.New(svcOpts...)
if err != nil {
return errorutil.NewWithErr(err).Msgf("could not create CT logs service")
return errkit.Wrap(err, "could not create CT logs service")
}

// Start streaming
Expand Down Expand Up @@ -326,7 +326,7 @@ func (r *Runner) normalizeAndQueueInputs(inputs chan taskInput) error {
if r.options.InputList != "" {
file, err := os.Open(r.options.InputList)
if err != nil {
return errorutil.NewWithErr(err).Msgf("could not open input file")
return errkit.Wrap(err, "could not open input file")
}
defer func() {
if err := file.Close(); err != nil {
Expand Down
12 changes: 6 additions & 6 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
jsoniter "github.com/json-iterator/go"
"github.com/logrusorgru/aurora"
"github.com/projectdiscovery/tlsx/pkg/tlsx/clients"
errorutil "github.com/projectdiscovery/utils/errors"
"github.com/projectdiscovery/utils/errkit" //nolint
mapsutil "github.com/projectdiscovery/utils/maps"
"golang.org/x/exp/maps"
)
Expand Down Expand Up @@ -50,7 +50,7 @@ func New(options *clients.Options) (Writer, error) {
if options.OutputFile != "" {
output, err := newFileOutputWriter(options.OutputFile)
if err != nil {
return nil, errorutil.NewWithErr(err).Msgf("could not create output file")
return nil, errkit.Wrap(err, "could not create output file")
}
outputFile = output
}
Expand All @@ -75,7 +75,7 @@ func (w *StandardWriter) Write(event *clients.Response) error {
data, err = w.formatStandard(event)
}
if err != nil {
return errorutil.NewWithErr(err).Msgf("could not format output")
return errkit.Wrap(err, "could not format output")
}
data = bytes.TrimSuffix(data, []byte("\n")) // remove last newline
if len(data) == 0 {
Expand All @@ -92,7 +92,7 @@ func (w *StandardWriter) Write(event *clients.Response) error {
data = decolorizerRegex.ReplaceAll(data, []byte(""))
}
if writeErr := w.outputFile.Write(data); writeErr != nil {
return errorutil.NewWithErr(err).Msgf("could not write to output")
return errkit.Wrap(err, "could not write to output")
}
}
return nil
Expand All @@ -115,11 +115,11 @@ func (w *StandardWriter) formatJSON(output *clients.Response) ([]byte, error) {
// formatStandard formats the output for standard client formatting
func (w *StandardWriter) formatStandard(output *clients.Response) ([]byte, error) {
if output == nil {
return nil, errorutil.New("empty certificate response")
return nil, errkit.New("empty certificate response")
}

if output.CertificateResponse == nil {
return nil, errorutil.New("empty leaf certificate")
return nil, errkit.New("empty leaf certificate")
}
cert := output.CertificateResponse
builder := &bytes.Buffer{}
Expand Down
Loading
Loading