Skip to content

Instantly share code, notes, and snippets.

@techvoltage
techvoltage / autolog.py
Created August 31, 2017 13:55 — forked from brendano/autolog.py
python decorators to log all method calls, show call graphs in realtime too
# Written by Brendan O'Connor, [email protected], www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@techvoltage
techvoltage / Keygen-2.py
Last active August 27, 2017 09:18
50 point reversing challenge from HackCon-2017(https://ctftime.org/task/4476). Uses Python z3.
import string
import random
from z3 import *
import socket
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
s.sendall(content)
s.shutdown(socket.SHUT_WR)
1. Execute make first. This will result in a netlinkKernel.ko output among many others.
2. Execute $ gcc netlinkUser.c -o netlinkUser
3. Insert kernel module by :$ sudo insmod netlinkKernel.ko
4. Run ./netlinkUser to see message and run dmesg to see debug messages
5. Remove module by : $ sudo rmmod netlinkKernel
6. Finally make clean to remove output files.
@techvoltage
techvoltage / Makefile
Created June 5, 2017 09:26 — forked from llj098/Makefile
a sample tcp server runs in kernel
obj-m += tcp_svr_sample.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea
#!/bin/bash -x
#Yep that's lazy
echo scp file `whoami`@`ip route get 8.8.8.8 | awk 'NR==1 {print $NF}'`:`pwd`
#define _GNU_SOURCE
#include <link.h>
#include <stdlib.h>
#include <stdio.h>
static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
int j;
#!/bin/bash
#Redhat and friends: Test for /etc/redhat-release, check contents
#Debian: Test for /etc/debian_version, check contents
#Mandriva and friends: Test for /etc/version, check contents
#Slackware: Test for /etc/slackware-version, check contents
#https://serverfault.com/questions/3331/how-do-i-find-out-what-version-of-linux-is-running
get_distribution_type()
{
local dtype
@techvoltage
techvoltage / find_fun.py
Created April 14, 2017 12:45
Finds the Function's Load Address
#!/usr/bin/env python
#Taken from http://uaf.io/exploitation/misc/2016/04/02/Finding-Functions.html
from pwn import *
import sys, os
wordSz = 4
hwordSz = 2
bits = 32
PIE = 0

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000