Skip to content

Instantly share code, notes, and snippets.

@mavjs
Forked from Purp1eW0lf/Sysmon_Lab.ps1
Created March 16, 2023 18:28
Show Gist options
  • Select an option

  • Save mavjs/cc1272e8eb00e6ad2233b69a1d6800a2 to your computer and use it in GitHub Desktop.

Select an option

Save mavjs/cc1272e8eb00e6ad2233b69a1d6800a2 to your computer and use it in GitHub Desktop.

Revisions

  1. @Purp1eW0lf Purp1eW0lf revised this gist Jul 1, 2022. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions Sysmon_Lab.ps1
    Original file line number Diff line number Diff line change
    @@ -36,8 +36,6 @@ function install_various{
    # Olaf's : https://raw.githubusercontent.com/olafhartong/sysmon-modular/master/sysmonconfig.xml
    # Sophos apparently have one but it seems dedicated to malware analysis : https://support.sophos.com/support/s/article/KB-000038882?language=en_US



    #install sysmon's stuff
    .\Sysmon64.exe -i sysmonconfig.xml -accepteula

  2. @Purp1eW0lf Purp1eW0lf revised this gist Jul 1, 2022. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Sysmon_Lab.ps1
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,13 @@ function install_various{
    wget -UseBasicParsing https://download.sysinternals.com/files/Sysmon.zip -outfile "Sysmon.zip"
    Expand-archive "Sysmon.zip" -DestinationPath .
    wget -UseBasicParsing https://raw.githubusercontent.com/Neo23x0/sysmon-config/master/sysmonconfig-export.xml -outfile "sysmonconfig.xml"

    #If you want to swap the sysmon ruleset from Florian's to another's swap the address above
    # SwiftOnSecurity's : https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml
    # Olaf's : https://raw.githubusercontent.com/olafhartong/sysmon-modular/master/sysmonconfig.xml
    # Sophos apparently have one but it seems dedicated to malware analysis : https://support.sophos.com/support/s/article/KB-000038882?language=en_US



    #install sysmon's stuff
    .\Sysmon64.exe -i sysmonconfig.xml -accepteula
  3. @Purp1eW0lf Purp1eW0lf revised this gist May 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Sysmon_Lab.ps1
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ function install_various{
    Admin_Check | out-null

    #Message
    write-host "`n`nSysmon is " -nonewline; write-host (get-service sysmon64).status -ForegroundColor magenta
    write-host "`n`nSysmon is " -nonewline; write-host (get-service sysmon*).status -ForegroundColor magenta
    Write-host "`nRun " -nonewline; Write-Host "C:\users\$env:USERNAME\Desktop\SysmonLab\PowerSiem.ps1" -foregroundcolor Magenta -NoNewline; Write-host " and then detonate your malware to gather IoCs from Sysmon log`n"

    exit
  4. @Purp1eW0lf Purp1eW0lf revised this gist Mar 28, 2022. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions Sysmon_Lab.ps1
    Original file line number Diff line number Diff line change
    @@ -25,17 +25,16 @@ function install_various{
    # Create and work from specific directory
    new-item "C:\users\$env:USERNAME\Desktop\SysmonLab" -ItemType "directory"
    Set-Location "C:\users\$env:USERNAME\Desktop\SysmonLab"



    #Download sysmon stuff
    wget -UseBasicParsing https://download.sysinternals.com/files/Sysmon.zip -outfile "Sysmon.zip"
    Expand-archive "Sysmon.zip" -DestinationPath .
    wget -UseBasicParsing https://raw.githubusercontent.com/Neo23x0/sysmon-config/master/sysmonconfig-export.xml -outfile "sysmonconfig.xml"

    #install sysmon stuff
    #install sysmon's stuff
    .\Sysmon64.exe -i sysmonconfig.xml -accepteula

    #Ippsec stuff
    #Ippsec's stuff
    wget -UseBasicParsing https://raw.githubusercontent.com/IppSec/PowerSiem/master/PowerSiem.ps1 -outfile "PowerSiem.ps1"

    #Clean up
  5. @Purp1eW0lf Purp1eW0lf created this gist Mar 28, 2022.
    51 changes: 51 additions & 0 deletions Sysmon_Lab.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    <#
    Meta
    Date: 2022 March 28th
    Authors: Dray Agha (Twitter @purp1ew0lf)
    Company: Huntress Labs
    Purpose: Automate setting up Sysmon and pulling Ippsec's sysmon IoC streamliner. Great for malware lab.
    #>

    function admin_check{
    if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
    [Security.Principal.WindowsBuiltInRole] "Administrator")) {
    Write-Warning "Insufficient permissions. Run this Powershell script as Admin please"
    Break
    }
    # if we're all good, let's fire it off
    else {Install_various}
    }

    function install_various{

    #Ensure errors don't ruin anything for us
    $ErrorActionPreference = "SilentlyContinue"
    $progressPreference = 'silentlyContinue'

    # Create and work from specific directory
    new-item "C:\users\$env:USERNAME\Desktop\SysmonLab" -ItemType "directory"
    Set-Location "C:\users\$env:USERNAME\Desktop\SysmonLab"


    #Download sysmon stuff
    wget -UseBasicParsing https://download.sysinternals.com/files/Sysmon.zip -outfile "Sysmon.zip"
    Expand-archive "Sysmon.zip" -DestinationPath .
    wget -UseBasicParsing https://raw.githubusercontent.com/Neo23x0/sysmon-config/master/sysmonconfig-export.xml -outfile "sysmonconfig.xml"

    #install sysmon stuff
    .\Sysmon64.exe -i sysmonconfig.xml -accepteula

    #Ippsec stuff
    wget -UseBasicParsing https://raw.githubusercontent.com/IppSec/PowerSiem/master/PowerSiem.ps1 -outfile "PowerSiem.ps1"

    #Clean up
    remove-item .\"sysmon.zip", .\"sysmon.exe", .\"eula.lnk", .\"Eula.txt"
    }
    #Execute main function in silence
    Admin_Check | out-null

    #Message
    write-host "`n`nSysmon is " -nonewline; write-host (get-service sysmon64).status -ForegroundColor magenta
    Write-host "`nRun " -nonewline; Write-Host "C:\users\$env:USERNAME\Desktop\SysmonLab\PowerSiem.ps1" -foregroundcolor Magenta -NoNewline; Write-host " and then detonate your malware to gather IoCs from Sysmon log`n"

    exit