Skip to content

Instantly share code, notes, and snippets.

@packz
packz / 80-freepto-backup.rules
Last active December 27, 2015 20:29
Do you backup your freepto?
ACTION=="add", SUBSYSTEM=="block", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="xxxx", ENV{UDISKS_AUTO}="0", OWNER="packz", SYMLINK+="freepto%n", RUN+="/sbin/freepto.sh %k %n"
@packz
packz / bug.c
Created May 19, 2013 09:00
Overflow error
/*
* This program shows the typical programming error
* to handle wrong the signess of a variable.
*
* When the variable increases and reaches its maximum
* value it overflows and became negative.
*
* $ gcc -Wall bug.c -o bug
* $ ./bug | head
* * sizeof: 2 -> max value: 65536
@packz
packz / find_cpio.c
Last active December 11, 2015 02:19
Find cpio archive
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
//http://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt
struct cpio_newc_header {
char c_magic[6];// "070701"
char c_ino[8]; //
char c_mode[8];
@packz
packz / 000.mkd
Created November 15, 2012 09:06
Static cryptsetup

I suppose you use Debian-like systems

$ mkdir rootdir && cd rootdir && export ROOTDIR=$PWD
$ apt-get source libdevmapper1.02.1
$ apt-get source cryptsetup
@packz
packz / firmware.py
Created July 21, 2012 21:44
Little script to extract info from some TV firmwares
"""
Extract information about some TV firmware
http://neophob.com/2010/01/root-my-tv-hack-philips-pfl9703/
$ python firm.py firmware.upd
magic1: 2SWU
magic2: 3TXV
header size: 760
@packz
packz / pbkdf2.c
Created July 16, 2012 21:56
PBKDF2
//http://www.ict.griffith.edu.au/anthony/software/pbkdf2.c
/*
** SYNOPSIS
** echo "passphrase" | pbkdf2 salt_hex count > 48_byte_hex_key_and_iv
**
** DESCRIPTION
**
** Make the "Password-Based Key Derivation Function v2" function found in
** the openssl library available to the command line, as it is not available
** for use from the "openssl" command. At the time of writing the "openssl"
from scapy.all import *
import time
import argparse
import os
import sys
def arpPoison(args):
conf.iface= args.iface
pkt = ARP()
define assemble
# dont enter routine again if user hits enter
dont-repeat
if ($argc)
if (*$arg0 = *$arg0)
# check if we have a valid address by dereferencing it,
# if we havnt, this will cause the routine to exit.
end
printf "Instructions will be written to %#x.\n", $arg0
else