https://github.com/elliotwutingfeng/take_a_shot
Capture screenshot and/or HTML source code data of any given webpage and print it to stdout.
https://github.com/elliotwutingfeng/take_a_shot
chromedriver docker html javascript osint screenshot selenium source-code
Last synced: about 2 months ago
JSON representation
Capture screenshot and/or HTML source code data of any given webpage and print it to stdout.
- Host: GitHub
- URL: https://github.com/elliotwutingfeng/take_a_shot
- Owner: elliotwutingfeng
- License: mit
- Created: 2023-05-29T21:01:11.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2026-02-20T09:00:25.000Z (4 months ago)
- Last Synced: 2026-02-20T12:47:58.740Z (4 months ago)
- Topics: chromedriver, docker, html, javascript, osint, screenshot, selenium, source-code
- Language: Python
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Take A Shot
Capture screenshot and/or HTML source code data of any given webpage and print it to stdout.
Output format: JSON string containing b64-encoded data.
## Implementation details
- Uses Google Chrome in headless mode.
- Works well even with vertically long webpages.
- Webpages with fixed headers generally work well, but fixed footers may lead to unusual results.
Forked and modified from:
## Requirements
Tested on the following environment
### Linux
- Linux 6.12
- Docker Version 28.3.0
## Usage
### Build
```bash
./build
```
Then either run
```bash
./capture [options]
```
or alternatively run
```bash
docker run --cap-drop=all --security-opt=no-new-privileges --rm elliotwutingfeng/take_a_shot [options]
```
## Output Format
```json
{
"screenshot": "",
"source_code": ""
}
```
## Examples
### Default User Agent
```bash
docker run --cap-drop=all --security-opt=no-new-privileges --rm elliotwutingfeng/take_a_shot "https://example.com"
```
### Specify User Agent
```bash
docker run --cap-drop=all --security-opt=no-new-privileges --rm elliotwutingfeng/take_a_shot "https://example.com" --window-size 390x844 --ua 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/113.0 Mobile/15E148 Safari/605.1.15'
```
## Help
```bash
usage: takeashot.py [-h] [--screenshot] [--source-code]
[--window-size WINDOW_SIZE] [--ua USER_AGENT]
[--wait WAIT] [--lang LANG] [--language LANGUAGE] [-v]
[--vv]
url
positional arguments:
url specify URL
options:
-h, --help show this help message and exit
--screenshot Take screenshot
--source-code Extract source code
--window-size WINDOW_SIZE
specify window size like 1200x800
--ua USER_AGENT specify user-agent
--wait WAIT specify wait seconds after scroll down
--lang LANG set LANG environment variable
--language LANGUAGE set LANGUAGE environment variable
-v set LogLevel to INFO
--vv set LogLevel to DEBUG
```
## Credits
[More Information](CREDITS.md)