Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
IAmStoxe / ProcessHollow.cs
Created December 30, 2022 19:34 — forked from affix/ProcessHollow.cs
Process Hollowing Technique using C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Text;
using System.Threading.Tasks;
namespace hollow
{
<#
To easily find out why a sign-in failed for a specific user,
you can use the Where-Object cmdlet to filter the sign-in logs
by the user's display name, and then output information
about the failed sign-in attempt.
№ Here's an example of how you might use the Where-Object cmdlet to find out
why a sign-in failed for a specific user:
#>
function NSLookup(type, domain) {
if (typeof type == 'undefined') {
throw new Error('Missing parameter 1 dns type');
}
if (typeof domain == 'undefined') {
throw new Error('Missing parameter 2 domain name');
}
@IAmStoxe
IAmStoxe / gist:7a398f8e8e4adcc62d95bc1e98daa249
Created September 7, 2021 04:55
Delete Azure resource groups asynchronously in bulk
az group list | convertfrom-json | select -expand name | ?{$_ -like "*-rg-*"}| %{az group delete --name=$_ -y & }
@IAmStoxe
IAmStoxe / Ignore-SSLCerts.ps1
Created July 20, 2021 19:07
Ignore Invalid SSL Certificates In PowerShell
<# Ignore SSL Cert Hack #>
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
@IAmStoxe
IAmStoxe / Check-IsAdmin.ps1
Created April 12, 2021 23:17
Check if the local admin needs to run the script as administrator. If not a local admin relaunch script as admin user.
#Check if PowerShell version is greater than 2. If not, set $PSSriptRoot.
if ($PSVersionTable.PSVersion.Major -lt 3) {
$PSScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Definition
}
#Check if the user is a local admin. If they are, set $LocalAdmin to $True.
$LocalAdmin = $false
if ((net localgroup administrators) -match ([System.Environment]::UserDomainName + "\\" + [System.Environment]::Username)) {
$LocalAdmin = $true
}
@IAmStoxe
IAmStoxe / search.ps1
Created April 7, 2021 20:35
Search Microsoft Documentation via RSS
https://docs.microsoft.com/api/search/rss?search=SEARCH_TERM_HERE&locale=en-us
docker-ips() {
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} %tab% {{.Name}}' $(docker ps -aq) |
sed 's#%tab%#\t#g' |
sed 's#/##g' |
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
}
## docker-ips output
# 172.18.0.2 memcached
# 172.18.0.3 nginx
@IAmStoxe
IAmStoxe / AddWSL2FirewallRule.ps1
Created September 14, 2020 20:32
Add a rule to the Windows firewall to allow port forwarding.
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
@IAmStoxe
IAmStoxe / wireguard_pihole_install.sh
Created September 1, 2020 05:33 — forked from sethenoka/wireguard_pihole_install.sh
A script for installing a Wireguard VPN with Pi-Hole (Unbound) recursive DNS
#!/bin/bash
# This file is designed to spin up a Wireguard VPN quickly and easily,
# including configuring Pi-Hole as a recursive local DNS server using
# Unbound to block ads a the DNS level
#
# Make sure to change the public/private keys before running the script
# Also change the IPs, IP ranges, and listening port if desired
# add wireguard repo
sudo add-apt-repository ppa:wireguard/wireguard -y