Skip to content

Instantly share code, notes, and snippets.

View mvanotti's full-sized avatar
🐦
Nobody knows anything about horses

Marco Vanotti mvanotti

🐦
Nobody knows anything about horses
View GitHub Profile
#include <assert.h>
#include <limits.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
uint64_t g_addr;
@mvanotti
mvanotti / checker.sh
Created November 13, 2022 21:02
Solver for SECCON Quals 2022, txtchecker misc challenge
#!/bin/bash
read -p "Input a file path: " filepath
file $filepath 2>/dev/null | grep -q "ASCII text" 2>/dev/null
# TODO: print the result the above command.
# $? == 0 -> It's a text file.
# $? != 0 -> It's not a text file.
exit 0
@mvanotti
mvanotti / minimizer.rs
Created June 3, 2021 06:05
Quick and Dirty crash minimizer
// Quick and Dirty Crash Minimizer.
// Usage: minimize input output -- program_invocation program_flags FILE
// The program has to crash with either SIGSEGV or SIGABRT.
use log::{debug, info};
use nix::sys::ptrace;
use nix::sys::signal::Signal;
use nix::sys::wait::{waitpid, WaitStatus};
use nix::unistd::Pid;
use rand::prelude::SliceRandom;
use std::collections::HashSet;
#!/bin/sh
#
# Example script for configuring and compiling Bochs on Linux for Windows.
#
CC="x86_64-w64-mingw32-gcc"
CXX="x86_64-w64-mingw32-g++"
CFLAGS="-O3 -Wall -Wno-format -mno-ms-bitfields"
CXXFLAGS="$CFLAGS"
WINDRES="x86_64-w64-mingw32-windres"
@mvanotti
mvanotti / alpine-musl.supp
Created March 28, 2021 00:23
Valgrind suppressions for valgrind 3.15 running on alpine linux with musl. See https://bugs.kde.org/show_bug.cgi?id=426751. See also https://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto
{
"Sup 3 test"
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
obj:/lib/ld-musl-x86_64.so.1
fun:__dls3
obj:*
obj:*
obj:*
@mvanotti
mvanotti / asan-poisoning.cc
Last active January 26, 2021 05:13
kasan exchange stacks
/**
This code is useful for moments when the stack might be corrupted.
On the first asan panic, asan will disable further panics and switch
to a new stack.
*/
// ktl::atomic<bool> g_asan_panic = false;
// uint8_t kasan_panic_stack[4096];
if (g_asan_panic.exchange(true)) {
@mvanotti
mvanotti / cc-files-in-db
Created April 16, 2020 20:01
This gist contains two list of files: `compile_commands` groups the files listed in the compile_commands after building fuchsia, and `cc-files-in-db` lists all the cc files that appear in the database created by codeQL.
/build/tools/json_merge/json_merge.cc
/build/tools/json_merge/main.cc
/build/tools/json_merge/test.cc
/build/tools/json_validator/main.cc
/examples/dotmatrix_display/create_ssd1306.cc
/examples/dotmatrix_display/fuchsia_logo.cc
/examples/dotmatrix_display/main.cc
/examples/dotmatrix_display/space_invaders.cc
/examples/fidl/echo_client/cpp/main.cc
/examples/fidl/echo_server/cpp/main.cc
@mvanotti
mvanotti / codeql-database-analyze-output.log
Created February 2, 2020 03:01
codeql database analyze output
Writing logs to /home/user/codeql-home/fuchsia-ql/log/database-analyze-20200129.111407.684.log.
Running queries.
Writing logs to /home/user/codeql-home/fuchsia-ql/log/execute-queries-20200129.111408.306.log.
Expanding query suite /home/user/codeql-home/ql/cpp/ql/src/codeql-suites/cpp-lgtm-full.qls.
Suite description = Standard LGTM queries for C/C++, including ones not displayed by default
Scanning for QL files at /home/user/codeql-home/ql/cpp/ql/src.
Found 553 QL files in /home/user/codeql-home/ql/cpp/ql/src.
Scanning for qlpack.yml from /home/user/codeql-home/
Scanning for qlpack.yml from /home/user/codeql-home/codeql/.codeqlmanifest.json
Scanning for qlpack.yml from /home/user/codeql-home/ql/.codeqlmanifest.json
@mvanotti
mvanotti / automated.py
Created January 24, 2019 17:22 — forked from MatthewWilkes/automated.py
Extract deleted commits from a GitHub repo
import argparse
import os
import re
import subprocess
import tempfile
import requests
def get_repo(owner, repo):
@mvanotti
mvanotti / main.cpp
Created October 21, 2017 03:46
UVA Problem 11974 - Switch The Lights
#include <algorithm>
#include <queue>
#include <vector>
#include <stdio.h>
#include <string.h>
#define MAX_ELEMS 1 << 16
static bool visited[MAX_ELEMS] = {false};