Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Exams! Run for your lives!

László Baráth Sasszem

🏠
Exams! Run for your lives!
View GitHub Profile
@Sasszem
Sasszem / xstrings.py
Created May 15, 2021
Like strings, but also searches (and bruteforces) single-byte XOR. Might be useful for CTFs. Uses click!
View xstrings.py
#!/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 / bf.py
Created Apr 25, 2021
Simple BF interpreter to test the new 3.10 pattern matching
View bf.py
"""
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 / switch.js
Created Apr 17, 2021
A simple experiment with JS switch-case statements
View switch.js
/*
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 / ledremote.ino
Created Mar 17, 2021
Minimal example that shows tne basics of remote-controlled electornics
View ledremote.ino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#ifndef STASSID
#define STASSID "MY-SSID"
#define STAPSK "PASSWORD"
#endif
@Sasszem
Sasszem / cursedheap.c
Created Dec 21, 2020
Some weird dynamic memory stuff, but looks like secure...
View cursedheap.c
#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 / otp.c
Last active Dec 18, 2020
OTP passwords! You can't hack it!
View otp.c
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
/*
##########
# SOLVES #
##########
- sparrow
@Sasszem
Sasszem / pwnme.c
Last active Jan 28, 2021
Pwn me - do not modify the source, but make it print the "you won" text! Use Linux/WSL!
View pwnme.c
#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 / interpret.c
Last active Dec 18, 2020
Easy one this time. Give an input that makes it print "you won"!
View interpret.c
#include <stdio.h>
/*
##########
# Solves #
##########
- (Derisis13) nope, OBOE, fixed it just after K0B4MB1
- K0B4MB1
- sparrow
@Sasszem
Sasszem / guess.hs
Last active Dec 16, 2020
Super-simple number guessing game in Haskell. Took me a day or so to make... Needs 'random' package!
View guess.hs
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 / message.c
Created Dec 8, 2020
Last programming assignment in the semester: write a program that prints what we liked to STDOUT and what we did not to STDERR. (in Hungarian)
View message.c
#include <stdint.h>
#include <stdio.h>
uint64_t csoeoe(uint64_t thatFirstParam, uint64_t paramNumberOne, uint64_t dQw4w9WgXcQ) {
return (int64_t)(((__int128_t)thatFirstParam*paramNumberOne)%dQw4w9WgXcQ);
}
uint64_t fueuetoeoecsoeoe(uint64_t ZWxzb1BhcmFtZXRlcg, uint64_t bWFzb2Rpa1BhcmFtZXRlcg, uint64_t dXRvbHNvUGFyYW1ldGVy)
{
uint64_t dmFsYW1pUmFuZG9tVmFsdG96bw = 1;