Skip to content

Instantly share code, notes, and snippets.

View abeaumont's full-sized avatar

Alfredo Beaumont abeaumont

View GitHub Profile
@abeaumont
abeaumont / dispatch-benchmarks.dylan
Created March 28, 2013 08:28
dispatching benchmark in Dylan
module: dispatch-benchmarks
define open abstract class <my-collection> (<object>)
end class <my-collection>;
define open generic my-element (collection :: <my-collection>, n :: <integer>) => (nth :: <object>);
define method my-element
(collection :: <my-collection>, n :: <integer>)
=> (nth :: <object>)
@abeaumont
abeaumont / hitcon-polyglot
Created August 18, 2014 12:50
Hitcon CTF 2014 polyglot (C, Python 2, Python 3, Ruby, Haskell)
a={-1//1,""""/=>3}
#if 0
BEGIN { puts `cat flag`; exit; }
__END__
"""} # "
import os; os.system('cat flag')
""" # "
#endif
};
main () { system("cat flag"); } /* -} 0
@abeaumont
abeaumont / tlang.lisp
Last active August 29, 2015 14:12
Solution for TLang problem, (ab)using reader macros https://contest.tuenti.net/resources/2011/Question_2.html
(defun transform-expr (expr)
(if (symbolp expr)
(let ((s (symbol-name expr)))
(cond ((string-equal s "=") '+)
((string-equal s "@") '-)
(t expr)))
expr))
(defun read-next-object (delimiter &optional (stream *standard-input*))
(if (and delimiter (char= (peek-char t stream t nil t) delimiter))
module: string-aref-test
define function main ()
let t = "abcdefg";
let (a, b) = method() values(t[2], 'c') end();
format-out("%= %=\n", a, b);
let (c, d) = values(t[2], 'c');
format-out("%= %=\n", c, d);
let x = #[1, 2, 3, 4];
let (e, f) = method() values(x[2], 'c') end();
@abeaumont
abeaumont / catch.c
Created May 10, 2016 22:01
Solution for Catch Me challenge in ASIS CTF 2016 Quals
#include <stdio.h>
int is_valid(unsigned char c) {
return c == 0 || c == 45 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c == 95 || c >= 97 && c <= 122;
}
int main () {
unsigned char h1[17] = {0x87, 0x29, 0x34, 0xC5, 0x55, 0xB0, 0xC2, 0x2D, 0xEE, 0x60, 0x34, 0xD4, 0x55, 0xEE, 0x80, 0x7C, 0};
unsigned char h2[17] = {0xEE, 0x2F, 0x37, 0x96, 0x3D, 0xEB, 0x9C, 0x79, 0xEE, 0x2C, 0x33, 0x95, 0x78, 0xED, 0xC1, 0x2B, 0};
from pwn import *
for i in range(512, 768):
t = remote('xkcd_be4bf26fcb93f9ab8aa193efaad31c3b.quals.shallweplayaga.me', 1354)
t.send('SERVER, ARE YOU STILL THERE? IF SO, REPLY "' + 'A' * 512 + '" ({} LETTERS)\n'.format(i))
print t.recvline()
t.close()
@abeaumont
abeaumont / memory-addressing.py
Created August 11, 2016 23:05
Get memory addressing mode stats from a binary
#!/usr/bin/env python
import sys
from collections import Counter
from elftools.elf.elffile import ELFFile
from capstone import *
from capstone.x86 import *
def get_binary(file: str) -> (bytes, int):
with open(file, 'rb') as stream:
@abeaumont
abeaumont / C.pi
Last active May 1, 2017 08:58
GCJ 2017 Round 1C. Problem C. Core Training
import util, mip.
go(T, N, K, U, Xs) =>
X = new_array(N),
X :: 0.0..1.0,
foreach(I in 1..N)
X[I] #>= Xs[I],
X[I] #<= Xs[I] + U
end,
sum(X) #<= sum(Xs) + U,
public class A{public static void x(){
if(0){
if(0){
if(0){
if(0){
if(0){
if(0){
if(0){
if(0){
if(0){
if 0:
if 0:
if 0:
if 0:
if 0:
if 0:
if 0:
if 0:
if 0:
if 0: