Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
#
# Copyright (c) 2021 Jasper Lievisse Adriaanse <j@jasper.la>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@jasperla
jasperla / funcs.c
Created December 13, 2020 13:25
Common CTF functions for LD_PRELOAD
/*
* cc -Wall -o funcs.so -shared funcs.c -DENABLE_ALL
*
* LD_PRELOAD=./funcs.so ./target
* or from inside gdb:
* set environment LD_PRELOAD=./funcs.so
*/
#include <unistd.h>
diff --git a/tests/unit/modules/test_tls.py b/tests/unit/modules/test_tls.py
index 419cddd056..614963ccfb 100644
--- a/tests/unit/modules/test_tls.py
+++ b/tests/unit/modules/test_tls.py
@@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging
+import os
#!/usr/bin/env python3
#
# https://z3prover.github.io/api/html/namespacez3py.html
# https://ericpony.github.io/z3py-tutorial/guide-examples.htm
import sys
from z3 import *
def add_constraints(solver, badbytes, *vars):
#!/usr/bin/env python3
badbytes = b'\x00\x0a\x0d\x0f\x14\x15\x5c\x2f\x3a\xff'
print(f'badbytes raw = {badbytes}')
print('individual bad bytes as hex = ', end='')
[print(hex(x), end=' ') for x in badbytes]
print()
# Declare block explicitly as bytes:
#!/usr/bin/env python3
import subprocess
import sys
for i in range(0x00, 0xff+1):
opcodes = '00' + str(hex(i)).replace('0x', '').rjust(2, '0') + '00'
cmd = ['rasm2', '-a', 'x86', '-b', '32', '-d', opcodes]
#!/usr/bin/env python3
import argparse
# Using mona.py to find the badbytes with unicode:
# !mona cmp -r $REG -f c:\all_chars_unicode.bin
# then use 'xxd -s $offset all_chars.bin' to find the actual byte matching the offset.
def main():
parser = argparse.ArgumentParser()
; nasm -D OpenBSD -f elf64 exit.nasm -o exit.o && ld.bfd -nopie -e _start exit.o -o exit && ./exit ; echo $?
%ifdef OpenBSD
section .note.openbsd.ident
align 2
dd 8,4,1
db "OpenBSD",0
dd 0
align 2
#!/usr/bin/env python3
#
# quick-n-dirty script to download all tags for a given registry.
# Might come in handy when trawling Shodan.
import json
import requests
from urllib3.exceptions import InsecureRequestWarning
use std::io::prelude::*;
use std::net::TcpStream;
use crossbeam_channel::{unbounded, Receiver, Sender};
use crossbeam_utils::thread;
use rand::prelude::*;
use std::time::Duration;
pub type Msg = Box<u8>;