Skip to content

Instantly share code, notes, and snippets.

<#
.Synopsis
Registers a HTTP prefix and listens for a HttpRequest
.DESCRIPTION
Simple PowerShell HTTP Server implementation to respond to a single HTTP request
.EXAMPLE
Get-HttpRequest -UriPrefix "http://+:80/TestUri/" -ResponseData (Get-Content C:\inetpub\wwwroot\index.html)
.EXAMPLE
Get-HttpRequest -UriPrefix "http://127.0.0.1/" -ResponseData "It Works...!" -ShowRequest
#>
@sunnyc7
sunnyc7 / msmq.vbs
Last active August 29, 2015 14:15 — forked from zachbonham/msmq.vbs
' http://zachbonham.blogspot.com
'
' use at your own risk. :)
'
' assuming that your default scripting engine is CScript.exe
' cscript //H:CScript
'
'
' Assuming administrator priviledges
'
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)
self.database()
@sunnyc7
sunnyc7 / VSCodeDeepDive.md
Created April 17, 2017 12:05 — forked from daviwil/VSCodeDeepDive.md
The notes from my session "Authoring in VS Code" at the 2017 PowerShell and DevOps Global Summit in Bellevue, WA.

Visual Studio Code Deep Dive

David Wilson - @daviwil Software Engineer, PowerShell Team

Overview

  1. Visual Studio Code overview
  2. Configuring the editor
  3. Extensions
@sunnyc7
sunnyc7 / Struct.ps1
Created April 28, 2017 09:59 — forked from proxb/Struct.ps1
Using PowerShell and Reflection to dynamically build a Struct with Constructors and Methods
#region Module Builder
$Domain = [AppDomain]::CurrentDomain
$DynAssembly = New-Object System.Reflection.AssemblyName(([guid]::NewGuid().ToString()))
$AssemblyBuilder = $Domain.DefineDynamicAssembly($DynAssembly, [System.Reflection.Emit.AssemblyBuilderAccess]::Run) # Only run in memory
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule(([guid]::NewGuid().ToString()), $False)
#endregion Module Builder
#region STRUCTs
#Order of creating these Structs is important
#region MyStruct
$Attributes = 'AutoLayout, AnsiClass, Class, Public, SequentialLayout, Sealed, BeforeFieldInit'
@sunnyc7
sunnyc7 / jessfraz.md
Created November 20, 2017 23:21 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper
@sunnyc7
sunnyc7 / service-checklist.md
Created November 20, 2017 23:22 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@sunnyc7
sunnyc7 / Example_WMI_Detection_EventLogAlert.ps1
Created September 21, 2018 21:38 — forked from mattifestation/Example_WMI_Detection_EventLogAlert.ps1
An example of how to use permanent WMI event subscriptions to log a malicious action to the event log
# Define the signature - i.e. __EventFilter
$EventFilterArgs = @{
EventNamespace = 'root/cimv2'
Name = 'LateralMovementEvent'
Query = 'SELECT * FROM MSFT_WmiProvider_ExecMethodAsyncEvent_Pre WHERE ObjectPath="Win32_Process" AND MethodName="Create"'
QueryLanguage = 'WQL'
}
$InstanceArgs = @{
Namespace = 'root/subscription'
@sunnyc7
sunnyc7 / ConvertXLS.ps1
Created November 19, 2018 22:05 — forked from gabceb/ConvertXLS.ps1
Powershell script to convert all xls documents to xlsx in a folder recursively
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook
write-host $xlFixedFormat
$excel = New-Object -ComObject excel.application
$excel.visible = $true
$folderpath = "C:\Users\gabceb\Documents\testXLS"
$filetype ="*xls"
Get-ChildItem -Path $folderpath -Include $filetype -recurse |
ForEach-Object `
{
$path = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))
@sunnyc7
sunnyc7 / README.md
Created January 13, 2019 17:46 — forked from theArjun/README.md
Tower Of Hanoi by Recursion in Java

Tower of Hanoi

How's it is solved ?

Tower Of Hanoi

Long steps ahead

Steps for Tower Of Hanoi

To know more :