Giter Club home page Giter Club logo

wineventlogexplorer's Introduction

WinEventLogExplorer

Capture all events across all logs produced during the running of a particular exploit/script. Has functionality to search and filter events.

Nothing special but useful for collecting exploit/threat data for detection engineering, pen-testing, etc.

Follows the Matt Graeber method from his talk here: 1 05 How do I detect technique X in Windows Applied Methodology to Definitively Answer this Question.

This is generally:

  1. Understand the Implementation
  2. Develop Attack Validations
    • Develop as many attack variants as possible.
      1. Identify common and/or distinct detection data sources across procedures
      2. Maximize "detection coverage"
  3. Observe Detection Artifacts
    • Using process monitor, process explorer, process hacker, ...

Inspired by: HowToDetectTechniqueX_Demos.ps1

Can be run as Administrator or not as Administrator, although some of the event logs require Admin privileges to access, and you need Admin privileges to update the Sysmon config.

To run:

.\LogExplorer.ps1

Update the sysmon path on line 27 before using:

# Sysmon:
$sysmon_path = "C:\Sysinternals\SysinternalsSuite\Sysmon64.exe"		# Path to Sysmon exe

How to Use:

docs/1.png

Option 1 - Collect Logs

Print all events from all event logs that have been created in the past 10 minutes. Exports to a TXT file, and html.

docs/4.png

These two options are optional.

Option 2 - Use "Log Everything" Sysmon Config

Sets the current Sysmon config to a config that logs everything (or alot). Using the config by SwiftOnSecurity https://github.com/SwiftOnSecurity/sysmon-config.

Make sure to configure as desired.

See on_config.xml

Option 3 - Use "Log Nothing" Sysmon Config

Sets the current Sysmon config to a config that logs nothing. See off_config.xml.

Event Searching and Filtering

Option a - Get most recently updated logs

Get the names of the Event logs that were updated in the last 10 minutes.

docs/2.png

Option b - Find Events by Id

Find events by ID from a particular log.

docs/5.png

Option c - Find Events containing a particular string

Find events containing a particular string from a particular log.

Use the syntax query* to find events beginning with query, *query to find events ending in query, and *query* to find events containing query.

Example: Searching for events containing lsass in Sysmon log. docs/7.png

Option d - Mattifestation Method

This method is to get all the events that are produced during the running of an exploit (and only those events).

You must change the attack command (line 99) to the command of the exploit/script you want to test before using it (see examples for command format)

# Perform Attack Here:
# ---------------------------------------------------------------------
	
# Examples (REPLACE ME):
& cmd.exe /c notepad.exe

It works as follows:

  1. Set the current Sysmon config to the "log everything" config (Optional)
  2. Get the current time start_time
  3. Run the exploit
  4. Get the current time end_time
  5. Get the events produced between start_time and end_time
  6. Export them to a file for further analysis
  7. Set the current Sysmon config to the "log nothing" config (Optional)

Example with command cmd.exe /c notepad.exe: docs/9.png

Export Formats:

Events are exported to a TXT and HTML file, named by timestamp

docs/14.png

TXT File:

docs/13.png

HTML File:

Toggle events to find the ones that are relevant and export to TXT file. docs/html_format.gif

Conifguration:

Change the following constants to modify the search intervals:

You must change the sysmon path to use the sysmon config toggle functionality.

# CONSTANTS:
# ==================
$newest_log_writes_period = (New-TimeSpan -Minute 10) # Get the logs that were most recently updated (Get-Newest-Log-Writes)
$pull_by_id_period = (New-TimeSpan -Hour 24)		  # Get the events by id (Pull-By-ID)
$pull_by_string_period = (New-TimeSpan -Hour 12)	  # Get events containing an particular string (Search-For-String-In-Source)
$pull_all_period = (New-TimeSpan -Hour 1)			  # Get all events in a particular time period (Pull-Event-Logs)

# Sysmon:
$sysmon_path = "C:\Sysinternals\SysinternalsSuite\Sysmon64.exe"		# Path to Sysmon exe
$sysmon_on_config_location = "$PWD\on_config.xml"					# Path to "log everything" config
$sysmon_off_config_location = "$PWD\off_config.xml"					# Path to "log nothing" config

# =====================

wineventlogexplorer's People

Contributors

crazyeights225 avatar

Stargazers

 avatar  avatar  avatar  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.