Skip to content

Commit 6cce39a

Browse files
authored
Type annotations, linting, unit tests (#5)
* Adding consistent type annotations to most places Fixing linting warnings. Added observationlist module Adding unittests test_event_cluster, test_observationlist, test_security_event + test data Miscellaneous small fixes and improvements. * Some more linting and MyPy warnings * Discovered wrong URL in setup.py * Fixing some pyroma warnings about the packaging.
1 parent 1cf41df commit 6cce39a

33 files changed

+3141
-1326
lines changed

README.md

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The following types are built-in:
6464
- Hashes (MD5, SHA1, SHA256)
6565
- Windows file paths
6666
- Linux file paths (this is kind of noisy because a legal linux file path can have almost any character)
67+
6768
You can modify or add to the regular expressions used at runtime.
6869

6970
Output is a dictionary of matches (for single string input) or a DataFrame (for dataframe input).
@@ -92,6 +93,7 @@ This module has two classes for different services:
9293

9394
- GeoLiteLookup - Maxmind Geolite (see <https://www.maxmind.com>)
9495
- IPStackLookup - IPStack (see <https://ipstack.com>)
96+
9597
Both services offer a free tier for non-commercial use. However,
9698
a paid tier will normally get you more accuracy, more detail and
9799
a higher throughput rate. Maxmind geolite uses a downloadable database,
@@ -109,7 +111,10 @@ items.
109111
The module contains functions to generate clusterable features from
110112
string data. For example, an administration command that
111113
does some maintenance on thousands of servers with a commandline such as:<br>
112-
```install-update -hostname {host.fqdn} -tmp:/tmp/{GUID}/rollback```<br>
114+
```
115+
install-update -hostname {host.fqdn} -tmp:/tmp/{GUID}/rollback
116+
```
117+
113118
can be collapsed into a single cluster pattern by ignoring the character values
114119
in the string and using delimiters or tokens to group the values.
115120

@@ -135,14 +140,9 @@ This is a collection of display and utility modules
135140
designed to make working with security data in Jupyter notebooks
136141
quicker and easier.
137142

138-
- nbwidgets - groups common functionality such as list pickers,
139-
time boundary settings, saving and retrieving
140-
environment variables into a single line callable command.
141-
- nbdisplay - functions that implement common display of things like
142-
alerts, events in a slightly more consumable way than print()
143-
- entityschema - implements entity classes (e.g. Host, Account, IPAddress)
144-
used in Log Analytics alerts and in many of these modules.
145-
Each entity encaspulates one or more properties related to the entity.
143+
- nbwidgets - groups common functionality such as list pickers, time boundary settings, saving and retrieving environment variables into a single line callable command.
144+
- nbdisplay - functions that implement common display of things like alerts, events in a slightly more consumable way than print()
145+
- entityschema - implements entity classes (e.g. Host, Account, IPAddress) used in Log Analytics alerts and in many of these modules. Each entity encaspulates one or more properties related to the entity.
146146

147147
[Notebooks Tools](./doc/NotebookWidgets.ipynb)
148148

@@ -151,14 +151,8 @@ Each entity encaspulates one or more properties related to the entity.
151151
These components are currently still part of the nbtools sub-package but will be
152152
refactored to separate them into their own package.
153153

154-
- query manager - collection of modules that implement common
155-
kql/Log Analytics queries using KqlMagic
156-
- security_alert and security_event - encapsulation classes for alerts
157-
and events. Each has a standard 'entities' property reflecting the
158-
entities found in the alert or event. These can also be used as
159-
meta-parameters for many of the queries. For example the query:
160-
```qry.list_host_logons(provs==[query_times, alert])``` will extract the
161-
value for the ```hostname``` query parameter from the alert.
154+
- query manager - collection of modules that implement common kql/Log Analytics queries using KqlMagic
155+
- security_alert and security_event - encapsulation classes for alerts and events. Each has a standard 'entities' property reflecting the entities found in the alert or event. These can also be used as meta-parameters for many of the queries. For example the query: `qry.list_host_logons(provs==[query_times, alert])` will extract the value for the `hostname` query parameter from the alert.
162156

163157
---
164158

@@ -171,14 +165,10 @@ Requires sign-in to Azure Notebooks
171165

172166
See the following notebooks for more examples of the use of this package in practice:
173167

174-
- Windows Alert Investigation in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Investigation%20-%20Process-Alerts.ipynb)
175-
or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Investigation%20-%20Process-Alerts.ipynb)
176-
- Windows Host Explorer in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Windows-Host-Explorer.ipynb)
177-
or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Windows-Host-Explorer.ipynb)
178-
- Office 365 Exploration in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Office365-Exploring.ipynb)
179-
or [NbViewer](https://nbviewer.jupyter.org/github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Office365-Exploring.ipynb)
180-
- Cross-Network Hunting in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Linux-Windows-Office.ipynb)
181-
or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Linux-Windows-Office.ipynb)
168+
- Windows Alert Investigation in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Investigation%20-%20Process-Alerts.ipynb) or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Investigation%20-%20Process-Alerts.ipynb)
169+
- Windows Host Explorer in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Windows-Host-Explorer.ipynb) or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Windows-Host-Explorer.ipynb)
170+
- Office 365 Exploration in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Office365-Exploring.ipynb) or [NbViewer](https://nbviewer.jupyter.org/github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Office365-Exploring.ipynb)
171+
- Cross-Network Hunting in [github](https://github.com/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Linux-Windows-Office.ipynb) or [NbViewer](https://nbviewer.jupyter.org/github/Azure/Azure-Sentinel/blob/master/Notebooks/Sample-Notebooks/Example%20-%20Guided%20Hunting%20-%20Linux-Windows-Office.ipynb)
182172

183173
## To-Do Items
184174

@@ -190,10 +180,8 @@ See the following notebooks for more examples of the use of this package in prac
190180

191181
- msticpy is OS-independent
192182
- Requires Python 3.6 or later
193-
- Requires the following python packages: pandas, bokeh, matplotlib, seaborn, setuptools, urllib3,
194-
ipywidgets, numpy, attrs, requests, networkx, ipython, scikit_learn, typing
195-
- The following packages are recommended and needed for some specific functionality: Kqlmagic, maxminddb_geolite2,
196-
folium, dnspython, ipwhois
183+
- Requires the following python packages: pandas, bokeh, matplotlib, seaborn, setuptools, urllib3, ipywidgets, numpy, attrs, requests, networkx, ipython, scikit_learn, typing
184+
- The following packages are recommended and needed for some specific functionality: Kqlmagic, maxminddb_geolite2, folium, dnspython, ipwhois
197185

198186
See [requirements.txt](requirements.txt) for more details and version requirements.
199187

msticpy/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Version file."""
2-
VERSION = "0.1.04"
2+
VERSION = "0.1.5"

0 commit comments

Comments
 (0)