{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Locked Workstation\n", "Automatically lock workstation sessions after a standard period of inactivity. The case is not applicable for Unix OS. Supported OS - Windows 2008 R2 and 7, Windows 2012 R2 and 8.1, Windows 2016 and 10 Windows Server 2019." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Rule Content\n", "```\n", "- title: Locked Workstation\n", " id: 411742ad-89b0-49cb-a7b0-3971b5c1e0a4\n", " description: Automatically lock workstation sessions after a standard period of\n", " inactivity. The case is not applicable for Unix OS. Supported OS - Windows 2008\n", " R2 and 7, Windows 2012 R2 and 8.1, Windows 2016 and 10 Windows Server 2019.\n", " author: Alexandr Yampolskyi, SOC Prime\n", " status: stable\n", " references:\n", " - https://www.cisecurity.org/controls/cis-controls-list/\n", " - https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-2-1.pdf\n", " - https://nvlpubs.nist.gov/nistpubs/CSWP/NIST.CSWP.04162018.pdf\n", " - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4800\n", " date: 2019/03/26\n", " logsource:\n", " product: windows\n", " service: security\n", " category: null\n", " detection:\n", " selection:\n", " EventID:\n", " - 4800\n", " condition: selection\n", " falsepositives:\n", " - unknown\n", " level: low\n", " tags:\n", " - CSC16\n", " - CSC16.11\n", " - ISO27002-2013 A.9.1.1\n", " - ISO27002-2013 A.9.2.1\n", " - ISO27002-2013 A.9.2.2\n", " - ISO27002-2013 A.9.2.3\n", " - ISO27002-2013 A.9.2.4\n", " - ISO27002-2013 A.9.2.5\n", " - ISO27002-2013 A.9.2.6\n", " - ISO27002-2013 A.9.3.1\n", " - ISO27002-2013 A.9.4.1\n", " - ISO27002-2013 A.9.4.3\n", " - ISO27002-2013 A.11.2.8\n", " - PCI DSS 3.1 7.1\n", " - PCI DSS 3.1 7.2\n", " - PCI DSS 3.1 7.3\n", " - PCI DSS 3.1 8.7\n", " - PCI DSS 3.1 8.8\n", " - NIST CSF 1.1 PR.AC-1\n", " - NIST CSF 1.1 PR.AC-4\n", " - NIST CSF 1.1 PR.AC-6\n", " - NIST CSF 1.1 PR.AC-7\n", " - NIST CSF 1.1 PR.PT-3\n", "\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Querying Elasticsearch" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import Libraries" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from elasticsearch import Elasticsearch\n", "from elasticsearch_dsl import Search\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Initialize Elasticsearch client" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "es = Elasticsearch(['http://helk-elasticsearch:9200'])\n", "searchContext = Search(using=es, index='logs-endpoint-winevent-security-*', doc_type='doc')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Run Elasticsearch Query" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = searchContext.query('query_string', query='event_id:(\"4800\")')\n", "response = s.execute()\n", "if response.success():\n", " df = pd.DataFrame((d.to_dict() for d in s.scan()))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Show Results" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df.head()" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 4 }