Skip to content

Instantly share code, notes, and snippets.

View ConnorNelson's full-sized avatar

Connor Nelson ConnorNelson

View GitHub Profile
@ConnorNelson
ConnorNelson / landlock.py
Created January 30, 2024 00:36
Landlock in Python
import ctypes
import enum
import os
SYS_landlock_create_ruleset = 444
SYS_landlock_add_rule = 445
SYS_landlock_restrict_self = 446
PR_SET_NO_NEW_PRIVS = 38
import collections
import os
import multiprocessing
import socket
import signal
import subprocess
import pathlib
import tempfile
import time
import shutil
import os
import socket
import subprocess
import signal
import ctypes
def sandbox(target, *, privileged=True):
CLONE_NEWNS = 0x00020000 # New mount namespace group
CLONE_NEWCGROUP = 0x02000000 # New cgroup namespace
@ConnorNelson
ConnorNelson / printmaps.js
Created May 16, 2022 22:52
Print Google Maps Better
const width = "8.5in";
const height = "11in";
function sleep(s) {
var sleepTime = 1000;
return new Promise(resolve => setTimeout(resolve, sleepTime));
}
var body = document.querySelector("body");
var content = document.querySelector("#content-container");
@ConnorNelson
ConnorNelson / strace_timeline.png
Last active October 24, 2022 23:59
strace timeline
strace_timeline.png
@ConnorNelson
ConnorNelson / debug.py
Last active February 4, 2021 21:03
Remote Python Debugging
if __name__ == "__main__":
try:
main()
except Exception as e:
import sys, os, traceback
traceback.print_exc()
os.system("pip install remote-pdb")
import requests
import matplotlib.pyplot as plt
response = requests.get("https://oooverflow.io/dc-ctf-2020-finals/final_tick.json")
data = response.json()
teams = {e["id"]: e["name"] for e in data["teams"]}
services = {e["id"]: e["name"] for e in data["services"]}
// google-chrome --headless --disable-gpu --remote-debugging-port=9222 <website>
// ssh -L localhost:1337:localhost:9222 <server>
// document.querySelector("#username").value = "<username>";
var attempts = 0;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@ConnorNelson
ConnorNelson / hack_the_planet.py
Created March 16, 2018 05:43
iCTF 2018 - Hack The Planet
#!/usr/bin/env python2
# This code was written 10 hours before the competition, yikes
# Any bugs are your problem
import socks # pip install PySocks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 4444)
socket.socket = socks.socksocket