From 04544f347f46db95165e48f40eda2d52835e6b17 Mon Sep 17 00:00:00 2001 From: Brad Chiappetta <38439955+bradchiappetta@users.noreply.github.com> Date: Thu, 9 Jun 2022 15:14:30 -0400 Subject: [PATCH] v1.2.1 Updates (#626) --- .bumpversion.cfg | 2 +- CHANGELOG.rst | 22 +++++++++++++++++++ README.rst | 1 - docs/source/conf.py | 2 +- requirements/common.txt | 10 ++++----- setup.py | 2 +- src/greynoise/__version__.py | 2 +- src/greynoise/cli/subcommand.py | 5 ----- .../cli/templates/ip_context_result.txt.j2 | 10 +++++++++ .../templates/ip_context_result_query.txt.j2 | 8 +++++++ tests/cli/test_formatter.py | 17 ++++++++++---- tests/cli/test_subcommand.py | 15 ------------- 12 files changed, 62 insertions(+), 34 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index dae31810..cd27e0e9 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.2.0 +current_version = 1.2.1 tag = False commit = False diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6c44bb2f..73b73ca0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,27 @@ Changelog ========= +Version `1.2.1`_ +================ +**Date**: June 03, 2022 + +* API client: + + * None + +* CLI: + + * Add missing HASSH values to output for IP and QUERY commands + * Remove unused PCAP command + +* Dependencies: + + * Update jinja to 3.1.0 + * Update dict2xml to 1.7.1 + * Update Click to 8.1.2 + * Update more-itertools to 8.13.0 + * Update cachetools to 5.2.0 + Version `1.2.0`_ ================ **Date**: September 03, 2021 @@ -265,3 +286,4 @@ Version `0.2.0`_ .. _`1.0.0`: https://github.com/GreyNoise-Intelligence/pygreynoise/compare/v0.9.1...1.0.0 .. _`1.1.0`: https://github.com/GreyNoise-Intelligence/pygreynoise/compare/v1.0.0...1.1.0 .. _`1.2.0`: https://github.com/GreyNoise-Intelligence/pygreynoise/compare/v1.1.0...1.2.0 +.. _`1.2.1`: https://github.com/GreyNoise-Intelligence/pygreynoise/compare/v1.2.0...1.2.1 diff --git a/README.rst b/README.rst index 56132fe0..ddfe3d84 100644 --- a/README.rst +++ b/README.rst @@ -85,7 +85,6 @@ Usage help Show this message and exit. interesting Report an IP as "interesting". ip Query GreyNoise for all information on a given IP. - pcap Get PCAP for a given IP address. quick Quickly check whether or not one or many IPs are "noise". repl Start an interactive shell. setup Configure API key. diff --git a/docs/source/conf.py b/docs/source/conf.py index 71ba2ee3..a0139514 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,7 +25,7 @@ author = "GreyNoise Intelligence" # The full version, including alpha/beta/rc tags -release = "1.2.0" +release = "1.2.1" # -- General configuration --------------------------------------------------- diff --git a/requirements/common.txt b/requirements/common.txt index d314fc0d..6f79c747 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -1,14 +1,14 @@ -Click==8.0.3 +Click==8.1.2 ansimarkup==1.4.0 -cachetools==5.0.0;python_version>='3' +cachetools==5.2.0;python_version>='3' colorama==0.4.4 click-default-group==1.2.2 click-repl==0.2.0 -dict2xml==1.7.0;python_version>='3' +dict2xml==1.7.1;python_version>='3' ipaddress==1.0.23 jinja2==2.11.3;python_version=='3.5' # pyup: ignore -jinja2==3.0.3;python_version>='3.6' -more-itertools==8.12.0;python_version>='3' +jinja2==3.1.0;python_version>='3.6' +more-itertools==8.13.0;python_version>='3' requests==2.27.1 six==1.16.0 structlog==20.1.0;python_version=='3.5' # pyup: ignore diff --git a/setup.py b/setup.py index 5ad0667b..3e00c3ca 100755 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ def read(fname): setup( name="greynoise", - version="1.2.0", + version="1.2.1", description="Abstraction to interact with GreyNoise API.", url="https://greynoise.io/", author="GreyNoise Intelligence", diff --git a/src/greynoise/__version__.py b/src/greynoise/__version__.py index 4467612f..1bab6433 100644 --- a/src/greynoise/__version__.py +++ b/src/greynoise/__version__.py @@ -5,4 +5,4 @@ __maintainer__ = "GreyNoise Intelligence" __email__ = "hello@greynoise.io" __status__ = "BETA" -__version__ = "1.2.0" +__version__ = "1.2.1" diff --git a/src/greynoise/cli/subcommand.py b/src/greynoise/cli/subcommand.py index 703406d2..4cd36471 100644 --- a/src/greynoise/cli/subcommand.py +++ b/src/greynoise/cli/subcommand.py @@ -180,11 +180,6 @@ def riot( return results -@not_implemented_command -def pcap(): - """Get PCAP for a given IP address.""" - - @gnql_command def query( context, diff --git a/src/greynoise/cli/templates/ip_context_result.txt.j2 b/src/greynoise/cli/templates/ip_context_result.txt.j2 index b8dec4c3..57ab49c7 100644 --- a/src/greynoise/cli/templates/ip_context_result.txt.j2 +++ b/src/greynoise/cli/templates/ip_context_result.txt.j2 @@ -64,8 +64,18 @@ - Port: {{ ja3.port }}, Fingerprint: {{ ja3.fingerprint }} {% endcall -%} {% endif %} + +{%- if ip_context.raw_data.hassh %} +[HASSH] +{%- call(hassh) macros.verbose_list(ip_context.raw_data.hassh) -%} +- Port: {{ hassh.port }}, Fingerprint: {{ hassh.fingerprint }} +{% endcall -%} +{% endif %} + {%- elif ip_context.error %} {{ ip_context.error }} {% else %} {{ ip_context.ip }} has not been seen in scans in the past 90 days. {% endif %} + + diff --git a/src/greynoise/cli/templates/ip_context_result_query.txt.j2 b/src/greynoise/cli/templates/ip_context_result_query.txt.j2 index f2049bbf..d01745dc 100644 --- a/src/greynoise/cli/templates/ip_context_result_query.txt.j2 +++ b/src/greynoise/cli/templates/ip_context_result_query.txt.j2 @@ -61,6 +61,14 @@ - Port: {{ ja3.port }}, Fingerprint: {{ ja3.fingerprint }} {% endcall -%} {% endif %} + +{%- if ip_context.raw_data.hassh %} +[HASSH] +{%- call(hassh) macros.verbose_list(ip_context.raw_data.hassh) -%} +- Port: {{ hassh.port }}, Fingerprint: {{ hassh.fingerprint }} +{% endcall -%} +{% endif %} + {%- elif ip_context.error %} {{ ip_context.error }} {% else %} diff --git a/tests/cli/test_formatter.py b/tests/cli/test_formatter.py index fbbf92d1..bd0e963d 100644 --- a/tests/cli/test_formatter.py +++ b/tests/cli/test_formatter.py @@ -38,9 +38,9 @@ }, "raw_data": { "hassh": [ - {"hassh": "", "port": 123456}, - {"hassh": "", "port": 123456}, - {"hassh": "", "port": 123456}, + {"fingerprint": "", "port": 123456}, + {"fingerprint": "", "port": 123456}, + {"fingerprint": "", "port": 123456}, ], "ja3": [ {"fingerprint": "", "port": 123456}, @@ -116,7 +116,12 @@ [JA3] - Port: 123456, Fingerprint: - Port: 123456, Fingerprint: - - Port: 123456, Fingerprint: """ # noqa + - Port: 123456, Fingerprint: + + [HASSH] + - Port: 123456, Fingerprint: + - Port: 123456, Fingerprint: + - Port: 123456, Fingerprint: """ # noqa ) ) @@ -177,6 +182,8 @@ class TestIPContextFormatter(object): """ + + ╔═══════════════════════════╗ ║
Context 2 of 3
║ ╚═══════════════════════════╝ @@ -185,6 +192,8 @@ class TestIPContextFormatter(object): commonly spoofed ip + + ╔═══════════════════════════╗ ║
Context 3 of 3
║ ╚═══════════════════════════╝ diff --git a/tests/cli/test_subcommand.py b/tests/cli/test_subcommand.py index bc041a87..f6512a33 100644 --- a/tests/cli/test_subcommand.py +++ b/tests/cli/test_subcommand.py @@ -635,21 +635,6 @@ def test_api_key_not_found(self): assert "Error: API key not found" in result.output -class TestPCAP(object): - """PCAP subcommand test cases.""" - - def test_not_implemented(self, api_client): - """Not implemented error message returned.""" - runner = CliRunner() - expected_output = "Error: 'pcap' subcommand is not implemented yet.\n" - - api_client.not_implemented.side_effect = RequestFailure(501) - result = runner.invoke(subcommand.pcap) - api_client.not_implemented.assert_called_with("pcap") - assert result.exit_code == 1 - assert result.output == expected_output - - class TestQuery(object): """Query subcommand tests."""