Skip to content

Commit

Permalink
Merge pull request #19 from microsoft/ianhelle/021hotfix-2021-06-29
Browse files Browse the repository at this point in the history
Bug fixes for ipsummary, account summary and host summary
  • Loading branch information
ianhelle authored Jun 29, 2021
2 parents 2b0ca33 + aea7603 commit 1c3c72b
Show file tree
Hide file tree
Showing 8 changed files with 5,929 additions and 4,253 deletions.
8,615 changes: 4,951 additions & 3,664 deletions docs/notebooks/AccountSummary.ipynb

Large diffs are not rendered by default.

1,509 changes: 944 additions & 565 deletions docs/notebooks/IpSummary.ipynb

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions msticnb/nb/azsent/account/account_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,16 @@ def run(
acct_index_df = _create_account_index(all_acct_dfs)
if acct_index_df.empty:
nb_markdown("No accounts matching that name.")
elif len(acct_index_df) == 1:
else:
result.account_selector = _get_account_selector(
qry_prov=self.query_provider,
all_acct_dfs=all_acct_dfs,
result=result,
timespan=timespan,
options=self.options,
geoip=self._geo_lookup,
)
if len(acct_index_df) == 1:
# If a single account - just display directly.
disp_func = _create_display_callback(
qry_prov=self.query_provider,
Expand All @@ -289,14 +298,6 @@ def run(
nb_markdown(
"Multiple matching accounts found, select one to see details.", "large"
)
result.account_selector = _get_account_selector(
qry_prov=self.query_provider,
all_acct_dfs=all_acct_dfs,
result=result,
timespan=timespan,
options=self.options,
geoip=self._geo_lookup,
)
nb_display(result.account_selector)

if not acct_index_df.empty:
Expand Down
12 changes: 6 additions & 6 deletions msticnb/nb/azsent/host/host_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ def _azure_api_details(az_cli, host_record):
]
image = (
str(
resource_details["properties"]["storageProfile"]["imageReference"][
"offer"
]
resource_details["properties"]["storageProfile"]
.get("imageReference", {})
.get("offer", {})
)
+ " "
+ str(
resource_details["properties"]["storageProfile"]["imageReference"][
"sku"
]
resource_details["properties"]["storageProfile"]
.get("imageReference", {})
.get("sku", {})
)
)
# Extract key details and add host_entity
Expand Down
5 changes: 2 additions & 3 deletions msticnb/nblib/iptools.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ def _get_prefix(ip_addr):
def _to_ip4_net(net):
try:
return _get_prefix(net), IPv4Network(net)
except AddressValueError as err:
print(err, type(err))
except AddressValueError:
return None, None


Expand Down Expand Up @@ -158,7 +157,7 @@ def is_in_vps_net(ip_addr: str) -> Optional[IPv4Network]:
return None
if ip_pref in _NET_DICT:
for net in _NET_DICT[ip_pref]:
if ip_addr in net:
if ip4_addr in net:
return net
return None

Expand Down
6 changes: 0 additions & 6 deletions tests/nb/azsent/host/test_hostlogonsummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# license information.
# --------------------------------------------------------------------------
"""Test case for hostslogonsummary nblet."""
import sys
from datetime import datetime
from pathlib import Path

Expand All @@ -21,11 +20,6 @@

# nosec
# pylint: disable=no-member
if not sys.platform.startswith("win"):
pytest.skip(
"skipping Linux and Mac for these tests since Matplotlib fails with no gui",
allow_module_level=True,
)


@pytest.fixture
Expand Down
8 changes: 8 additions & 0 deletions tests/nb/azsent/host/test_win_host_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
# license information.
# --------------------------------------------------------------------------
"""Test the nb_template class."""
import sys
from pathlib import Path

# from contextlib import redirect_stdout
import pytest_check as check

import pandas as pd
import pytest

from msticpy.common.timespan import TimeSpan
from msticnb import nblts
Expand All @@ -20,6 +22,12 @@

# pylint: disable=no-member

if not sys.platform.startswith("win"):
pytest.skip(
"skipping Linux and Mac for these tests since Matplotlib fails with no gui",
allow_module_level=True,
)


def test_winhostevents_notebooklet(monkeypatch):
"""Test basic run of notebooklet."""
Expand Down
8 changes: 8 additions & 0 deletions tests/nb/azsent/network/test_network_flow_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# license information.
# --------------------------------------------------------------------------
"""Test the nb_template class."""
import sys
from pathlib import Path

# from contextlib import redirect_stdout
import pytest_check as check

from bokeh.models import LayoutDOM
import pandas as pd
import pytest

from msticpy.common.timespan import TimeSpan
from msticnb import nblts
Expand All @@ -26,6 +28,12 @@

# pylint: disable=no-member

if not sys.platform.startswith("win"):
pytest.skip(
"skipping Linux and Mac for these tests since Matplotlib fails with no gui",
allow_module_level=True,
)


def test_network_flow_summary_notebooklet(monkeypatch):
"""Test basic run of notebooklet."""
Expand Down

0 comments on commit 1c3c72b

Please sign in to comment.