How to use the urlscan.komand_urlscan.actions.submit_url_for_scan.schema.Input function in urlscan

To help you get started, we’ve selected a few urlscan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rapid7 / insightconnect-plugins / urlscan / komand_urlscan / actions / submit_url_for_scan / action.py View on Github external
def run(self, params=None):
        if params is None:
            params = {}
        body = {'url': params[Input.URL]}
        if params[Input.PUBLIC]:
            body['public'] = 'on'

        response = requests.post(f'{self.connection.server}/scan', headers=self.connection.headers, data=body)

        try:
            out = response.json()
        except json.decoder.JSONDecodeError:
            raise PluginException(cause="Received an unexpected response from the Urlscan API. ",
                                  assistance=f"(non-JSON or no response was received). Response was: {response.text}")

        if 'uuid' in out:
            return {Output.SCAN_ID: out['uuid']}

        if 'status' in out:
            if out['status'] == 401:
github rapid7 / insightconnect-plugins / urlscan / komand_urlscan / actions / submit_url_for_scan / action.py View on Github external
def run(self, params=None):
        if params is None:
            params = {}
        body = {'url': params[Input.URL]}
        if params[Input.PUBLIC]:
            body['public'] = 'on'

        response = requests.post(f'{self.connection.server}/scan', headers=self.connection.headers, data=body)

        try:
            out = response.json()
        except json.decoder.JSONDecodeError:
            raise PluginException(cause="Received an unexpected response from the Urlscan API. ",
                                  assistance=f"(non-JSON or no response was received). Response was: {response.text}")

        if 'uuid' in out:
            return {Output.SCAN_ID: out['uuid']}

        if 'status' in out:
            if out['status'] == 401:
                # {'message': "No API key supplied. Send the key using the 'API-Key' header", 'status': 401}