This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |