HELK/docker/helk-jupyter/notebooks/sigma/win_susp_psr_capture_screen...

129 lines
2.9 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# psr.exe capture screenshots\n",
"The psr.exe captures desktop screenshots and saves them on the local machine"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Rule Content\n",
"```\n",
"- title: psr.exe capture screenshots\n",
" id: 2158f96f-43c2-43cb-952a-ab4580f32382\n",
" status: experimental\n",
" description: The psr.exe captures desktop screenshots and saves them on the local\n",
" machine\n",
" references:\n",
" - https://github.com/LOLBAS-Project/LOLBAS/blob/master/yml/LOLUtilz/OSBinaries/Psr.yml\n",
" - https://www.sans.org/summit-archives/file/summit-archive-1493861893.pdf\n",
" author: Beyu Denis, oscd.community\n",
" date: 2019/10/12\n",
" modified: 2019/11/04\n",
" tags:\n",
" - attack.persistence\n",
" - attack.t1218\n",
" level: medium\n",
" logsource:\n",
" category: process_creation\n",
" product: windows\n",
" service: null\n",
" detection:\n",
" selection:\n",
" Image|endswith: \\Psr.exe\n",
" CommandLine|contains: /start\n",
" condition: selection\n",
" falsepositives:\n",
" - Unknown\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-*', 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='(process_path.keyword:*\\\\Psr.exe AND process_command_line.keyword:*\\/start*)')\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
}