Skip to content

Instantly share code, notes, and snippets.

View SafeEval's full-sized avatar

Jack Sullivan SafeEval

View GitHub Profile
@SafeEval
SafeEval / blog-eb-dockerebdeps.sh
Last active August 29, 2015 14:17
Django Docker Elastic Beanstalk Dependencies
# Add docker apt repository
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
# Update packages
sudo apt-get update; sudo apt-get upgrade -y;
# Install development tools
sudo apt-get install -y git python-pip python2.7-dev postgresql libpq-dev lxc-docker
sudo pip install -U pip
@SafeEval
SafeEval / django-keygen.sh
Last active August 29, 2015 14:18
Generate a SECRET_KEY for Django via CLI
# Generates and prints a new SECRET_KEY for Django to STDOUT.
# Run directly from the command line without requiring a script file.
python -c "import random; import string; print (''.join( [random.SystemRandom().choice(string.digits + string.ascii_letters + string.punctuation).replace('\"', '').replace('\'','') for i in range(100)] ))"
# Environment variable example.
# $ export SECRET_KEY=$(python -c "import random; import string; print (''.join( [random.SystemRandom().choice(string.digits + string.ascii_letters + string.punctuation).replace('\"', '').replace('\'','') for i in range(100)] ))")
# Heroku example.
@SafeEval
SafeEval / exit_x86-linux-intel.s
Last active August 29, 2015 14:28
Call exit() syscall with return code 42.
; exit_x86-linux-intel.s
[SECTION .text]
global _start
_start:
xor eax,eax ; zero out eax, no null
xor ebx,ebx ; zero out ebx, no null
mov bl,42 ; return code is 42
mov al,1 ; exit is syscall 1
// exit_x86-linux.c - exit() x86 linux shellcode.
char sc[] = "\x31\xc0\x31\xdb\xb3\x2a\xb0\x01\xcd\x80";
int main()
{
int (*func)();
func = (int (*)()) sc;
(int)(*func)();
}
#exit_x86-linux-att.s
.text
.globl _start
_start:
xor %eax,%eax #zero out eax, no null
xor %ebx,%ebx #zero out ebx, no null
mov $42,%bl #return code is 42
mov $1,%al #exit is syscall 1
// exit_x86-linux-att.c - inline exit() shellcode
static void exit()
{
__asm__(".att_syntax prefix");
__asm__ volatile(
"xor %eax,%eax \n" //zero out eax, no null
"xor %ebx,%ebx \n" //zero out ebx, no null"
"mov $42,%bl \n" //return code is 42"
// exit_x86-linux-intel.c - inline exit() shellcode
static void exit()
{
__asm__(".intel_syntax noprefix");
__asm__ volatile(
"xor eax,eax \n" //zero out eax, no null
"xor ebx,ebx \n" //zero out ebx, no null"
"mov bl,42 \n" //return code is 42"
"mov al,1 \n" //exit is syscall 1"
/* Generated by shextor
*
* exit_x86-linux_shextor.c - shellcode harness
*
* SC Length: 10 bytes
*
* Time: 2015-08-23 16:58:04
* Execuable: exit
* Format: elf32-i386
* SHA1: 28e8ef986ec2ef8789662d7cd585aed4a854740d
; callpop_x86-intel.s - call/pop buffer reference example.
[SECTION .text]
global _start
_start:
jmp short load ; jump to call
shellcode:
pop ebx ; save the string address
; stackbuffer_x86-intel.s - Stack buffer example.
; Build string on the stack: "ABCDEFG"\x00
[SECTION .text]
global _start
_start:
push 0xFF474645 ; 'EFG'<pad> in little endian
push 0x44434241 ; 'ABCD' in little endian
inc byte [esp+7] ; null terminate 'ABCDEFG'