From cd6d14ac954e115e43788ed500e3c05127b01146 Mon Sep 17 00:00:00 2001 From: Adon Metcalfe Date: Thu, 22 Feb 2024 03:11:43 +0000 Subject: [PATCH] release --- CHANGELOG.md | 9 +++++++++ README.md | 19 ++++++++++++------- install.sh | 1 + nbdev_squ/api.py | 1 + nbs/01_api.ipynb | 1 + nbs/index.ipynb | 4 +++- nbs/sidebar.yml | 3 +-- 7 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d72326c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release notes + + + +## 1.3.0 + +Updated to include api clients and msticpy. Also adjusted build env to use python 3.11 + + diff --git a/README.md b/README.md index 667a300..00cef58 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # SIEM Query Utils + ## Install ``` sh -pip install https://github.com/wagov/nbdev-squ/archive/refs/heads/main.tar.gz +pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.0.tar.gz ``` ## How to use -*** Note: If you create/use a Github Codespace on any of the wagov repos, SQU_CONFIG should be configured automatically. *** +*Note: If you create/use a Github Codespace on any of the wagov repos, +SQU_CONFIG should be configured automatically.* Before using, config needs to be loaded into `squ.core.cache`, which can be done automatically from json in a keyvault by setting the env var @@ -21,7 +23,7 @@ export SQU_CONFIG="{{ keyvault }}/{{ tenantid }}" ``` ``` python -from nbdev_squ import api, clients +from nbdev_squ import api import io, pandas # Load workspace info from datalake blob storage @@ -46,14 +48,17 @@ print(len(api.azcli(["account", "list"]))) # Various pre-configured api clients # RunZero -#response = clients.runzero.get("/export/org/assets.csv", params={"search": "has_public:t AND alive:t AND (protocol:rdp OR protocol:vnc OR protocol:teamviewer OR protocol:telnet OR protocol:ftp)"}) -#runzero_assets = pandas.read_csv(io.StringIO(response.text)) +response = api.clients.runzero.get("/export/org/assets.csv", params={"search": "has_public:t AND alive:t AND (protocol:rdp OR protocol:vnc OR protocol:teamviewer OR protocol:telnet OR protocol:ftp)"}) +pandas.read_csv(io.StringIO(response.text)).head(10) # Jira -#issues = clients.jira.jql("updated > -1d")["issues"] +pandas.json_normalize(api.clients.jira.jql("updated > -1d")["issues"]).head(10) # AbuseIPDB -#clients.abuseipdb.check_ip("1.1.1.1") +api.clients.abuseipdb.check_ip("1.1.1.1") + +# TenableIO +pandas.DataFrame(api.clients.tio.scans.list()).head(10) ``` ``` python diff --git a/install.sh b/install.sh index 76b3809..4286841 100755 --- a/install.sh +++ b/install.sh @@ -5,5 +5,6 @@ npm install npm run build nbdev_clean nbdev_export +nbdev_readme nbdev_install_hooks diff --git a/nbdev_squ/api.py b/nbdev_squ/api.py index 58ad5c6..5bbcabe 100644 --- a/nbdev_squ/api.py +++ b/nbdev_squ/api.py @@ -28,6 +28,7 @@ class Clients: """ @cached_property def config(self): + login() return cache.get("config", load_config()) @cached_property diff --git a/nbs/01_api.ipynb b/nbs/01_api.ipynb index cd6d92a..ed29059 100644 --- a/nbs/01_api.ipynb +++ b/nbs/01_api.ipynb @@ -89,6 +89,7 @@ " \"\"\"\n", " @cached_property\n", " def config(self):\n", + " login()\n", " return cache.get(\"config\", load_config())\n", "\n", " @cached_property\n", diff --git a/nbs/index.ipynb b/nbs/index.ipynb index 2688f37..b9b9f23 100644 --- a/nbs/index.ipynb +++ b/nbs/index.ipynb @@ -31,7 +31,7 @@ "metadata": {}, "source": [ "```sh\n", - "pip install nbdev_squ\n", + "pip install https://github.com/wagov/nbdev-squ/archive/refs/tags/v1.3.0.tar.gz\n", "```" ] }, @@ -46,6 +46,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "*Note: If you create/use a Github Codespace on any of the wagov repos, SQU_CONFIG should be configured automatically.*\n", + "\n", "Before using, config needs to be loaded into `squ.core.cache`, which can be done automatically from json in a keyvault by setting the env var `SQU_CONFIG` to `\"keyvault/tenantid\"`.\n", "\n", "```bash\n", diff --git a/nbs/sidebar.yml b/nbs/sidebar.yml index 32b20bd..2a6a61f 100644 --- a/nbs/sidebar.yml +++ b/nbs/sidebar.yml @@ -3,5 +3,4 @@ website: contents: - index.ipynb - 00_core.ipynb - - 01_api.ipynb - - 02_clients.ipynb + - 01_api.ipynb \ No newline at end of file