How to use the greynoise.cli.formatter.ANSI_MARKUP function in greynoise

To help you get started, we’ve selected a few greynoise 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 GreyNoise-Intelligence / pygreynoise / tests / cli / test_formatter.py View on Github external
{"fingerprint": "", "port": 123456},
        ],
        "scan": [
            {"port": 123456, "protocol": "TCP"},
            {"port": 123456, "protocol": "UDP"},
        ],
        "web": {
            "paths": ["/", "/favicon.ico", "/robots.txt"],
            "useragents": ["", "", ""],
        },
    },
    "seen": True,
    "tags": ["", "", ""],
}

EXAMPLE_IP_CONTEXT_OUTPUT = ANSI_MARKUP.parse(
    textwrap.dedent(
        """\
                  <header>OVERVIEW</header>
        ----------------------------
        Actor: 
        Classification: 
        First seen: 
        IP: 
        Last seen: 
        Tags:
        - 
        - 
        - 

                  <header>METADATA</header>
        ----------------------------
github GreyNoise-Intelligence / pygreynoise / tests / cli / test_formatter.py View on Github external
                ANSI_MARKUP.parse(
                    textwrap.dedent(
                        u"""\
                        ╔═══════════════════════════╗
                        ║ <header>      Query 1 of 1       </header> ║
                        ╚═══════════════════════════╝
                        Query: 

                        ┌───────────────────────────┐
                        │       Result 1 of 1       │
                        └───────────────────────────┘

                        """
                    )
                )
                + EXAMPLE_IP_CONTEXT_OUTPUT,
            ),
github GreyNoise-Intelligence / pygreynoise / src / greynoise / cli / subcommand.py View on Github external
output = [
                context.command.get_usage(context),
                (
                    "Error: at least one text file must be passed "
                    "either through the -i/--input_file option or through a shell pipe."
                ),
            ]
            click.echo("\n\n".join(output))
            context.exit(-1)
        else:
            input_file = click.open_file("-")
    if output_file is None:
        output_file = click.open_file("-", mode="w")

    for chunk in api_client.filter(input_file, noise_only=noise_only):
        output_file.write(ANSI_MARKUP(chunk))