Skip to content

Instantly share code, notes, and snippets.

View Wind010's full-sized avatar

Jeff Tong Wind010

View GitHub Profile
@Wind010
Wind010 / export_vars.sh
Created July 28, 2023 01:12
Bash script that parses a local.settings.json to export the properties as environment variables.
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <json_file>"
exit 1
fi
if [ ! -f "$1" ]; then
echo "Error: JSON file '$1' not found."
exit 1
@Wind010
Wind010 / potfile_hex_to_ascii.ps1
Created June 20, 2023 02:17
Script to create a new file with ASCII SSIDs/ESSIDs from Hashcat potfile.
# Script to create a new file with ASCII SSIDs/ESSIDs from Hashcat potfile.
# Usage .\potfile_hex_to_ascii.ps1 hashcat.potfile
param(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$false)]
[string]
$potFilePath
)
Get-Content $filePath | ForEach-Object {
@Wind010
Wind010 / backup_pwnagotchi.ps1
Last active May 9, 2024 09:03
Powershell scripts to backup and restore a pwnagotchi
# Script to backup your pwnagotchi.
# Usage:
# backup_pwnagotchi.ps1 <ip_address_of_pwnagotchi>
# The <ip_address_of_pwnagotchi> should be the static ip address set previously (10.0.0.2).
# Can setup SSH keys to bypass password prompt for SCP.
param(
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$false)]
[string]
@Wind010
Wind010 / azure-pipelines.yml
Created May 13, 2023 00:23 — forked from igoravl/azure-pipelines.yml
Whitelist build agent on demand when pushing to ACR with firewall enabled
trigger:
- master
resources:
- repo: self
variables:
azureSubscription: '<azure-subscription>'
dockerRegistryServiceConnection: '<service-connection>'
imageRepository: '<repository-name>'
from typing import AsyncIterable, List
import aiohttp
import asyncio
import platform
import time
import nest_asyncio
#__import__('IPython').embed()
@Wind010
Wind010 / jwt.ps1
Created May 4, 2023 02:50 — forked from gitfvb/jwt.ps1
create a standard jwt token in PowerShell
<#
based on this example from: https://jwt.io/
https://stackoverflow.com/questions/30246497/using-statement-for-base64urlencode
https://medium.com/@nikitafed9292/net-base64-decoding-workaround-82b797162b6e
https://blog.angular-university.io/angular-jwt/
https://gist.github.com/kucukkanat/1ef77db8120323db2b89087735ef8a5d
#>
################################################
@Wind010
Wind010 / detect_bad_crop.ps1
Created April 22, 2023 00:10
A python script to see if images have residual data after cropping (CVE-2023-21036).
if ($args.Count -eq 0) {
Write-Host "Usage: $($MyInvocation.MyCommand.Name) png_file1 png_file2 ..."
exit 1
}
# Byte arrays can be defined with decimal or hex.
$PNG_SIGNATURE = [byte[]]@(137, 80, 78, 71, 13, 10, 26, 10)
[byte[]] $STANDARD_IEND = @(0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82)
# Notes:
@Wind010
Wind010 / detect_bad_crop_simple.py
Created April 22, 2023 00:05
A python script to see if images have residual data after cropping (CVE-2023-21036).
import sys
STANDARD_IEND = b'\x00\x00\x00\x00IEND\xae\x42\x60\x82'
# https://en.wikipedia.org/wiki/PNG
# https://en.wikipedia.org/wiki/ACropalypse
# https://github.com/infobyte/CVE-2023-21036
# USAGE: detect_bad_crop_simple.py <png1> <png2> ...
@Wind010
Wind010 / Chunked_Query.sql
Created April 8, 2023 02:47
Run dynamic query over chunked/partitioned intervals.
DECLARE @start_date DATETIME = '2023-04-07 00:00:00'
DECLARE @end_date DATETIME = '2023-04-08 23:00:00'
DECLARE @hours CURSOR;
DECLARE @interval INT = 1;
-- You can adjust the to every n hour range if needed.
SET @hours = CURSOR FOR
WITH cte_hourly_timestamps AS (
SELECT CONVERT(datetimeoffset, @start_date) AS start_hour
UNION ALL
SELECT DATEADD(HOUR, @interval, start_hour)
@Wind010
Wind010 / Replace.ps1
Created March 17, 2023 22:11
Replace one string with another in files with specific extension recursively from given pat
$replaceDict = @{
'<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />' = '<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />'
'<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />' = '<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />'
'<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />' = '<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />'
'<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />' = '<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />'
'<PackageReference Include="Microsoft.Extensions.Configuration.DependencyInjection" Version="7.0.0" />' = '<PackageReference Include="Microsoft.Extensions.Configuration.DependencyInjection" Version="6.0.0" />'
'<PackageRefe