Skip to content

Instantly share code, notes, and snippets.

View cdhunt's full-sized avatar

Chris Hunt cdhunt

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 18, 2024 10:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@robinsmidsrod
robinsmidsrod / logstash.conf
Created December 5, 2012 13:01
Logging Windows event log information to Logstash using nxlog and JSON transport
input {
tcp {
type => "syslog"
host => "127.0.0.1"
port => 3514
}
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
@mwrock
mwrock / Assert-Authentication.ps1
Created January 28, 2015 20:42
clc-powershell
function Assert-Authentication {
[CmdletBinding()]
param(
[switch]$Force
)
if(!$script:AuthSession -Or $Force) {
$creds = Get-CLCAPICredentials -ActiveCredential
if(!$Creds){
@altrive
altrive / PowerShellv5_UsingNamespace.ps1
Last active November 12, 2019 16:11
PowerShell v5 'using namespace' syntax test
#Require -Version 5.0
# using statement must appear before any other statements in a script.
# other using types(Assembly/Command/Module/Type) is not supported yet?
# [Enum]::GetNames('System.Management.Automation.Language.UsingStatementKind')
using namespace System.Diagnostics
using namespace System.Linq
function Main
{
@ohanhi
ohanhi / frp.md
Last active December 23, 2022 13:06
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@mgreenegit
mgreenegit / WSManTrust.psm1
Last active December 3, 2020 22:55
Simple set of commands to maintain the WSMan trusted hosts list
function Get-WSManTrust {
(Get-Item -Path WSMan:\localhost\Client\TrustedHosts | % Value).split(',')
}
function New-WSManTrust {
param(
[string]$hostname
)
Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value $hostname -Concatenate -Force
}
@mattifestation
mattifestation / Example_WMI_Detection_EventLogAlert.ps1
Created January 14, 2016 21:53
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'
[cmdletbinding()]
Param()
#Adding definitions for accessing the Audio API
Add-Type -TypeDefinition @'
using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume {
// f(), g(), ... are unused COM method slots. Define these if you care
int f(); int g(); int h(); int i();
@potatoqualitee
potatoqualitee / mentalhealth.txt
Last active July 8, 2021 13:07
⛔ Twitter mental health mute list
# mute here: https://twitter.com/settings/muted_keywords
republicans
democrats
sanders
manafort
comey
koch
kkk
ku klux klan
TERF
@markekraus
markekraus / HttpClient-Example.ps1
Created November 25, 2020 21:03
Example using HttpClient in PowerShell
# Create single HttpClient
$client = [System.Net.Http.HttpClient]::new()
# Perform multiple GETs
foreach ($url in $urls) {
$clientResult = $client.GetStringAsync($url).
GetAwaiter().
GetResult()
$clientResult | ConvertFrom-Json
}