Details
| ID | Screenshot Machine |
|---|---|
| Provider | Devtica |
| Category | Utilities |
| From Version | 6.0.0 |
| Docker Image | demisto/python3:3.12.8.3296088 |
| Supported Modules | Agentix XSIAM |
README
Uses screenshot machine to get a screenshot
Configure Screenshot Machine in Cortex
| Parameter | Required |
|---|---|
| Api Key | True |
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
screenshot
Retrieve screenshot
Base Command
screenshot-machine-get-screenshot
Input
| Argument Name | Description | Required |
|---|---|---|
| url | URL to screenshot. | Required |
| device | Capture as desktop, mobile, tablet. Possible values are: desktop, mobile, tablet. Default is desktop. | Optional |
| dimension | Dimensions to capture. Possible values are: 320x240, 800x600, 1024x768, 1920x1020, 1240xfull. Default is 1024xfull. | Optional |
| cacheLimit | Allows cached images (up to max lifetime of 1 day). Possible values are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14. Default is 1. | Optional |
| delay | Delay before capturing image. Possible values are: 200, 400, 600, 800, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000. Default is 200. | Optional |
| md5Secret | leave secret phrase empty, if not needed. | Optional |
Context Output
There is no context output for this command.
Command Example
``````
Human Readable Output
Configuration parameters
apikey— Api Key (required)
Commands (1)
-
screenshot-machine-get-screenshotRetrieve screenshot
import hashlib import traceback from io import BytesIO import demistomock as demisto # noqa: F401 import requests from CommonServerPython import * # noqa: F401 API_KEY = demisto.params().get("apikey") def site_lookup(params): api_url = "http://api.screenshotmachine.com" r = requests.get(api_url, params=params, allow_redirects=True) if r.status_code < 200 or r.status_code >= 300: return_error(f"Failed to update Content.\nURL: {api_url}, Status Code: {r.status_code}, Response: {r.text}") return r def decode_screenshot(r): i = BytesIO(r.content) res = fileResult("myfile", i.read(), file_type=EntryType.IMAGE) return res def generateHash(url, secretKey): string_to_hash = url + secretKey return hashlib.md5(string_to_hash.encode("utf-8")).hexdigest() # nosec def get_screenshot(argDict): md5Secret = argDict.get("md5Secret", "") url = argDict.get("url") md5Hash = generateHash(url, md5Secret) params = { "url": url, "key": API_KEY, "dimension": argDict.get("dimension"), "device": argDict.get("device"), "format": "jpg", "hash": md5Hash, "cacheLimit": argDict.get("cacheLimit"), "delay": argDict.get("delay"), } screenshot = site_lookup(params) return screenshot def main(): try: if demisto.command() == "test-module": argDict = demisto.args() argDict["url"] = "https://paloaltonetworks.com" get_screenshot(argDict) demisto.results("ok") elif demisto.command() == "screenshot-machine-get-screenshot": argDict = demisto.args() raw_screenshot = get_screenshot(argDict) screenshot = decode_screenshot(raw_screenshot) demisto.results(screenshot) else: return_error("Command not found.") except Exception as e: demisto.error(traceback.format_exc()) # print the traceback return_error(f"Failed to execute {demisto.command()} command.\nError:\n{e!s}") if __name__ in ["__main__", "__builtin__", "builtins"]: main()