Skip to content

Instantly share code, notes, and snippets.

@vitapluvia
vitapluvia / merge-sort.py
Created October 12, 2016 06:56
Merge Sort (Small)
#!/usr/bin/env python
def mergeSortB(a):
mid = (len(a) - 1) / 2
m = lambda a,b: [a.pop(0) if a[0] < b[0] else b.pop(0) for x in range(len(a)*len(b)) if a and b] + a + b
return a if len(a) <= 1 else m(m(mergeSortB(a[:mid]), [a[mid]]), mergeSortB(a[mid+1:]))
def main():
a = [314, 1, 2, 88, 919]
print mergeSortB(a)
@vitapluvia
vitapluvia / codegate-2016-cemu-solve.py
Created March 17, 2016 01:01
Codegate 2016 CTF Quals - cemu (512)
#!/usr/bin/env python
import commands
from pwn import *
HOST = "175.119.158.136"
# HOST = "175.119.158.132"
PORT = 31337
c = remote(HOST, PORT)
@vitapluvia
vitapluvia / simple-mms-server.js
Created September 8, 2015 04:43
MMA CTF 2015 - Stream... Single File Server
m=require; m('http').createServer(function(_, r) {r.end(m('fs').readFileSync("extracted"))}).listen(4444);
@vitapluvia
vitapluvia / splittedZip.py
Created September 8, 2015 03:36
Solution for Splitted (30) from MMACTF 2015
#!/usr/bin/python
FILE = 'outFile.zip'
HEXVALS = [
"504b0304140000000800479b2447c2f74289fb0d00002dd3000008001c00666c61672e7073645554090003c571e955c871e95575780b000104e803000004e8030000ed9a7b74147596c76f757577121e91b770801d7555149db11d4139bb2228e8448687333c9c338e8a83800fc488b0725c4609516771d05189b20a0e2a28f81a71005dcf82ba0e8aeeaae88c22b01802092440027975fadddffd5655777575e230fc31e764cfeecdc7a4bb7e75effdfdbef7f7acc211575c33590c717e4c11e33111df6229b4bedb3f43475c71f504b3c1fede434af8d720994feb9edfb1f3597f9e59c9df15ce77e72713cf0f889cfb23aba4d707567dfcebb3fe5a11e6de39ef0e38e6a1ac5fb7eaf2d7aa97acad2ee77f5b786dd9cd5930f756eb167ffda1fad0da504d28d9a126f3afd67166d6235857beecd0d36f7863175a4a167f3aeb4efa7751fee6f495a1325e269369fc1d2f13f9b74de29236be6ff4906a3920c7a44122524f0ec9d7f2a17c22df4ad4f89e7c294d729f9c2543e41fe512b958fac9a9fced6c3dff8f291345511445f9dfc90a3103858586f5759df802850565f2a9ac14d398ba2d9c86845e1573c4e8d1ddcba455e4f6f45a19be5c821b80f0eea503cbe40bd927322cbd50fac7c4bc7ce1c2d274",
"fe6554e47bbcbcae516469c2
@vitapluvia
vitapluvia / ca.py
Last active August 29, 2015 14:19
Cellular Automata Terminal
#!/usr/bin/env python
import random
import sys
import time
import Image
#ROW_AMT = 11185
ROW_AMT = 285
COL_AMT = 290
@vitapluvia
vitapluvia / simpleShell.py
Created January 29, 2015 10:15
Simple Shell v1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cmd
ASCII = """
.-. . .-. . ..---.. . .
( ) o | ( )| || | | .'|
`-. . .--.--. .,-. | .-. `-. |---||--- | | . ._|
( ) | | | | | )|(.-' ( )| || | | \ / |
`-'-' `-' ' `-|`-' `-`--' `-' ' ''---''---''---' `' '---'
@vitapluvia
vitapluvia / carbonara_solution.py
Created April 6, 2014 04:53
Solution to Nuit Du Hack 2014 :: Crypto - "Carbonara"
#!/usr/bin/python
import random
import string
import sys
COLOR = random.randint(1, 6) # Who would do this ?
def printC(string_value, color=False):
if color:
sys.stdout.write(
@vitapluvia
vitapluvia / bin_triangles.py
Created April 2, 2014 16:07
Quick Binary Triangle Patterns
#!/usr/bin/python
from pprint import pprint
def GetTriangle(i, exp, reverse, label):
triangle = ['{:0b}'.format(i**e).replace('1','_').replace('0','|')[::-1] for e in range(1, exp)]
if reverse:
triangle = triangle[::-1]
if label:
# Add Quick Labeling:
@vitapluvia
vitapluvia / long_code_is_long.sh
Created March 14, 2014 15:33
This is a Long one.....
cat /dev/urandom | xxd -b -c 14 | cut -c 9-135 | sed 's/ //g' | sed 's/0/-/g; s/1/\\/g' | sed 's/\\\\/__/g' | sed 's/\\-\\/###/g' | sed 's/$/ ||=./g; s/^\s*/\t\t\t.=|| /g' | sed 's/#/ /g' | sed 's/- /| /g' | sed 's/---/ |/g' | egrep -i "\|-...." | sed 's/_/=/g' | sed 's/ /*-/g' | sed 's/===/ /g' | sed 's/\s*\(.*\)/\t\t\t\1\1/g' | cut -c 80-172 | sed 's/\s*\(.*\)/\t\t\t\1\1 =]/g' | cat -n | egrep -i "=|-"
@vitapluvia
vitapluvia / Carving_ASCII
Created March 4, 2014 17:16
Carving ASCII Streams from /dev/urandom
, ======================================= ,
| Carving ASCII Streams from /dev/urandom |
,======================================= '
---------------
[ A CLEAN SLATE ]
---------------
- Start with catting /dev/urandom.