Giter Club home page Giter Club logo

scheduled-tasks's Introduction

scheduled-tasks

This is a set of resources I used to assist with threat hunting for anomalous tasks.

This information was presented at ShmooCon 2023 and GrrCON 2023.

Powershell Analysis

hunt-sched-tasks.ps1

This script is to be used as methodology for hunting through scheduled tasks. It's intended to be ran line-by-line and can be expanded/contracted depending on your needs.

Exporting to Elasticsearch

I plan to update this process to instead be a Logstash pipeline. Currently, this will export and convert the scheduled tasks (XML) to CSV documents for manual ingest.

Step 1 - Export the scheduled tasks

  • Use the export-schtasks.ps1 script

Step 2 - Convert the XML files to JSON

  • Use the xml-to-json.py script

Step 3 - Conver the JSON to CSV (I realize there is probably an shorter path from XML to CSV, but my miserable journey took me this way...)

Step 4 - Ingest into Elastic

  • From the homepage, click "Add Data", then navigate to "Upload file"
  • Note: This location has changed depending on what version of Elastic you are running - In my sample environment I am using Elasticsearch and Kibana v7.15.2

Elastic Containers

These images contain some sample scheduled tasks from a fresh build of Windows 10, including one malicous scheduled task.

Pull the images:

docker pull oofles/schtasks-elasticsearch
docker pull oofles/schtasks-kibana

Start the environment:

docker network create schtasks-elastic
docker run -d --name schtasks-elasticsearch --net schtasks-elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" oofles/schtasks-elasticsearch
docker run -d --name schtasks-kibana --net schtasks-elastic -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://schtasks-elasticsearch:9200/" oofles/schtasks-kibana 

Dashboards

A copy of the dashboards for your own use is here in the same repo (elastic-dashboards-schtasks.ndjson).

To import the visualizations and dashboards, navigate to "Stack Management" -> "Saved Objects" (Under Kibana), then click "Import"

Misc.

In the presentation I also used a jq line to convert from JSON to NDJSON - including that here for reference:

cat test.json | jq -c '.[]' > testNDJSON.json

scheduled-tasks's People

Contributors

oofles avatar

Stargazers

Paul W avatar AVA avatar Frank Korving avatar  avatar Aarjav Parashar avatar aRustyDev avatar AJ Read avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.