Skip to content

Instantly share code, notes, and snippets.

View luca-m's full-sized avatar

lucam luca-m

View GitHub Profile
@luca-m
luca-m / xor-gif.py
Created July 22, 2013 09:50
Simple script for xorring toghether all layers of a GIF image. This work with indexed image, working with multi-channel images could need some modifications.
#!/usr/bin/env python
import Image
import sys
def xorImage( infile ):
try:
im = Image.open( infile )
except IOError:
print "Cant load", infile
@luca-m
luca-m / zlib-decompress.py
Created July 22, 2013 18:45
Quick and dirty script for decompressing a gz stream
#!/usr/bin/python
import zlib,sys,os
print 'Usage: %s <infile> <offset-addr> <length> <outfile>' % sys.argv[0]
if len(sys.argv) < 5:
exit(-1)
fr = open(sys.argv[1], 'rb')
@luca-m
luca-m / opencv.cproject
Created July 23, 2013 08:31
.cproject modification for enabling OpenCV in eclipse
<!--
...
-->
<option id="gnu.c.compiler.option.include.paths.651068615" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/usr/local/include/opencv"/>
</option>
<!--
...
-->
<option id="gnu.cpp.link.option.libs.2101947007" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
#opencv
import cv2.cv as cv
import cv2
import numpy as np
def build_filters():
filters = []
ksize = 31
for theta in np.arange(0, np.pi, np.pi / 32):
# intervals
equal.count(seq(0,10,1),4)
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis (mike.philip.davis@gmail.com)
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import select
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@luca-m
luca-m / virustotal_upload
Created May 26, 2014 19:01
Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#
# Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#
# Dependecies:
#
# * python > 2.7
# * pip install Pygments==1.4
# * curl
# * VirusTotal API key
#
@luca-m
luca-m / gist:b9ff7bbdd8eb12da4a36
Created October 18, 2014 14:58
radare2 cheatsheet
# ----------------------------------------------------------------------
# Radare2
# (Quick n'dirty) Cheat-Sheet
# lucam.ko@gmail.com
# ----------------------------------------------------------------------
# See http://radare.org/doc/html/contents.html for details
# ----------------------------------------------------------------------
# MISC
@luca-m
luca-m / omelette_egghunter_win
Created October 22, 2014 21:10
egghunt shellcode for win32
/*
* Optimized egghunt shellcode for win32 (32 bytes)
*
* Credits: http://www.hick.org/~mmiller/shellcode/win32/egghunt_syscall.c
*
* Description
*
* This code works by abusing an NT syscall (NtAccessCheckAndAuditAlaram)
* whereby it uses the kernel to validate whether or not a set of addresses
* is valid, and, if it is, whether or not they match the 8 byte egg we're