Skip to content

Instantly share code, notes, and snippets.

View 17twenty's full-sized avatar

Nick Glynn 17twenty

View GitHub Profile
@17twenty
17twenty / eclipse.desktop
Created February 6, 2014 22:09
Downloaded eclipse for Android but doesn't appear in Gnome Shell fix - you will need to save this into a file /usr/share/applications/eclipse.desktop
[Desktop Entry]
Type=Application
Version=22.3
Name=eclipse | Android Developer Tools
GenericName=Integrated Development Environment for Android
Comment=A powerful IDE
Exec=/home/nick/adt-bundle-linux-x86-20131030/eclipse/eclipse
Icon=/home/nick/adt-bundle-linux-x86-20131030/eclipse/icon.xpm
Terminal=false
Categories=GTK;Development;IDE;
@17twenty
17twenty / pythonrc
Created March 13, 2014 19:47
Python autocomplete
#!/usr/bin/env python
"""
Set the PYTHONSTARTUP environment variable in our .bashrc (or .bash_profile if you're using that). If the PYTHONSTARTUP variable is set to a readable file, then the contents of that file will be run before anything else when the interactive interpreter is run
echo "export PYTHONSTARTUP=~/.pythonrc" >> .bashrc
"""
import rlcompleter, readline
readline.parse_and_bind('tab:complete')
@17twenty
17twenty / bst.py
Created March 18, 2014 17:24
Got asked about a Binary Search Tree so this is my lazy implementation
#!/usr/bin/env python
class BST():
value = None
left = None
right = None
def __init__(self, value=None):
self.value = value
@17twenty
17twenty / gist:9661270
Last active August 29, 2015 13:57
Force Python to compile to pyc
python -m compileall stackBlown.py
# You could also do this programatically
# >>> import py_compile
# >>> py_compile.compile('stackBlown.py')
#
# Note that you need to use Python to run the pyc file as it's not an executable
#
# The dis module would even let you pull the resultant bytecode back out again!
/* Shellcode from repo.shell-storm.org/shellcode
* 17twenty/Nick Glynn
*/
#include <stdio.h>
#include <string.h>
#if __x86_64__
/*
* ;rdi 0x4005c4 0x4005c4
@17twenty
17twenty / gist:10890267
Created April 16, 2014 15:02
A walkthrough of how to get a shell on Level 4 of Stripes CTF 1.0
We're going to use the code from Stripe's Capture the Flag 1.0:
----------------------8<-----------------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void fun(char *str)
{
char buf[1024];
@17twenty
17twenty / ethercomm.c
Created April 20, 2014 15:57
Backdoors... backdoors everywhere!
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_arp.h>
#include <arpa/inet.h>
@17twenty
17twenty / output.log
Created May 20, 2014 11:19
Output from level10 of smashthestack
level10@io:~$ python /tmp/runme.py
/levels/level10: relocation error: /levels/level10: symbol _gmon_start__, version GLIBC_2.1 not defined in file libc.so.6 with link time reference
/levels/level10: relocation error: /levels/level10: symbol _start__, version GLIBC_2.1 not defined in file libc.so.6 with link time reference
/levels/level10: symbol lookup error: /levels/level10: undefined symbol: strcmp, version GLIBC_2.2.4
Inconsistency detected by ld.so: dl-runtime.c: 87: _dl_fixup: Assertion `((reloc->r_info) & 0xff) == 7' failed!
*** glibc detected *** /levels/level10: double free or corruption (!prev): 0x0804a008 ***
======= Backtrace: =========
/lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x70f01)[0xb7edff01]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(+0x72768)[0xb7ee1768]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(cfree+0x6d)[0xb7ee48ad]
@17twenty
17twenty / learn_something_new.c
Created May 23, 2014 14:46
Learn something new about passing arrays, and how awful the syntax can be :D
/* gcc -std=c99 due to loop initialiser - stupid GCC defaulting to C89 :( */
#include <stdio.h>
#define ARRAY_SIZE(x) \
((sizeof(x) / sizeof(x[0])))
void count_and_process_items(unsigned int (*array)[10])
{
for (int i = 0; i < ARRAY_SIZE(*array); ++i) {
printf("Item %d = %d\n", i, (*array)[i]);
@17twenty
17twenty / lazyrename.sh
Created June 13, 2014 10:00
Quick Suffix rename script
# Replace the .sh and .txt in the next line with the current and future file suffixes
for i in $(find . -iname *\.sh -print;) ; do mv "$i" "$(dirname $i)/$(basename -s .sh $i).txt"; done