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

Adding Screenshot support #1097

Merged
merged 23 commits into from
Apr 26, 2023
Merged

Adding Screenshot support #1097

merged 23 commits into from
Apr 26, 2023

Conversation

Mzack9999
Copy link
Member

@Mzack9999 Mzack9999 commented Apr 16, 2023

Description

This PR adds basic support for headless mode by adding two new flags:

  • -screenshot enables headless mode to take screenshots
  • -system-chrome uses the local installed chrome if any

When the screenshot flag is used, also the rendered dom is retrieved and added to the json output under headless_body. The screenshot image is saved in the store response folder and an index file called index_screenshot.txt is created.

Doc - https://github.com/projectdiscovery/httpx/tree/issue-385-screenshot#screenshot

$ git clone https://github.com/projectdiscovery/httpx.git; cd httpx/cmd/httpx/
$ git checkout issue-385-screenshot
$ go build
$ echo www.projectdiscovery.io | ./httpx -screenshot
    __    __  __       _  __
   / /_  / /_/ /_____ | |/ /
  / __ \/ __/ __/ __ \|   /
 / / / / /_/ /_/ /_/ /   |
/_/ /_/\__/\__/ .___/_/|_|
             /_/

		projectdiscovery.io

[INF] Current httpx version v1.2.9 (latest)
https://www.projectdiscovery.io
tree output/
output/
├── response
│   ├── index.txt
│   └── www.projectdiscovery.io
│       └── 89dbec3c06cdc2f6e4586907775aecb0e2520783.txt
└── screenshot
    ├── index_screenshot.txt
    └── www.projectdiscovery.io
        └── 89dbec3c06cdc2f6e4586907775aecb0e2520783.png

6 directories, 4 files

89dbec3c06cdc2f6e4586907775aecb0e2520783

@Mzack9999 Mzack9999 added the Type: Enhancement Most issues will probably ask for additions or changes. label Apr 16, 2023
@Mzack9999 Mzack9999 self-assigned this Apr 16, 2023
@Mzack9999 Mzack9999 marked this pull request as draft April 16, 2023 22:03
@Mzack9999 Mzack9999 linked an issue Apr 16, 2023 that may be closed by this pull request
@Mzack9999 Mzack9999 marked this pull request as ready for review April 17, 2023 13:11
@Mzack9999 Mzack9999 linked an issue Apr 17, 2023 that may be closed by this pull request
1 task
@Mzack9999
Copy link
Member Author

Mzack9999 commented Apr 18, 2023

Todo:

  • Hanging zombie chromium processes on windows
  • save screenshots in $output/screenshots
  • Use absolute path for json fields referencing files

@Mzack9999 Mzack9999 requested review from ShubhamRasal and ehsandeep and removed request for ehsandeep and ShubhamRasal April 19, 2023 14:55
@Mzack9999 Mzack9999 marked this pull request as draft April 19, 2023 16:22
@Mzack9999
Copy link
Member Author

Mzack9999 commented Apr 19, 2023

  • Leakless is blocked as malicious by windows defender

@Mzack9999 Mzack9999 marked this pull request as ready for review April 19, 2023 20:25
@Mzack9999
Copy link
Member Author

Depends on projectdiscovery/utils#137

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm !

Q: when using -screenshot httpx stores response dump to responses even if -store-response is not used . Is this expected ?

@Mzack9999
Copy link
Member Author

@tarunKoyalwar yeah I thought it could make sense to also store the response, as while taking screenshot we also retrieve the rendered DOM. What do you think @ehsandeep should we keep things separated?

@ehsandeep
Copy link
Member

@tarunKoyalwar yeah I thought it could make sense to also store the response, as while taking screenshot we also retrieve the rendered DOM. What do you think @ehsandeep should we keep things separated?

we can keep the current behavior as it is since the response information can be used to associate with the screenshot information.

@ehsandeep ehsandeep merged commit 00d0977 into dev Apr 26, 2023
@ehsandeep ehsandeep deleted the issue-385-screenshot branch April 26, 2023 19:37
@ulises2k
Copy link

BUG:
image

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add screenshot support Add headless mode
4 participants