Skip to content

Instantly share code, notes, and snippets.

@wilfreddv
wilfreddv / config.py
Created October 18, 2020 21:25
Record and visualize keyboard and mouse
FPS = 20
#ISIZE = 1280, 720
ISIZE = 1920, 1080
TRAIL_FADE = 0.93 # 1.0 - no fade, 0.0 - immediate fade
GAMMA = 0.1
RADIUS_F = 30
DEVIATION = 45
@wilfreddv
wilfreddv / histogram.c
Last active September 8, 2021 15:21
Print a histogram
#include <stdio.h>
#include <string.h>
#include <limits.h>
static inline unsigned _max(unsigned values[], unsigned length) {
unsigned max = 0;
for(unsigned i = 0; i < length; i++) max = max > values[i] ? max : values[i];
return max;
}
@wilfreddv
wilfreddv / README.md
Created December 28, 2021 12:11
RPN Calculator

rpn-calculator

Calculator for equations in the Reversed Polish Notation

Usage

$ ./main.py
//Your calculation goes here
//The output will be printed here

STB 2018 Writeup

This is a write-up of the 2018 STB challenge: https://github.com/securifybv/spotthebug/tree/master/STB_2018

When first opening the repository, I see two interesting files; a PHP file, and a C++ file.

The C++ file: quick overview

The C++ has a BaseCGIClass (which has no functionality), and two children classes of the BaseCGIClass. I immediately notice the std::system call in the Executor class. The Logger class seems to not have any potential side effects. In the main function, I assume the Cgicc is an interface for the CGI protocol. This means formData("encryptedData") likely returns user input. We can control this.

@wilfreddv
wilfreddv / timedinput.py
Last active June 12, 2023 20:37
Timed input in Python for Linux systems
from contextlib import contextmanager
import signal, sys, termios, atexit, tty
class CTLSEQ:
"""
Condensed from https://github.com/wilfreddv/HB/blob/main/hbutil/hbutil/termctl.py
Define common ANSI escape
code control sequences