Skip to content

Instantly share code, notes, and snippets.

View brianlechthaler's full-sized avatar
🎉
This account is now 11 years old!

Brian Lechthaler brianlechthaler

🎉
This account is now 11 years old!
View GitHub Profile
@brianlechthaler
brianlechthaler / htb.dockerfile
Created January 30, 2020 06:37
HackTheBox Docker VM template
#!/bin/sh
#IMPORTANT:
# Make sure to place this dockerfile in a directory
# with your (username).ovpn profile from your connection path!!!
#NB: You can change this to any debian-based distro
FROM kalilinux/kali-linux-docker
RUN apt-get update ; apt-get upgrade -y
@brianlechthaler
brianlechthaler / htb.dockerfile
Created January 30, 2020 06:37
HackTheBox Docker VM template
#!/bin/sh
#IMPORTANT:
# Make sure to place this dockerfile in a directory
# with your (username).ovpn profile from your connection path!!!
#NB: You can change this to any debian-based distro
FROM kalilinux/kali-linux-docker
RUN apt-get update ; apt-get upgrade -y
@brianlechthaler
brianlechthaler / torrc
Created February 16, 2020 15:46
Example torrc for Relays
#Example torrc for relay nodes
#Non-exit, logs, no socks proxy, ORPort 9001
#RELAY CONFIG:
##Open ORPort on 9001 for inbound relay traffic.
###You will definitely need to expose this port to NAT and adjust iptables as necessary.
ORPort 9001
@brianlechthaler
brianlechthaler / Markdown_XSS_Test.md
Last active September 6, 2020 05:48
Check whether a markdown parser is vulnerable to XSS in this interactive PSA

Markdown Cross-Site-Scripting (XSS) Sanitization Check

An interactive PSA by Brian Lechthaler

Proof of Concept

note: if you're viewing this on GitHub the following line willl not contain a clickable link. Thanks, GitHub security team!

Is your markdown parser vulnerable to XSS? click here to find out!

@brianlechthaler
brianlechthaler / LuksAutoInitGpg.sh
Created November 11, 2020 00:19
LuksAutoInitGpg.sh
#!/bin/sh
echo "USAGE: ./gpgpw.sh <number of characters> <long key ID to encrypt password to> <output file>"
echo "EXAMPLE: ./gpgpw.sh 1024 DEADBEEF0000FFFF0000FFFF0000FFFF0000FFFF /mnt/encrypted_password.asc /dev/xvdg"
export password=$(pwgen -sy $1 1)
echo $password | cryptsetup luksFormat $4 -
export password=$(echo $password | gpg --encrypt -a -r $2)
echo $password
echo $password > $3
@brianlechthaler
brianlechthaler / mkramdisk.sh
Created November 25, 2020 00:01
Easily create a ramdisk on any Linux system. Example: ./mkramdisk.sh 1g /mnt/ramdisk
#!/bin/sh
export invokingUser=$(whoami)
echo "Usage: ./mkramdisk.sh <disk_size_bytes> <ramdisk_mountpoint>"
echo "Example: ./mkramdisk.sh 1G /mnt/ramdisk"
sudo mkdir -p $2
sudo chown -R $invokingUser:$invokingUser $2
sudo mount -t tmpfs -o size=$1 tmpfs $2
@brianlechthaler
brianlechthaler / aws-provision-efs.sh
Last active November 25, 2020 23:49
Tool to automatically provision any AWS EFS attached to an EC2 instance running this script
#!/bin/sh
#Store the name of the user who invoked this script to set appropriate permissions later
export invokingUser=$(whoami)
echo "Usage: ./efs-bootstrap.sh <EFS_Filesystem_ID> <MountPoint>"
echo "Example: ./efs-bootstrap.sh fs-deadbeef /mnt/efs/fs1/"
#Ensure target directory exists
sudo mkdir -p $2
@brianlechthaler
brianlechthaler / grover_n2_a11.qasm
Created December 21, 2020 07:22
grover n=2 a=11 in QASM v2
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
reset q[0];
reset q[1];
h q[0];
h q[1];
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon 86.53kB
Step 1/6 : FROM alpine
latest: Pulling from library/alpine
801bfaa63ef2: Pulling fs layer
801bfaa63ef2: Verifying Checksum
801bfaa63ef2: Download complete
801bfaa63ef2: Pull complete
Digest: sha256:3c7497bf0c7af93428242d6176e8f7905f2201d8fc5861f45be7a346b5f23436
Status: Downloaded newer image for alpine:latest
@brianlechthaler
brianlechthaler / superposition.qasm
Created December 27, 2020 07:56
Simple Superpositioning Example (QASM2)
OPENQASM 2.0;
include "qelib1.inc";
# Initialize 1 quantum register (1 qubit)
qreg q[1];
# Initialize 1 classic register (1 bit)
creg c[1];
#Place a Hadamard gate at the beginning of the first qubit
h q[0];