Skip to content
Merged

v1.7.2 #2308

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
d9a2775
Dismiss alert lead to take screenshot
Serizao Jul 23, 2025
2db3aba
Merge branch 'dev' into patch-1
Serizao Jul 23, 2025
1ebaf80
Update headless.go
Serizao Jul 23, 2025
9c9b5d6
Update types.go
Serizao Jul 23, 2025
25caac8
Update runner.go
Serizao Jul 23, 2025
5e26986
Update headless.go
Serizao Jul 23, 2025
57de6b9
Update headless.go
Serizao Jul 23, 2025
180bbdd
Update headless.go
Serizao Jul 23, 2025
d6e95e1
Update headless.go
Serizao Jul 23, 2025
87b26b0
Merge branch 'dev' into add-network-logging
Serizao Jul 24, 2025
dc8ad17
introduce dynamic filtering
dogancanbakir Jul 24, 2025
fa65a0a
minor
dogancanbakir Jul 24, 2025
7690a1f
Merge branch 'dev' into add-network-logging
Serizao Jul 30, 2025
04fd376
Merge branch 'dev' into patch-1
Serizao Jul 30, 2025
93e9581
fix: integrate Allow and Deny flags with NetworkPolicy validation
noaho Aug 5, 2025
5bc9fc6
test: add comprehensive test cases for combined Allow/Deny flag usage
noaho Aug 5, 2025
bb3b7f0
fix: apply -pr/--protocol flag correctly
khs-alt Aug 6, 2025
59add53
chore(deps): bump golang.org/x/net from 0.42.0 to 0.43.0
dependabot[bot] Aug 11, 2025
5a6a4a5
chore(deps): bump golang.org/x/text from 0.27.0 to 0.28.0
dependabot[bot] Aug 11, 2025
05aba7c
Merge branch 'dev' into dependabot/go_modules/dev/golang.org/x/text-0…
Mzack9999 Aug 12, 2025
6da26ca
Merge pull request #2238 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Aug 12, 2025
079732e
add exp info
Mzack9999 Aug 12, 2025
1abcf2b
Merge pull request #2234 from khs-alt/protocal
Mzack9999 Aug 12, 2025
89e6c96
chore(deps): bump the modules group across 1 directory with 7 updates
dependabot[bot] Aug 11, 2025
ee6a467
Change tests to a table format
noaho Aug 14, 2025
7835de7
retain asn expansion
Mzack9999 Aug 14, 2025
9b0acdd
Merge branch 'dev' into fix_networkpolicy
Mzack9999 Aug 14, 2025
5f55bfa
Merge pull request #2232 from noaho/fix_networkpolicy
Mzack9999 Aug 14, 2025
f0e464f
Implement auto-referer option
siamak-amo Jul 26, 2025
d45d9e9
chore(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.0
dependabot[bot] Aug 25, 2025
1c6cc51
chore(deps): bump github.com/weppos/publicsuffix-go
dependabot[bot] Aug 25, 2025
6e3016e
chore(deps): bump the modules group across 1 directory with 8 updates
dependabot[bot] Aug 25, 2025
f2881db
improving autoref
Mzack9999 Aug 28, 2025
281ed16
doc
Mzack9999 Aug 28, 2025
fa5055c
Merge branch 'dev' into pr/2245
Mzack9999 Aug 28, 2025
2b688a5
lint
Mzack9999 Aug 28, 2025
01064f7
Merge pull request #2245 from siamak-amo/auto-referer
Mzack9999 Aug 28, 2025
4bdaadf
make stale workflow ubiquitous
dogancanbakir Aug 29, 2025
8caf0bf
Merge pull request #2251 from projectdiscovery/2250_make_stale_workfl…
Mzack9999 Aug 29, 2025
3909667
tlsx dep update
ehsandeep Sep 1, 2025
4d3e3a4
Merge branch 'dev' into 2103_introduce_dynamic_output_filtering
dogancanbakir Sep 2, 2025
8d6c265
Html2text change library (#2255)
ehsandeep Sep 2, 2025
65d4f6e
chars
Mzack9999 Sep 3, 2025
a8a4969
update readme
Mzack9999 Sep 3, 2025
56c3dc4
Merge pull request #2221 from projectdiscovery/2103_introduce_dynamic…
Mzack9999 Sep 3, 2025
177195c
chore(deps): bump golang.org/x/text from 0.28.0 to 0.29.0
dependabot[bot] Sep 8, 2025
2f75eaf
chore(deps): bump github.com/JohannesKaufmann/html-to-markdown/v2
dependabot[bot] Sep 8, 2025
174c748
chore(deps): bump github.com/stretchr/testify from 1.11.0 to 1.11.1
dependabot[bot] Sep 8, 2025
da1e3b2
add custom fingerprint support
dogancanbakir Sep 9, 2025
29246f4
docs: remove redundant usage section from README
ayanrajpoot10 Sep 9, 2025
cac24d7
Merge pull request #2264 from ayanrajpoot10/dev
dogancanbakir Sep 10, 2025
d85379f
Merge pull request #2263 from projectdiscovery/1803_add_custom_finger…
Mzack9999 Sep 10, 2025
fc425de
Merge pull request #2265 from projectdiscovery/main
Mzack9999 Sep 11, 2025
01ec508
chore(deps): bump github.com/ulikunitz/xz from 0.5.12 to 0.5.14
dependabot[bot] Aug 28, 2025
272edfc
bump
Mzack9999 Sep 12, 2025
a4e5306
chore(deps): bump the modules group with 7 updates
dependabot[bot] Sep 12, 2025
84a54b9
Merge branch 'dev' into pr/2219
Mzack9999 Sep 12, 2025
ad83070
better handling
Mzack9999 Sep 12, 2025
8f6a1ca
Merge pull request #2219 from Serizao/patch-1
Mzack9999 Sep 12, 2025
858b155
Merge branch 'dev' into pr/2220
Mzack9999 Sep 12, 2025
bf076a4
lint
Mzack9999 Sep 12, 2025
6bc51b4
Merge pull request #2220 from Serizao/add-network-logging
Mzack9999 Sep 12, 2025
0fcf641
chore(deps): bump golang.org/x/net from 0.43.0 to 0.44.0
dependabot[bot] Sep 15, 2025
9c11b39
chore(deps): bump github.com/go-faker/faker/v4 from 4.6.1 to 4.6.2
dependabot[bot] Sep 15, 2025
500e982
chore(deps): bump the modules group with 7 updates
dependabot[bot] Sep 15, 2025
7dfd091
chore(deps): bump github.com/go-faker/faker/v4 from 4.6.2 to 4.7.0
dependabot[bot] Sep 29, 2025
3259ec7
fix: write to index only one time
circleous Oct 4, 2025
6d01544
fix: do not store failed reqs
circleous Oct 4, 2025
ee3b2ab
revert: resp.err already checked before enter the block
circleous Oct 4, 2025
8f33284
feat: add shorthand flag for websocket option in command line
ayanrajpoot10 Oct 10, 2025
4346dfe
Update Go version requirement from 1.21 to 1.24 for httpx v1.7.1 inst…
patchmyday Oct 10, 2025
cb1dd8d
chore(deps): bump github.com/nwaples/rardecode/v2
dependabot[bot] Oct 11, 2025
1f97937
chore(deps): bump golang.org/x/net from 0.44.0 to 0.46.0
dependabot[bot] Oct 13, 2025
656de33
Merge branch 'dev' into patch-1
dogancanbakir Oct 13, 2025
25a059b
Merge pull request #2288 from DFwJZ/patch-1
dogancanbakir Oct 13, 2025
e10302e
Merge pull request #2282 from circleous/remove-double-entry-index
Mzack9999 Oct 15, 2025
1499685
chore(deps): bump the modules group across 1 directory with 11 updates
dependabot[bot] Oct 13, 2025
f94f72d
Merge pull request #2287 from ayanrajpoot10/dev
Mzack9999 Oct 15, 2025
9c4047d
feat: add ANSI color stripping functionality for file output
ayanrajpoot10 Oct 16, 2025
6d38be3
Merge branch 'projectdiscovery:dev' into dev
ayanrajpoot10 Oct 16, 2025
5d1a326
always strip ansi color from file + autoassign
Mzack9999 Oct 19, 2025
dfcc970
better handling of ansi chars
Mzack9999 Oct 20, 2025
e069771
Merge pull request #2293 from ayanrajpoot10/dev
Mzack9999 Oct 20, 2025
7b8fd15
chore(deps): bump the modules group with 8 updates
dependabot[bot] Oct 20, 2025
497c399
fix: ensure Host header is set in unsafe mode for rawhttp requests
ayanrajpoot10 Oct 22, 2025
1814fc4
adding port optimization
Mzack9999 Oct 23, 2025
b1e39db
Merge pull request #2298 from projectdiscovery/feat-ports-optimization
dogancanbakir Oct 23, 2025
e34656f
js inject from https://github.com/projectdiscovery/httpx/pull/2066
Mzack9999 Oct 24, 2025
6a7d7f5
fixing param name
Mzack9999 Oct 24, 2025
1b6883c
split logic in screenshot method
Mzack9999 Oct 24, 2025
ef56623
updating docs
Mzack9999 Oct 24, 2025
649a85d
Merge pull request #2300 from projectdiscovery/feat-2067-js-inject
Mzack9999 Oct 24, 2025
07ec4e5
chore(deps): bump the modules group with 7 updates
dependabot[bot] Oct 27, 2025
bcc42f5
Merge pull request #2297 from ayanrajpoot10/dev
Mzack9999 Oct 30, 2025
e5ce4f9
Update GoReleaser configurations
emmanuel-ferdman Oct 31, 2025
18422bd
Merge pull request #2302 from emmanuel-ferdman/dev
Mzack9999 Nov 2, 2025
4d96574
chore(deps): bump the modules group with 7 updates
dependabot[bot] Nov 3, 2025
27a22c6
Fixing custom asset id upload (#2305)
Mzack9999 Nov 7, 2025
6ddf7ca
Enable screenshot upload (#2307)
Mzack9999 Nov 14, 2025
6b9a061
chore(deps): bump the modules group with 4 updates (#2306)
dependabot[bot] Nov 14, 2025
d370e9e
version update
ehsandeep Nov 14, 2025
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
9 changes: 9 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
addReviewers: true
reviewers:
- dogancanbakir
- dwisiswant0
- mzack9999

numberOfReviewers: 1
skipKeywords:
- '@dependabot'
44 changes: 32 additions & 12 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
name: 'Close stale issues and PR'
name: 💤 Stale

on:
schedule:
- cron: '30 1 * * *'
- cron: "0 0 * * 0" # Weekly

jobs:
stale:
runs-on: ubuntu-latest
permissions:
actions: write
contents: write # only for delete-branch option
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
with:
only-labels: "Status: Abandoned, Type: Question"
stale-issue-label: stale
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 90 days.'
close-issue-message: 'This issue was closed because it has been stalled for 90 days with no activity.'
days-before-stale: 14
days-before-close: 90
days-before-pr-stale: -1
days-before-pr-close: -1
stale-pr-message: ''
close-pr-message: ''
days-before-stale: 90
days-before-close: 7
stale-issue-label: "Status: Stale"
stale-pr-label: "Status: Stale"
stale-issue-message: >
This issue has been automatically marked as stale because it has not
had recent activity. It will be closed in 7 days if no further
activity occurs. Thank you for your contributions!
stale-pr-message: >
This pull request has been automatically marked as stale due to
inactivity. It will be closed in 7 days if no further activity
occurs. Please update if you wish to keep it open.
close-issue-message: >
This issue has been automatically closed due to inactivity. If you
think this is a mistake or would like to continue the discussion,
please comment or feel free to reopen it.
close-pr-message: >
This pull request has been automatically closed due to inactivity.
If you think this is a mistake or would like to continue working on
it, please comment or feel free to reopen it.
close-issue-label: "Status: Abandoned"
close-pr-label: "Status: Abandoned"
exempt-issue-labels: "Status: Abandoned"
exempt-pr-labels: "Status: Abandoned"
5 changes: 3 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ builds:
main: cmd/httpx/httpx.go

archives:
- format: zip
- formats:
- zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ if eq .Os "darwin" }}macOS{{ else }}{{ .Os }}{{ end }}_{{ .Arch }}'

checksum:
Expand All @@ -42,4 +43,4 @@ announce:

discord:
enabled: true
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'
message_template: '**New Release: {{ .ProjectName }} {{.Tag}}** is published! Check it out at {{ .ReleaseURL }}'
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

# Installation Instructions

`httpx` requires **go1.21** to install successfully. Run the following command to get the repo:
`httpx` requires **go >=1.24.0** to install successfully. Run the following command to get the repo:

```sh
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
Expand All @@ -85,10 +85,6 @@ This will display help for the tool. Here are all the switches it supports.


```console
Usage:
./httpx [flags]

Flags:
httpx is a fast and multi-purpose HTTP toolkit that allows running multiple probes using the retryablehttp library.

Usage:
Expand All @@ -115,8 +111,9 @@ PROBES:
-bp, -body-preview display first N characters of response body (default 100)
-server, -web-server display server name
-td, -tech-detect display technology in use based on wappalyzer dataset
-cff, -custom-fingerprint-file string path to a custom fingerprint file for technology detection
-method display http request method
-websocket display server using websocket
-ws, -websocket display server using websocket
-ip display host ip
-cname display host cname
-extract-fqdn, -efqdn get domain and subdomains from response body and header in jsonl/csv output
Expand All @@ -133,6 +130,7 @@ HEADLESS:
-ehb, -exclude-headless-body enable excluding headless header from json output
-st, -screenshot-timeout value set timeout for screenshot in seconds (default 10s)
-sid, -screenshot-idle value set idle time before taking screenshot in seconds (default 1s)
-jsc, -javascript-code string[] execute JavaScript code after navigation

MATCHERS:
-mc, -match-code string match response with specified status code (-mc 200,302)
Expand Down Expand Up @@ -203,6 +201,8 @@ OUTPUT:
-svrc, -store-vision-recon-cluster include visual recon clusters (-ss and -sr only)
-pr, -protocol string protocol to use (unknown, http11)
-fepp, -filter-error-page-path string path to store filtered error pages (default "filtered_error_page.json")
-lof, -list-output-fields list available output field names for filtering
-eof, -exclude-output-fields string[] exclude specified output fields from results

CONFIGURATIONS:
-config string path to the httpx configuration file (default $HOME/.config/httpx/config.yaml)
Expand All @@ -211,6 +211,7 @@ CONFIGURATIONS:
-deny string[] denied list of IP/CIDR's to process (file or comma separated)
-sni, -sni-name string custom TLS SNI name
-random-agent enable Random User-Agent to use (default true)
-auto-referer set the Referer header to the current URL (default false)
-H, -header string[] custom http headers to send with request
-http-proxy, -proxy string http proxy to use (eg http://127.0.0.1:8080)
-unsafe send raw requests skipping golang normalization
Expand Down
4 changes: 3 additions & 1 deletion cmd/functional-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func runFunctionalTests() error {
if err != nil {
return errors.Wrap(err, "could not open test cases")
}
defer file.Close()
defer func() {
_ = file.Close()
}()

scanner := bufio.NewScanner(file)
for scanner.Scan() {
Expand Down
6 changes: 2 additions & 4 deletions cmd/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ func setupOptionalAssetUpload(opts *runner.Options) *pdcp.UploadWriter {
}
return nil
}
if opts.Screenshot {
gologger.Fatal().Msgf("Screenshot option is not supported for dashboard upload yet")
}
gologger.Info().Msgf("To view results in UI dashboard, visit https://cloud.projectdiscovery.io/assets upon completion.")
h := &pdcpauth.PDCPCredHandler{}
creds, err := h.GetCreds()
Expand All @@ -131,10 +128,11 @@ func setupOptionalAssetUpload(opts *runner.Options) *pdcp.UploadWriter {
opts.OnClose = func() {
writer.Close()
}

// add additional metadata
if opts.AssetID != "" {
// silently ignore
_ = writer.SetAssetID(opts.AssetID)
writer.SetAssetID(opts.AssetID)
}
if opts.AssetName != "" {
// silently ignore
Expand Down
24 changes: 12 additions & 12 deletions cmd/integration-test/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type standardHttpGet struct {
func (h *standardHttpGet) Execute() error {
router := httprouter.New()
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
fmt.Fprintf(w, "This is a test")
_, _ = fmt.Fprintf(w, "This is a test")
r.Close = true
}))
var ts *httptest.Server
Expand Down Expand Up @@ -100,7 +100,7 @@ func (h *issue276) Execute() error {
router.GET("/redirect", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.Header().Add("Location", ts.URL+"/redirect")
w.WriteHeader(302)
fmt.Fprintf(w, "<html><body><title>Object moved</title></body></html>")
_, _ = fmt.Fprintf(w, "<html><body><title>Object moved</title></body></html>")
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand Down Expand Up @@ -163,7 +163,7 @@ func (h *issue303) Execute() error {
// mimic a misconfigured web server behavior declaring gzip body
w.Header().Add("Content-Encoding", "gzip")
// but sending it uncompressed
fmt.Fprint(w, "<html><body>This is a test</body></html>")
_, _ = fmt.Fprint(w, "<html><body>This is a test</body></html>")
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand Down Expand Up @@ -191,7 +191,7 @@ func (h *issue363) Execute() error {
router.GET("/redirect", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.Header().Add("Location", ts.URL+"/redirect")
w.WriteHeader(302)
fmt.Fprintf(w, "<html><body><title>Object moved</title></body></html>")
_, _ = fmt.Fprintf(w, "<html><body><title>Object moved</title></body></html>")
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -214,7 +214,7 @@ func (h *issue400) Execute() error {
router.POST("/receive", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
data, _ := io.ReadAll(r.Body)
fmt.Fprintf(w, "data received %s", data)
_, _ = fmt.Fprintf(w, "data received %s", data)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -238,7 +238,7 @@ func (h *issue414) Execute() error {
router.POST(uripath, httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
data, _ := io.ReadAll(r.Body)
fmt.Fprintf(w, "data received %s", data)
_, _ = fmt.Fprintf(w, "data received %s", data)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -265,7 +265,7 @@ func (h *titleUnwantedChars) Execute() error {
uriPath := "/index"
router.GET(uriPath, httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
htmlResponse := "<html><head><title>\v\fProject\n\r Discovery\n - Httpx\t></title></head><body>test data</body></html>"
fmt.Fprint(w, htmlResponse)
_, _ = fmt.Fprint(w, htmlResponse)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -290,7 +290,7 @@ func (h *issue480) Execute() error {
uriPath := "////////////////../../../../../../../../etc/passwd"
router.GET(uriPath, httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
htmlResponse := "<html><body>ok from uri</body></html>"
fmt.Fprint(w, htmlResponse)
_, _ = fmt.Fprint(w, htmlResponse)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -314,7 +314,7 @@ func (h *customHeader) Execute() error {
router := httprouter.New()
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
fmt.Fprint(w, `{"status": "ok"}`)
_, _ = fmt.Fprint(w, `{"status": "ok"}`)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -341,7 +341,7 @@ func (h *outputMatchCondition) Execute() error {
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(200)
fmt.Fprint(w, `{"status": "ok"}`)
_, _ = fmt.Fprint(w, `{"status": "ok"}`)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -365,7 +365,7 @@ func (h *outputFilterCondition) Execute() error {
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(200)
fmt.Fprint(w, `{"status": "ok"}`)
_, _ = fmt.Fprint(w, `{"status": "ok"}`)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand All @@ -390,7 +390,7 @@ func (h *outputAll) Execute() error {
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
w.Header().Add("Content-Type", "application/json")
w.WriteHeader(200)
fmt.Fprint(w, `{"status": "ok"}`)
_, _ = fmt.Fprint(w, `{"status": "ok"}`)
}))
ts = httptest.NewServer(router)
defer ts.Close()
Expand Down
8 changes: 6 additions & 2 deletions cmd/integration-test/library.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ func (h *httpxLibrary) Execute() error {
if err != nil {
return err
}
defer os.RemoveAll(testFile)
defer func() {
_ = os.RemoveAll(testFile)
}()

var got string

Expand Down Expand Up @@ -64,7 +66,9 @@ func (h *httpxLibraryWithStream) Execute() error {
if err != nil {
return err
}
defer os.RemoveAll(testFile)
defer func() {
_ = os.RemoveAll(testFile)
}()

var got string

Expand Down
4 changes: 2 additions & 2 deletions common/customports/customport.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ func (c *CustomPorts) Set(value string) error {
}
highP, err := strconv.Atoi(potentialRange[1])
if err != nil {
return errors.Wrap(err, fmt.Sprintf("Could not cast last port of your port range(%s) to integer from your value: %s", potentialPort, potentialRange[1]))
return errors.Wrap(err, fmt.Sprintf("could not cast last port of your port range(%s) to integer from your value: %s", potentialPort, potentialRange[1]))
}
if err := checkPortValue(highP); err != nil {
return errors.Wrap(err, fmt.Sprintf("last port of your range(%d)", lowP))
}

if lowP > highP {
return fmt.Errorf("First value of port range should be lower than the last port from your range: [%d, %d]", lowP, highP)
return fmt.Errorf("first value of port range should be lower than the last port from your range: [%d, %d]", lowP, highP)
}

for i := lowP; i <= highP; i++ {
Expand Down
12 changes: 9 additions & 3 deletions common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func New(options *Options) (*HTTPX, error) {

if httpx.Options.Protocol == "http11" {
// disable http2
os.Setenv("GODEBUG", "http2client=0")
_ = os.Setenv("GODEBUG", "http2client=0")
transport.TLSNextProto = map[string]func(string, *tls.Conn) http.RoundTripper{}
}

Expand Down Expand Up @@ -359,7 +359,7 @@ func (h *HTTPX) getResponse(req *retryablehttp.Request, unsafeOptions UnsafeOpti
func (h *HTTPX) doUnsafeWithOptions(req *retryablehttp.Request, unsafeOptions UnsafeOptions) (*http.Response, error) {
method := req.Method
headers := req.Header
targetURL := req.URL.String()
targetURL := req.String()
body := req.Body
options := rawhttp.DefaultOptions
options.Timeout = h.Options.Timeout
Expand Down Expand Up @@ -424,6 +424,9 @@ func (h *HTTPX) SetCustomHeaders(r *retryablehttp.Request, headers map[string]st
switch strings.ToLower(name) {
case "host":
r.Host = value
if h.Options.Unsafe {
r.Header.Set("Host", value)
}
case "cookie":
// cookies are set in the default branch, and reset during the follow redirect flow
fallthrough
Expand All @@ -435,6 +438,9 @@ func (h *HTTPX) SetCustomHeaders(r *retryablehttp.Request, headers map[string]st
userAgent := useragent.PickRandom()
r.Header.Set("User-Agent", userAgent.Raw) //nolint
}
if h.Options.AutoReferer && r.Header.Get("Referer") == "" {
r.Header.Set("Referer", r.String())
}
}

func (httpx *HTTPX) setCustomCookies(req *http.Request) {
Expand All @@ -448,7 +454,7 @@ func (httpx *HTTPX) setCustomCookies(req *http.Request) {
func (httpx *HTTPX) Sanitize(respStr string, trimLine, normalizeSpaces bool) string {
respStr = httpx.htmlPolicy.Sanitize(respStr)
if trimLine {
respStr = strings.Replace(respStr, "\n", "", -1)
respStr = strings.ReplaceAll(respStr, "\n", "")
}
if normalizeSpaces {
respStr = httputilz.NormalizeSpaces(respStr)
Expand Down
1 change: 1 addition & 0 deletions common/httpx/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// Options contains configuration options for the client
type Options struct {
RandomAgent bool
AutoReferer bool
DefaultUserAgent string
Proxy string
// Deprecated: use Proxy
Expand Down
4 changes: 2 additions & 2 deletions common/pagetypeclassifier/pagetypeclassifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pagetypeclassifier
import (
_ "embed"

"github.com/jaytaylor/html2text"
htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown/v2"
"github.com/projectdiscovery/utils/ml/naive_bayes"
)

Expand Down Expand Up @@ -31,7 +31,7 @@ func (n *PageTypeClassifier) Classify(html string) string {
}

func htmlToText(html string) string {
text, err := html2text.FromString(html, html2text.Options{TextOnly: true})
text, err := htmltomarkdown.ConvertString(html)
if err != nil {
panic(err)
}
Expand Down
Loading
Loading