Skip to content

Commit c713fa2

Browse files
cmcnally-r7Dympna Laverty
authored and
Dympna Laverty
committed
Greynoise unit test fix (#2983)
* Fix unit tests * Update SDK * Fix final unit test * Last unit tests fix hopefully
1 parent 6f839b7 commit c713fa2

15 files changed

+165
-174
lines changed

plugins/greynoise/.CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"spec": "e8f3a3060f1800fcad0ffc216c09d193",
2+
"spec": "408dee8094333da675fded694bdef341",
33
"manifest": "9d3f4a959fda3eb80588c86648597b40",
44
"setup": "7d0148b4efc7745f17003a77e9e73c55",
55
"schemas": [

plugins/greynoise/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.2.0
1+
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.2.2
22

33
LABEL organization=greynoise
44
LABEL sdk=python

plugins/greynoise/plugin.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ connection_version: 2
99
cloud_ready: false
1010
sdk:
1111
type: slim
12-
version: 6.2.0
12+
version: 6.2.2
1313
user: nobody
1414
supported_versions: ["GreyNoise API v1/2/3"]
1515
vendor: greynoise

plugins/greynoise/unit_test/payloads/__init__.py

Whitespace-only changes.
Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
[
2-
{
3-
"ip": {
4-
"actor": "Acme Inc",
1+
{
2+
"ip": {
3+
"actor": "Acme Inc",
4+
"asn": "AS12345",
5+
"city": "Berlin",
6+
"classification": "benign",
7+
"country": "Germany",
8+
"country_code": "DE",
9+
"first_seen": "2019-07-29",
10+
"ip": "1.2.3.4",
11+
"last_seen": "2024-11-04",
12+
"organization": "Acme Inc"
13+
},
14+
"similar_ips": [
15+
{
16+
"actor": "Alpha Strike Labs",
517
"asn": "AS12345",
618
"city": "Berlin",
719
"classification": "benign",
820
"country": "Germany",
921
"country_code": "DE",
10-
"first_seen": "2019-07-29",
11-
"ip": "1.2.3.4",
22+
"features": [
23+
"hassh_fp",
24+
"mass_scan_bool",
25+
"os",
26+
"ports",
27+
"useragents",
28+
"web_paths"
29+
],
30+
"first_seen": "2019-07-11",
31+
"ip": "2.3.4.5",
1232
"last_seen": "2024-11-04",
13-
"organization": "Acme Inc"
14-
},
15-
"similar_ips": [
16-
{
17-
"actor": "Alpha Strike Labs",
18-
"asn": "AS12345",
19-
"city": "Berlin",
20-
"classification": "benign",
21-
"country": "Germany",
22-
"country_code": "DE",
23-
"features": [
24-
"hassh_fp",
25-
"mass_scan_bool",
26-
"os",
27-
"ports",
28-
"useragents",
29-
"web_paths"
30-
],
31-
"first_seen": "2019-07-11",
32-
"ip": "2.3.4.5",
33-
"last_seen": "2024-11-04",
34-
"organization": "Acme Inc",
35-
"score": 0.98933446
36-
}
37-
],
38-
"total": 1
39-
}
40-
]
33+
"organization": "Acme Inc",
34+
"score": 0.98933446
35+
}
36+
],
37+
"total": 1
38+
}
Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,58 @@
1-
[
2-
{
3-
"activity": [
4-
{
5-
"asn": "AS12345",
6-
"category": "hosting",
7-
"city": "Berlin",
8-
"classification": "benign",
9-
"country": "Germany",
10-
"country_code": "DE",
11-
"destinations": [
12-
{
13-
"country": "South Africa",
14-
"country_code": "ZA"
15-
}
16-
],
17-
"hassh_fingerprints": [],
18-
"http_paths": [
19-
"/favicon.ico"
20-
],
21-
"http_user_agents": [
22-
"Mozilla/5.0"
23-
],
24-
"ja3_fingerprints": [
25-
"04b3f524166caafd433b6864250945be"
26-
],
27-
"organization": "Alpha Strike Labs GmbH",
28-
"protocols": [
29-
{
30-
"port": 80,
31-
"transport_protocol": "TCP"
32-
}
33-
],
34-
"rdns": "",
35-
"region": "Berlin",
36-
"spoofable": true,
37-
"tags": [
38-
{
39-
"category": "actor",
40-
"description": "description.",
41-
"intention": "benign",
42-
"name": "Acme, Inc."
43-
}
44-
],
45-
"timestamp": "2024-11-03T00:00:00Z",
46-
"tor": false,
47-
"vpn": false,
48-
"vpn_service": ""
49-
}
50-
],
51-
"ip": "1.2.3.4",
52-
"metadata": {
53-
"end_time": "2024-11-04T19:13:35.892189739Z",
54-
"ip": "1.2.3.4",
55-
"limit": 50,
56-
"next_cursor": "",
57-
"start_time": "2024-11-03T00:00:00Z"
1+
{
2+
"activity": [
3+
{
4+
"asn": "AS12345",
5+
"category": "hosting",
6+
"city": "Berlin",
7+
"classification": "benign",
8+
"country": "Germany",
9+
"country_code": "DE",
10+
"destinations": [
11+
{
12+
"country": "South Africa",
13+
"country_code": "ZA"
14+
}
15+
],
16+
"hassh_fingerprints": [],
17+
"http_paths": [
18+
"/favicon.ico"
19+
],
20+
"http_user_agents": [
21+
"Mozilla/5.0"
22+
],
23+
"ja3_fingerprints": [
24+
"04b3f524166caafd433b6864250945be"
25+
],
26+
"organization": "Alpha Strike Labs GmbH",
27+
"protocols": [
28+
{
29+
"port": 80,
30+
"transport_protocol": "TCP"
31+
}
32+
],
33+
"rdns": "",
34+
"region": "Berlin",
35+
"spoofable": true,
36+
"tags": [
37+
{
38+
"category": "actor",
39+
"description": "description.",
40+
"intention": "benign",
41+
"name": "Acme, Inc."
42+
}
43+
],
44+
"timestamp": "2024-11-03T00:00:00Z",
45+
"tor": false,
46+
"vpn": false,
47+
"vpn_service": ""
5848
}
49+
],
50+
"ip": "1.2.3.4",
51+
"metadata": {
52+
"end_time": "2024-11-04T19:13:35.892189739Z",
53+
"ip": "1.2.3.4",
54+
"limit": 50,
55+
"next_cursor": "",
56+
"start_time": "2024-11-03T00:00:00Z"
5957
}
60-
]
58+
}

plugins/greynoise/unit_test/test_community_lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.community_lookup import CommunityLookup
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestCommunityLookup(TestCase):

plugins/greynoise/unit_test/test_context_lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.context_lookup import ContextLookup
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestContextLookup(TestCase):

plugins/greynoise/unit_test/test_get_tag_details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.get_tag_details import GetTagDetails
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestGetTagDetails(TestCase):

plugins/greynoise/unit_test/test_gnql_query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.gnql_query import GnqlQuery
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestGnqlQuery(TestCase):
@@ -61,7 +61,6 @@ def test_gnql_query(self, mock_get):
6161
],
6262
"message": "ok",
6363
"query": "query",
64-
"scroll": "token",
6564
}
6665

6766
self.assertNotEqual({}, results, "returns non - empty results")

plugins/greynoise/unit_test/test_quick_lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.quick_lookup import QuickLookup
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestQuickLookup(TestCase):

plugins/greynoise/unit_test/test_riot_lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.riot_lookup import RiotLookup
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestRiotLookup(TestCase):

plugins/greynoise/unit_test/test_similar_lookup.py

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from icon_greynoise.actions.similar_lookup import SimilarLookup
55

6-
from unit_test.util import MockConnection, mocked_requests_get
6+
from util import MockConnection, mocked_requests_get
77

88

99
class TestSimilarLookup(TestCase):
@@ -16,39 +16,37 @@ def test_similar_lookup(self, mock_get):
1616

1717
working_params = {"ip_address": "similar_lookup"}
1818
results = test_similar.run(working_params)
19-
expected = [
20-
{
21-
"ip": {
22-
"actor": "Acme Inc",
19+
expected = {
20+
"ip": {
21+
"actor": "Acme Inc",
22+
"asn": "AS12345",
23+
"city": "Berlin",
24+
"classification": "benign",
25+
"country": "Germany",
26+
"country_code": "DE",
27+
"first_seen": "2019-07-29",
28+
"ip": "1.2.3.4",
29+
"last_seen": "2024-11-04",
30+
"organization": "Acme Inc",
31+
},
32+
"similar_ips": [
33+
{
34+
"actor": "Alpha Strike Labs",
2335
"asn": "AS12345",
2436
"city": "Berlin",
2537
"classification": "benign",
2638
"country": "Germany",
2739
"country_code": "DE",
28-
"first_seen": "2019-07-29",
29-
"ip": "1.2.3.4",
40+
"features": ["hassh_fp", "mass_scan_bool", "os", "ports", "useragents", "web_paths"],
41+
"first_seen": "2019-07-11",
42+
"ip": "2.3.4.5",
3043
"last_seen": "2024-11-04",
3144
"organization": "Acme Inc",
32-
},
33-
"similar_ips": [
34-
{
35-
"actor": "Alpha Strike Labs",
36-
"asn": "AS12345",
37-
"city": "Berlin",
38-
"classification": "benign",
39-
"country": "Germany",
40-
"country_code": "DE",
41-
"features": ["hassh_fp", "mass_scan_bool", "os", "ports", "useragents", "web_paths"],
42-
"first_seen": "2019-07-11",
43-
"ip": "2.3.4.5",
44-
"last_seen": "2024-11-04",
45-
"organization": "Acme Inc",
46-
"score": 0.98933446,
47-
}
48-
],
49-
"total": 1,
50-
}
51-
]
45+
"score": 0.98933446,
46+
}
47+
],
48+
"total": 1,
49+
}
5250

5351
self.assertNotEqual({}, results, "returns non - empty results")
5452
self.assertEqual(expected, results)

0 commit comments

Comments
 (0)