Skip to content

Instantly share code, notes, and snippets.

// TcbElevation - Authors: @splinter_code and @decoder_it
#define SECURITY_WIN32
#include <windows.h>
#include <sspi.h>
#include <stdio.h>
#pragma comment(lib, "Secur32.lib")
void EnableTcbPrivilege(BOOL enforceCheck);
#Function to Download All Files from a SharePoint Online Folder - Recursively
$FolderName = "Name the folder you are downloading"
#The transcript will capture the process to ensure you have a log of the download/transfer - ALWAYS KEEP LOGS
Start-Transcript -Path "C:\temp\$FolderName.txt"
Function Download-SPOFolder([Microsoft.SharePoint.Client.Folder]$Folder, $DestinationFolder)
{
#Get the Folder's Site Relative URL
$FolderURL = $Folder.ServerRelativeUrl.Substring($Folder.Context.Web.ServerRelativeUrl.Length)
$LocalFolder = $DestinationFolder + ($FolderURL -replace "/","\")
#Create Local Folder, if it doesn't exist
@rqu1
rqu1 / checkmk.py
Last active August 4, 2024 16:42
check if a PAN firewall is using the default master key when globalprotect is enabled
from hashlib import md5, sha1
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
from base64 import b64encode, b64decode
import sys, time
import requests
DEFAULT_MASTERKEY=b'p1a2l3o4a5l6t7o8'
class PanCrypt():
@mr-scripting
mr-scripting / API_Connections_Governance.ps1
Created August 2, 2022 19:17
API_Connections_Governance
<#
.SYNOPSIS
This script lists all Logic app api connections v1 and shows which apis belong
to which Logic app.It also lists the orfan apis
.DESCRIPTION
This script lists all Logic app api connections v1 and shows which apis belong
to which Logic app.It also lists the orfan apis
.NOTES
This script was created by the Microsoft Engineer Yanbo Deng
.LINK
@wjz1095
wjz1095 / Fix_Windows_V2.ps1
Created August 2, 2022 15:12
Fix Windows - Powershell (Admin)
#Run this script as admin, auto-elevate if not ran as admin
Write-Host "[INFO] Elevating script to admin..."
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
Pause
Write-Host "[INFO] Start time:" -ForegroundColor Yellow
$StartTime = Get-Date
Write-Host $StartTime
@stephenmbell
stephenmbell / New-OPSWindowsServer.ps1
Last active August 3, 2022 20:21
script to pre-stage AD server and add to required groups
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$ComputerName,
# Parameter help description
[Parameter()]
[string]
$OUPath = 'OU=Windows,OU=Servers,DC=mydomain,DC=local',
@lucienbill
lucienbill / SearchInZip-FilesThatContainASpecificString.ps1
Last active August 3, 2022 20:22
Given a folder that contains some zip files, this script lists the files within the zipped files that contain a specific string.
### What is this script ? ###
# Given a folder that contains some zip files, this script lists the files
# within the zipped files that contain a specific string.
#
# Example behavior (if you run the script with the example values) :
# This script will search for files that have the following characteristics :
# - ".csv" files contained within a zip, in a the folder
# "C:\Users\lulu\Downloads\tmp\dev" or its subfolders
# - The file must contain the string "foo"
# - The script will return 2 files or less
@bellons91
bellons91 / show-notification-win10.ps1
Created August 2, 2022 07:54
This PowerShell script allows you to show timed notification on your Win10 system. It can be useful to show reminders
function Show-Notification {
[cmdletbinding()]
Param (
[string]
$ToastTitle,
[string]
[parameter(ValueFromPipeline)]
$ToastText
@sphr2k
sphr2k / Get-DisplayInfo.ps1
Last active August 3, 2022 20:22
PowerShell Display Info (multiple displays supported)
If(-Not(Get-WmiObject WmiMonitorID -Namespace root\wmi -ErrorAction SilentlyContinue)) {
Write-Host "No display detected - exiting ..."
exit 1
}
Function ConvertTo-Char
(
$Array
)
{
@biosmanager
biosmanager / Start-ScheduledAutostart.ps1
Last active August 26, 2022 16:58
Scheduled autostart using PowerShell. Programs only start within the specified time frame and not on your days off. Use task scheduler to run at logon. Repository at: https://github.com/biosmanager/scheduled-autostart
param (
$StartTime = '09:00',
$EndTime = '18:00',
$DaysOff = @('Saturday', 'Sunday')
)
$StartTimeDate = Get-Date $StartTime
$EndTimeDate = Get-Date $EndTime
$Date = Get-Date