-
Notifications
You must be signed in to change notification settings - Fork 842
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
Add flag to preview first N characters #1316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the html tags from response body and only print actual content in the same line, for example:
go run . -u https://example.com -silent -bp=30
https://example.com [Example Dom]
✗ go run . -u https://example.com -bp -strip
__ __ __ _ __
/ /_ / /_/ /_____ | |/ /
/ __ \/ __/ __/ __ \| /
/ / / / /_/ /_/ /_/ / |
/_/ /_/\__/\__/ .___/_/|_|
/_/
projectdiscovery.io
[INF] Current httpx version v1.3.4 (latest)
https://example.com [ Example Domain body { background-color: #f0f0f2; margin: 0; padding: 0; font-family: -apple-system,] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The body should be printed within
... [ body preview ] ...
(maybe we should consider-strip newline,html
as default) just like-title
- Consider using https://github.com/microcosm-cc/bluemonday for specific html sanitisation (there should be already an instance at
Line 35 in 33709e6
htmlPolicy *bluemonday.Policy - Update readme/docs
- Consider adding the new flags to functional tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
$ echo https://example.com | go run . -bp
...
https://example.com [<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset="utf-8" />\n <meta]
$ echo https://example.com | go run . -bp -strip
...
https://example.com [ Example Domain This domain is for use in illustrative examples in documents. You may use this domai]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLI
$ echo https://www.hackerone.com | ./httpx -silent -bp
https://www.hackerone.com [Skip to main content 6th Edition of the Hacker Powered Security Report is available for downloadGe]
JSON
$ echo https://www.hackerone.com | ./httpx -silent -bp -json | jq -r .body_preview
Skip to main content 6th Edition of the Hacker Powered Security Report is available for downloadGe
@RamanaReddy0M 😊 This is useful for batch detection of specific vulnerabilities Of course, regarding the capture of body |
closes #935
test cmd's
NOTE: Used dyanmic var to achieve this: projectdiscovery/goflags#130