Skip to content

Instantly share code, notes, and snippets.

View Sasszem's full-sized avatar
💥
Burning the dynamite at both ends

László Baráth Sasszem

💥
Burning the dynamite at both ends
  • Szolnok, Hungary
View GitHub Profile
@Sasszem
Sasszem / guess.hs
Last active December 16, 2020 17:12
Super-simple number guessing game in Haskell. Took me a day or so to make... Needs 'random' package!
import Text.Read (readMaybe)
import System.Random
import System.IO
readGuess :: Integer -> IO Integer
readGuess no = do
let str = "Please enter your " ++ show no ++ "th guess:"
putStr str
hFlush stdout -- need that coz we don't print a \n
name <- getLine
@Sasszem
Sasszem / interpret.c
Last active December 18, 2020 17:52
Easy one this time. Give an input that makes it print "you won"!
#include <stdio.h>
/*
##########
# Solves #
##########
- (Derisis13) nope, OBOE, fixed it just after K0B4MB1
- K0B4MB1
- sparrow
@Sasszem
Sasszem / pwnme.c
Last active January 28, 2021 01:15
Pwn me - do not modify the source, but make it print the "you won" text! Use Linux/WSL!
#include <stdio.h>
int main() {
long admin = 0;
long s;
char name[100];
fprintf(stdout, "\e[41mDEBUG:\e[49m %p\n", &s);
fprintf(stdout, "\e[41mDEBUG:\e[49m %ld %ld\n", sizeof s, sizeof &s);
printf("Whats ur name? ");
scanf("%100s", name);
@Sasszem
Sasszem / otp.c
Last active December 18, 2020 18:02
OTP passwords! You can't hack it!
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
/*
##########
# SOLVES #
##########
- sparrow
@Sasszem
Sasszem / cursedheap.c
Created December 21, 2020 13:54
Some weird dynamic memory stuff, but looks like secure...
#include <stdio.h>
#include <stdlib.h>
int main() {
int* state = (int*) calloc(sizeof(int),1024);
int* admin_flag = &state[1023];
*admin_flag = 0;
free(state);
char* str = malloc(4096);
@Sasszem
Sasszem / ledremote.ino
Created March 17, 2021 12:47
Minimal example that shows tne basics of remote-controlled electornics
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#ifndef STASSID
#define STASSID "MY-SSID"
#define STAPSK "PASSWORD"
#endif
@Sasszem
Sasszem / switch.js
Created April 17, 2021 10:30
A simple experiment with JS switch-case statements
/*
Test on how are JS's switch-cases are working.
I was in an argument w/ someone saying they turn into jumptables,
so I coded this up quickly to check.
With a few calls (so JIT won't kick in) it is clear that this executes
every case every time we enter the switch, so it is clear that jump tables
are not used in general, but they still might be used as an optional optimization,
but only when possible.
*/
@Sasszem
Sasszem / bf.py
Created April 25, 2021 20:49
Simple BF interpreter to test the new 3.10 pattern matching
"""
BF interpreter in python, coded in half an hour just for fun
Warning! Python 3.10 is required!
"""
from sys import stdin, stdout
class BFPreter:
"""BD interpreter for a program"""
def __init__(self, program):
@Sasszem
Sasszem / xstrings.py
Created May 15, 2021 15:14
Like strings, but also searches (and bruteforces) single-byte XOR. Might be useful for CTFs. Uses click!
#!/bin/env python3
"""
import subprocess
def strings(data):
process = subprocess.Popen(["strings"], stdin=subprocess.PIPE,stdout=subprocess.PIPE)
print("Created process")
process.stdin.write(data)
process.stdin.close()
@Sasszem
Sasszem / unfucker.py
Created August 10, 2021 10:49
RPGMAKER 2k(3) "protection" unfucker so you can open games in the editor
import os
EXTENSIONS = ("lmu", "ldb", "lmt")
GOOD_DATA = {
"lmu": b"\x0aLcfMapUnit",
"ldb": b"\x0BLcfDataBase",
"lmt": b"\x0aLcfMapTree",
}