Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream tag v1.3.1 (revision 4481af0) #38

Closed
wants to merge 106 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
1092415
chore(deps): bump github.com/projectdiscovery/tlsx from 1.0.4 to 1.0.6
dependabot[bot] Mar 15, 2023
b77f627
Merge pull request #1047 from projectdiscovery/dependabot/go_modules/…
ehsandeep Mar 15, 2023
f273a9e
chore(deps): bump actions/setup-go from 3 to 4
dependabot[bot] Mar 20, 2023
9a19c2f
chore(deps): bump github.com/projectdiscovery/mapcidr
dependabot[bot] Mar 20, 2023
0582b6a
chore(deps): bump github.com/projectdiscovery/utils
dependabot[bot] Mar 20, 2023
ee7bc3a
chore(deps): bump github.com/projectdiscovery/hmap from 0.0.10 to 0.0.11
dependabot[bot] Mar 20, 2023
2a75f3f
Merge pull request #1053 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 21, 2023
e52bf67
Merge pull request #1052 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 21, 2023
22cb902
Merge pull request #1051 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 21, 2023
33743cd
Merge pull request #1049 from projectdiscovery/dependabot/github_acti…
Mzack9999 Mar 21, 2023
1cf5cd5
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] Mar 21, 2023
b4038bf
Merge pull request #1050 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 21, 2023
93dce59
chore(deps): bump github.com/projectdiscovery/retryablehttp-go
dependabot[bot] Mar 27, 2023
e4e3d9d
chore(deps): bump github.com/projectdiscovery/utils
dependabot[bot] Mar 27, 2023
9707452
Merge pull request #1060 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 28, 2023
9d8c39c
Merge pull request #1061 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 28, 2023
1cbcf04
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] Mar 28, 2023
a45e669
Merge pull request #1062 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Mar 28, 2023
83660df
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.3 to 0.0.4
dependabot[bot] Mar 29, 2023
5b898a0
Merge pull request #1066 from projectdiscovery/dependabot/go_modules/…
ehsandeep Mar 29, 2023
1defd0a
Add support to skip decode (#1055)
Mzack9999 Mar 29, 2023
0a4e024
semicolon to underscore
Mzack9999 Mar 29, 2023
76e8a4a
Merge pull request #1067 from projectdiscovery/issue-1040-win-path
Mzack9999 Mar 29, 2023
7e732e6
Check into all dsl variables
ShubhamRasal Mar 30, 2023
539cd68
Merge branch 'dev' into issue-1019-dsl-var-missing
ShubhamRasal Mar 30, 2023
fb2ed6b
chore(deps): bump go.uber.org/multierr from 1.10.0 to 1.11.0
dependabot[bot] Mar 30, 2023
295bd71
chore(deps): bump alpine from 3.17.2 to 3.17.3
dependabot[bot] Apr 3, 2023
31fb64c
chore(deps): bump github.com/projectdiscovery/rawhttp
dependabot[bot] Apr 3, 2023
baf3ff7
chore(deps): bump github.com/projectdiscovery/utils
dependabot[bot] Apr 3, 2023
2dccd17
Merge pull request #1068 from projectdiscovery/issue-1019-dsl-var-mis…
Mzack9999 Apr 5, 2023
ad1285c
Merge pull request #1073 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Apr 5, 2023
eb85cdf
Merge pull request #1072 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Apr 5, 2023
3f7bf08
Merge pull request #1069 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Apr 5, 2023
f0d2b8f
Merge pull request #1070 from projectdiscovery/dependabot/docker/dev/…
Mzack9999 Apr 5, 2023
1259fa6
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] Apr 5, 2023
66f9ad5
Merge pull request #1071 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Apr 5, 2023
8f45328
chore(deps): bump github.com/projectdiscovery/wappalyzergo from 0.0.8…
dependabot[bot] Apr 10, 2023
d511790
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.4 to 0.0.5…
dependabot[bot] Apr 10, 2023
a080a6e
chore(deps): bump golang from 1.20.2-alpine to 1.20.3-alpine (#1080)
dependabot[bot] Apr 10, 2023
fecd782
chore(deps): bump golang.org/x/text from 0.8.0 to 0.9.0 (#1074)
dependabot[bot] Apr 10, 2023
0dc39fe
Added exported ScanOptions + Raw + Err methods
Ice3man543 Apr 12, 2023
9a1239b
stale yml updates (#1088)
MetzinAround Apr 16, 2023
c24d07b
chore(deps): bump golang.org/x/net from 0.8.0 to 0.9.0 (#1075)
dependabot[bot] Apr 16, 2023
24d5f0b
chore(deps): bump github.com/rs/xid from 1.4.0 to 1.5.0 (#1087)
dependabot[bot] Apr 16, 2023
e4caf6f
chore(deps): bump github.com/projectdiscovery/retryablehttp-go from 1…
dependabot[bot] Apr 16, 2023
2abe413
chore(deps): bump github.com/projectdiscovery/wappalyzergo from 0.0.9…
dependabot[bot] Apr 16, 2023
786257f
chore(deps): bump github.com/projectdiscovery/utils from 0.0.19 to 0.…
dependabot[bot] Apr 16, 2023
74de113
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.5 to 0.0.6
dependabot[bot] Apr 16, 2023
17589bf
Merge pull request #1095 from projectdiscovery/dependabot/go_modules/…
Mzack9999 Apr 16, 2023
591bc41
chore(deps): bump github.com/projectdiscovery/tlsx from 1.0.6 to 1.0.…
dependabot[bot] Apr 17, 2023
1ad430d
Error on http or https in the front domain name (#1100)
RamanaReddy0M Apr 18, 2023
64fa729
Minor update options.go to fix a typo in -leave-default-ports descrip…
ireland Apr 18, 2023
788ef43
Merge pull request #1104 from ireland/patch-1
Mzack9999 Apr 19, 2023
55a4dd6
update utils pkg
RamanaReddy0M Apr 20, 2023
3cf42ca
resolve merge conflicts
RamanaReddy0M Apr 20, 2023
72ac480
fix lint error
RamanaReddy0M Apr 20, 2023
be66fc3
update utils pkg (#1109)
RamanaReddy0M Apr 20, 2023
3f1f0d6
resolve merge conflicts
RamanaReddy0M Apr 20, 2023
3b4dd34
Merge pull request #1108 from projectdiscovery/issue-1048-mr-not-work…
Mzack9999 Apr 20, 2023
0f82960
chore(deps): bump github.com/projectdiscovery/utils from 0.0.24-0.202…
dependabot[bot] Apr 20, 2023
a0a3fef
chore(deps): bump github.com/projectdiscovery/utils from 0.0.24 to 0.…
dependabot[bot] Apr 26, 2023
f5e4fc8
chore(deps): bump github.com/projectdiscovery/wappalyzergo from 0.0.9…
dependabot[bot] Apr 26, 2023
1b12a94
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.6 to 0.0.7…
dependabot[bot] Apr 26, 2023
00d0977
Adding Screenshot support (#1097)
Mzack9999 Apr 26, 2023
7d41db1
chore(deps): bump github.com/projectdiscovery/cdncheck from 0.0.4-0.2…
dependabot[bot] Apr 27, 2023
5e58882
chore(deps): bump github.com/projectdiscovery/asnmap from 1.0.2 to 1.…
dependabot[bot] Apr 27, 2023
22d6378
go mod tidy
ehsandeep Apr 27, 2023
32a4598
version update
ehsandeep Apr 27, 2023
cedf917
Merge pull request #1120 from projectdiscovery/dev
ehsandeep Apr 27, 2023
7cdc2e7
chore(deps): bump github.com/projectdiscovery/fastdialer
dependabot[bot] May 1, 2023
a77f7f4
chore(deps): bump github.com/projectdiscovery/utils
dependabot[bot] May 1, 2023
b8951de
chore(deps): bump github.com/projectdiscovery/cdncheck
dependabot[bot] May 1, 2023
3986871
Merge pull request #1129 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 1, 2023
c648a6d
Merge pull request #1130 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 1, 2023
ca7a52a
Merge pull request #1131 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 1, 2023
ffab18a
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.7 to 0.0.8
dependabot[bot] May 1, 2023
00bb772
Update fastdialer version
ShubhamRasal May 1, 2023
84d88be
Merge pull request #1132 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 2, 2023
5d9b5aa
Merge branch 'dev' into issue-1079-tls-fail
ehsandeep May 2, 2023
c253a75
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] May 2, 2023
e45bd72
Merge pull request #1137 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 2, 2023
b87d745
chore(deps): bump github.com/projectdiscovery/tlsx from 1.0.8 to 1.0.9
dependabot[bot] May 2, 2023
5b6fd0a
Merge pull request #1138 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 2, 2023
9bff385
updating fastdialer version
Mzack9999 May 2, 2023
e817035
Merge pull request #1135 from projectdiscovery/issue-1079-tls-fail
Mzack9999 May 2, 2023
dc12380
chore(deps): bump github.com/projectdiscovery/dsl from 0.0.8 to 0.0.9
dependabot[bot] May 3, 2023
021be93
chore(deps): bump github.com/go-rod/rod from 0.112.8 to 0.112.9
dependabot[bot] May 3, 2023
7c9aa8e
Merge pull request #1140 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 3, 2023
6baaf8e
Merge pull request #1139 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 3, 2023
318f9cf
Merge branch 'dev' into sdk-code-improvements
Mzack9999 May 6, 2023
b3b14b6
fixing tests
Mzack9999 May 6, 2023
614f997
Merge pull request #1147 from projectdiscovery/sdk-code-improvements
Mzack9999 May 6, 2023
48c916e
chore(deps): bump golang from 1.20.3-alpine to 1.20.4-alpine
dependabot[bot] May 8, 2023
a979ea0
chore(deps): bump github.com/projectdiscovery/wappalyzergo
dependabot[bot] May 8, 2023
769056c
chore(deps): bump github.com/projectdiscovery/gologger
dependabot[bot] May 8, 2023
cacd768
Merge pull request #1152 from projectdiscovery/dependabot/docker/dev/…
ehsandeep May 8, 2023
b3251cd
Merge pull request #1153 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 8, 2023
26ef584
Merge pull request #1154 from projectdiscovery/dependabot/go_modules/…
ehsandeep May 8, 2023
288945a
utils update
ehsandeep May 8, 2023
cda9930
fix: httpx fallbacks even though -nfs is given for dead hosts (#1159)
RamanaReddy0M May 9, 2023
0bb82af
chore(deps): bump github.com/projectdiscovery/cdncheck from 1.0.1 to …
dependabot[bot] May 9, 2023
f29db39
chore(deps): bump github.com/projectdiscovery/retryablehttp-go from 1…
dependabot[bot] May 9, 2023
5c81523
chore(deps): bump github.com/projectdiscovery/gologger from 1.1.9 to …
dependabot[bot] May 9, 2023
6a774f8
chore(deps): bump golang.org/x/net from 0.9.0 to 0.10.0 (#1162)
dependabot[bot] May 9, 2023
33614d4
version update
ehsandeep May 9, 2023
4481af0
Merge pull request #1163 from projectdiscovery/dev
ehsandeep May 9, 2023
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
26 changes: 26 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 14

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30

# Issues with these labels will never be considered stale
# exemptLabels:
# - pinned
# - security

# Only issues or pull requests with all of these labels are check if stale.
onlyLabels:
- "Status: Abandoned"
- "Type: Question"

# Label to use when marking as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
activity in the past 2 weeks. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: This issue is being closed after 30 days of inactivity. Thank you.
6 changes: 5 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
os: [ubuntu-latest-16-cores, windows-latest-8-cores, macOS-latest]
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19

Expand All @@ -31,6 +31,10 @@ jobs:
run: go test ./...
working-directory: .

- name: Running example
run: go run .
working-directory: examples/

- name: Integration Tests Linux, macOS
if: runner.os == 'Linux' || runner.os == 'macOS'
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
os: [ubuntu-latest-16-cores, windows-latest-8-cores, macOS-latest]
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest-16-cores
steps:
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fetch-depth: 0

- name: "Set up Go"
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Base
FROM golang:1.20.2-alpine AS builder
FROM golang:1.20.4-alpine AS builder

RUN apk add --no-cache git build-base gcc musl-dev
WORKDIR /app
COPY . /app
RUN go mod download
RUN go build ./cmd/httpx

FROM alpine:3.17.2
FROM alpine:3.17.3
RUN apk -U upgrade --no-cache \
&& apk add --no-cache bind-tools ca-certificates
&& apk add --no-cache bind-tools ca-certificates chromium
COPY --from=builder /app/httpx /usr/local/bin/

ENTRYPOINT ["httpx"]
105 changes: 67 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,19 @@ PROBES:
-cdn display cdn in use
-probe display probe status

HEADLESS:
-ss, -screenshot enable saving screenshot of the page using headless browser
-system-chrome enable using local installed chrome for screenshot

MATCHERS:
-mc, -match-code string match response with specified status code (-mc 200,302)
-ml, -match-length string match response with specified content length (-ml 100,102)
-mlc, -match-line-count string match response body with specified line count (-mlc 423,532)
-mwc, -match-word-count string match response body with specified word count (-mwc 43,55)
-mfc, -match-favicon string[] match response with specified favicon hash (-mfc 1494302000)
-ms, -match-string string match response with specified string (case insensitive) (-ms admin)
-ms, -match-string string match response with specified string (-ms admin)
-mr, -match-regex string match response with specified regex (-mr admin)
-mcdn, -match-cdn string[] match host with specified cdn provider (oracle, google, azure, cloudflare, cloudfront, fastly, incapsula, leaseweb, akamai, sucuri)
-mcdn, -match-cdn string[] match host with specified cdn provider (incapsula, oracle, google, azure, cloudflare, cloudfront, fastly, akamai, sucuri, leaseweb)
-mrt, -match-response-time string match response with specified response time in seconds (-mrt '< 1')
-mdc, -match-condition string match response with dsl expression condition

Expand All @@ -133,7 +137,7 @@ FILTERS:
-ffc, -filter-favicon string[] filter response with specified favicon hash (-mfc 1494302000)
-fs, -filter-string string filter response with specified string (-fs admin)
-fe, -filter-regex string filter response with specified regex (-fe admin)
-fcdn, -filter-cdn string[] filter host with specified cdn provider (oracle, google, azure, cloudflare, cloudfront, fastly, incapsula, leaseweb, akamai, sucuri)
-fcdn, -filter-cdn string[] filter host with specified cdn provider (incapsula, oracle, google, azure, cloudflare, cloudfront, fastly, akamai, sucuri, leaseweb)
-frt, -filter-response-time string filter response with specified response time in seconds (-frt '> 1')
-fdc, -filter-condition string filter response with dsl expression condition

Expand All @@ -154,6 +158,10 @@ MISCELLANEOUS:
-vhost probe and display server supporting VHOST
-ldv, -list-dsl-variables list json output field keys name that support dsl matcher/filter

UPDATE:
-up, -update update httpx to latest version
-duc, -disable-update-check disable automatic httpx update check

OUTPUT:
-o, -output string file to write output results
-sr, -store-response store http response to output directory
Expand Down Expand Up @@ -184,8 +192,9 @@ CONFIGURATIONS:
-body string post body to include in http request
-s, -stream stream mode - start elaborating input targets without sorting
-sd, -skip-dedupe disable dedupe input items (only used with stream mode)
-ldp, -leave-default-ports leave default http/https ports in host header (eg. http://host:80 - https//host:443
-ldp, -leave-default-ports leave default http/https ports in host header (eg. http://host:80 - https://host:443
-ztls use ztls library with autofallback to standard one for tls13
-no-decode avoid decoding body

DEBUG:
-health-check, -hc run diagnostic check up
Expand Down Expand Up @@ -471,55 +480,75 @@ https://docs.hackerone.com
https://support.hackerone.com
```

### Using `httpx` as a library
`httpx` can be used as a library by creating an instance of the `Option` struct and populating it with the same options that would be specified via CLI. Once validated, the struct should be passed to a runner instance (to be closed at the end of the program) and the `RunEnumeration` method should be called. Here follows a minimal example of how to do it:
### Screenshot

```go
package main
Latest addition to the project, the addition of the `-screenshot` option in httpx, a powerful new feature that allows users to take screenshots of target URLs, pages, or endpoints along with the rendered DOM. This functionality enables the **visual content discovery process**, providing a comprehensive view of the target's visual appearance.

import (
"log"
Rendered DOM body is also included in json line output when `-screenshot` option is used with `-json` option.

"github.com/projectdiscovery/goflags"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
"github.com/projectdiscovery/httpx/runner"
)
#### 🚩 Usage

func main() {
gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) // increase the verbosity (optional)
To use the screenshot feature, simply add the `-screenshot` flag to your httpx command:

options := runner.Options{
Methods: "GET",
InputTargetHost: goflags.StringSlice{"scanme.sh", "projectdiscovery.io"},
//InputFile: "./targetDomains.txt", // path to file containing the target domains list
}
```console
httpx -screenshot -u https://example.com
```

if err := options.ValidateOptions(); err != nil {
log.Fatal(err)
}
🎯 Domain, Subdomain, and Path Support
The `-screenshot` option is versatile and can be used to capture screenshots for domains, subdomains, and even specific paths when used in conjunction with the `-path` option:

httpxRunner, err := runner.New(&options)
if err != nil {
log.Fatal(err)
}
defer httpxRunner.Close()
```console
httpx -screenshot -u example.com
httpx -screenshot -u https://example.com/login
httpx -screenshot -path fuzz_path.txt -u https://example.com
```

httpxRunner.RunEnumeration()
}
Using with other tools:

```console
subfinder -d example.com | httpx -screenshot
```

#### 🌐 System Chrome

By default, httpx will use the go-rod library to install and manage Chrome for taking screenshots. However, if you prefer to use your locally installed system Chrome, add the `-system-chrome` flag:

```console
httpx -screenshot -system-chrome -u https://example.com
```

#### 📁 Output Directory

Screenshots are stored in the output/screenshot directory by default. To specify a custom output directory, use the `-srd` option:

```console
httpx -screenshot -srd /path/to/custom/directory -u https://example.com
```

#### ⏳ Performance Considerations

Please note that since screenshots are captured using a headless browser, httpx runs will be slower when using the `-screenshot` option.

### Using `httpx` as a library
`httpx` can be used as a library by creating an instance of the `Option` struct and populating it with the same options that would be specified via CLI. Once validated, the struct should be passed to a runner instance (to be closed at the end of the program) and the `RunEnumeration` method should be called. A minimal example of how to do it is in the [examples](examples/) folder

# Notes

- As default, `httpx` checks for **HTTPS** probe and fall-back to **HTTP** only if **HTTPS** is not reachable.
- The `-no-fallback` flag can be used to display both **HTTP** and **HTTPS** results
- As default, `httpx` probe with **HTTPS** scheme and fall-back to **HTTP** only if **HTTPS** is not reachable.
- The `-no-fallback` flag can be used to probe and display both **HTTP** and **HTTPS** result.
- Custom scheme for ports can be defined, for example `-ports http:443,http:80,https:8443`
- The following flags should be used for specific use cases instead of running them as default with other probes:
* `-favicon`,`-vhost`, `-http2`, `-pipeline`, `-ports`, `-csp-probe`, `-tls-probe`, `-path`
- When using the `-json` flag, all the default probe results are included in the JSON output.
- Custom resolver supports multiple protocol (**doh|tcp|udp**) in form of `protocol:resolver:port` (e.g. `udp:127.0.0.1:53`)
- Invalid custom resolvers/files are ignored.
- The following flags should be used for specific use cases instead of running them as default with other probes:
- `-ports`
- `-path`
- `-vhost`
- `-screenshot`
- `-csp-probe`
- `-tls-probe`
- `-favicon`
- `-http2`
- `-pipeline`


# Acknowledgement

Expand Down
7 changes: 7 additions & 0 deletions common/fileutil/fileutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,10 @@ func LoadCidrsFromSliceOrFileWithMaxRecursion(option string, splitchar string, m

return
}

func AbsPathOrDefault(p string) string {
if absPath, err := filepath.Abs(p); err == nil {
return absPath
}
return p
}
2 changes: 1 addition & 1 deletion common/httpx/cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ func (h *HTTPX) CdnCheck(ip string) (bool, string, error) {
return false, "", fmt.Errorf("cdn client not configured")
}

return h.cdn.Check(net.ParseIP((ip)))
return h.cdn.CheckCDN(net.ParseIP((ip)))
}
10 changes: 5 additions & 5 deletions common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/microcosm-cc/bluemonday"
"github.com/projectdiscovery/cdncheck"
"github.com/projectdiscovery/fastdialer/fastdialer"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/rawhttp"
retryablehttp "github.com/projectdiscovery/retryablehttp-go"
pdhttputil "github.com/projectdiscovery/utils/http"
Expand Down Expand Up @@ -151,10 +150,7 @@ func New(options *Options) (*HTTPX, error) {
httpx.htmlPolicy = bluemonday.NewPolicy()
httpx.CustomHeaders = httpx.Options.CustomHeaders
if options.CdnCheck || options.ExcludeCdn {
httpx.cdn, err = cdncheck.NewWithCache()
if err != nil {
gologger.Error().Msgf("could not create cdn check: %v", err)
}
httpx.cdn = cdncheck.New()
}

return httpx, nil
Expand Down Expand Up @@ -218,6 +214,10 @@ get_response:
return nil, closeErr
}

// Todo: replace with https://github.com/projectdiscovery/utils/issues/110
resp.RawData = make([]byte, len(respbody))
copy(resp.RawData, respbody)

respbody, err = DecodeData(respbody, httpresp.Header)
if err != nil && !shouldIgnoreBodyErrors {
return nil, closeErr
Expand Down
3 changes: 2 additions & 1 deletion common/httpx/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
type Response struct {
StatusCode int
Headers map[string][]string
Data []byte
RawData []byte // undecoded data
Data []byte // decoded data
ContentLength int
Raw string
RawHeaders string
Expand Down
32 changes: 32 additions & 0 deletions examples/example.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"log"

"github.com/projectdiscovery/goflags"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
"github.com/projectdiscovery/httpx/runner"
)

func main() {
gologger.DefaultLogger.SetMaxLevel(levels.LevelVerbose) // increase the verbosity (optional)

options := runner.Options{
Methods: "GET",
InputTargetHost: goflags.StringSlice{"scanme.sh", "projectdiscovery.io"},
//InputFile: "./targetDomains.txt", // path to file containing the target domains list
}

if err := options.ValidateOptions(); err != nil {
log.Fatal(err)
}

httpxRunner, err := runner.New(&options)
if err != nil {
log.Fatal(err)
}
defer httpxRunner.Close()

httpxRunner.RunEnumeration()
}
Loading