Skip to content

Instantly share code, notes, and snippets.

View selenologist's full-sized avatar

Luna Langton selenologist

  • New South Wales, Australia
View GitHub Profile
@selenologist
selenologist / ovh-ideal-brute.py
Created November 27, 2019 05:42
Simple brute force of ideal amount of credits to add to OVH public cloud that minimises wasted credits with a monthly service
# OVH only lets you add integer values of credits at a time,
# but credits expire 13 months after being purchased.
# So, given the monthly cost of the service and a current balance of credits
# (possibly smaller than the monthly cost) there exists an amount of added credits
# that will yield the lowest amount of leftover credits when the the balance becomes
# lower than the monthly cost.
#
# There's probably a smarter way to do this but this is computationally cheap enough that I
# really don't care.
/* Ported to ARM by @Selenologist */
/*
* CVE-2016-5195 dirtypoc
*
* This PoC is memory only and doesn't write anything on the filesystem.
* /!\ Beware, it triggers a kernel crash a few minutes.
*
* gcc -Wall -o dirtycow-mem dirtycow-mem.c -ldl -lpthread
*/
@def-
def- / offset.nim
Last active September 10, 2020 16:47
template offset(Typ, member): int {.immediate.} =
var dummy: Typ
cast[int](dummy.member.addr) -% cast[int](dummy.addr)
type Foo = object
x: int
y: int
echo offset(Foo, y)