@@ -28,15 +28,14 @@ Only enabled IP Access Lists are analyzed (and fixed).
2828## Installation
2929
3030* You need to have Python 3.8+ installed
31- * Clone the repository or download current directory
32- * Install dependencies with ` pip install -U -r requirements.txt `
31+ * The code and dependencies are installed as part of the ` databricks labs install sandbox ` command.
3332
3433## Usage
3534
3635To run the tool just execute:
3736
3837``` sh
39- python ip_acl_analyzer.py [options]
38+ databricks labs sandbox ip-access-list-analyzer [options]
4039```
4140
4241Pass ` --help ` command-line flag to obtain built-in help. Specify ` --debug ` option to get detailed log output.
@@ -52,39 +51,16 @@ This tool works in two modes:
5251If you execute following command:
5352
5453``` sh
55- python ip_acl_analyzer.py -- json_file=test.json --debug
54+ databricks labs sandbox ip-access-list-analyzer -- json_file=test.json
5655```
5756
5857Then you will receive following output:
5958
6059```
61- DEBUG:root:Performing only analysis...
62- DEBUG:root:Going to load IP Access Lists from JSON file: test.json
6360INFO:root:There are duplicates in the IP Access lists! len(all_ips)=241, len(uniq_ips)=237
64- DEBUG:root:Processing list 'list1' (0f209622-ca20-455a-bdc4-4de3bed8a1ed)
65- DEBUG:root: Found intersection with list list1 dup
66- DEBUG:root: Modifying current list...
67- DEBUG:root: Removing from list1: ['54.81.134.249', '52.22.161.231', '52.45.144.63']
68- DEBUG:root:Processing list 'list1 dup' (1f209622-ca20-455a-bdc4-4de3bed8a1ed)
69- DEBUG:root: Found intersection with list list2
70- DEBUG:root: Modifying current list...
71- DEBUG:root: 52.55.144.63 is part of 52.55.144.0/24, removing...
72- DEBUG:root: Removing from list1 dup: ['52.55.144.63']
73- DEBUG:root:Processing list 'list2' (1f209623-ca20-455a-bdc4-4de3bed8a1ed)
74- DEBUG:root: We can ignore 10.0.1.0 because it's local or private...
75- DEBUG:root: We can ignore 10.1.2.0/24 because it's local or private...
76- DEBUG:root: We can ignore 192.168.10.11 because it's local or private...
77- DEBUG:root: 52.55.144.63 is part of 52.55.144.0/24, removing...
78- DEBUG:root: Removing from list2: ['192.168.10.11', '10.0.1.0', '10.1.2.0/24', '52.55.144.63']
79- DEBUG:root:Processing list 'github_actions' (d798c5f5-3b53-4dc7-85b7-75dd67056512)
80- DEBUG:root:Skipping not enabled list Disabled list (fc594781-60cb-4b46-b0f7-ee9d951e3c3f)
8161INFO:root:Going to remove list 'list1' (0f209622-ca20-455a-bdc4-4de3bed8a1ed) as it's empty
8262INFO:root:Going to modify list 'list1 dup' (1f209622-ca20-455a-bdc4-4de3bed8a1ed). Entries to remove: ['52.55.144.63']
83- DEBUG:root: from: IpAccessListInfo(address_count=3, created_at=1651523910411, created_by=5381669867036714, enabled=True, ip_addresses=['52.45.144.63', '52.55.144.63', '54.81.134.249', '52.22.161.231'], label='list1 dup', list_id='1f209622-ca20-455a-bdc4-4de3bed8a1ed', list_type=<ListType.ALLOW: 'ALLOW'>, updated_at=1651523910411, updated_by=5381669867036714)
84- DEBUG:root: to : IpAccessListInfo(address_count=3, created_at=None, created_by=None, enabled=True, ip_addresses=['52.45.144.63', '54.81.134.249', '52.22.161.231'], label='list1 dup', list_id='1f209622-ca20-455a-bdc4-4de3bed8a1ed', list_type=<ListType.ALLOW: 'ALLOW'>, updated_at=None, updated_by=None)
85- INFO:root:Going to modify list 'list2' (1f209623-ca20-455a-bdc4-4de3bed8a1ed). Entries to remove: ['192.168.10.11', '10.0.1.0', '10.1.2.0/24', '52.55.144.63']
86- DEBUG:root: from: IpAccessListInfo(address_count=7, created_at=1651523910411, created_by=5381669867036714, enabled=True, ip_addresses=['52.55.144.63', '52.55.144.0/24', '54.91.134.249', '52.12.161.231', '10.0.1.0', '10.1.2.0/24', '192.168.10.11'], label='list2', list_id='1f209623-ca20-455a-bdc4-4de3bed8a1ed', list_type=<ListType.ALLOW: 'ALLOW'>, updated_at=1651523910411, updated_by=5381669867036714)
87- DEBUG:root: to : IpAccessListInfo(address_count=3, created_at=None, created_by=None, enabled=True, ip_addresses=['52.55.144.0/24', '54.91.134.249', '52.12.161.231'], label='list2', list_id='1f209623-ca20-455a-bdc4-4de3bed8a1ed', list_type=<ListType.ALLOW: 'ALLOW'>, updated_at=None, updated_by=None)
63+ INFO:root:Going to modify list 'list2' (1f209623-ca20-455a-bdc4-4de3bed8a1ed). Entries to remove: ['10.1.2.0/24', '192.168.10.11', '52.55.144.63', '10.0.1.0']
8864INFO:root:List 'github_actions' (d798c5f5-3b53-4dc7-85b7-75dd67056512) isn't modified or not enabled
8965INFO:root:List 'Disabled list' (fc594781-60cb-4b46-b0f7-ee9d951e3c3f) isn't modified or not enabled
9066```
0 commit comments