Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// baby-go reconstruction
// by Aleksey
// - https://alekseyyy.github.io
// - @EpsilonCalculus / @EntropyThot
package main
import (
"fmt"
"os"
"strconv"
)
func main() {
// Good luck!
if (len(os.Args) > 1) {
input, err := strconv.Atoi(os.Args[1])
if err == nil {
if (input % 3 == 0 && input % 5 == 0) {
fmt.Println("Green")
} else if (input % 3 == 0) {
fmt.Println("Yellow")
} else if (input % 5 == 0) {
fmt.Println("Blue")
} else {
fmt.Println(input)
}
}
}
}
// fabulous reconstruction
// by Aleksey
// - https://alekseyyy.github.io
// - @EpsilonCalculus / @EntropyThot
// I stole some of my code from here...
// ... (like how brett keane stole that poem about his mum):
// https://www.thepolyglotdeveloper.com/2016/12/fibonacci-sequence-printed-golang/
package main
import (
"fmt"
"os"
"strconv"
)
func fib(k int) int {
if k <= 1 {
return k
}
return fib(k - 1) + fib(k - 2)
}
func main() {
if (len(os.Args ) > 1) {
input, err := strconv.Atoi(os.Args[1])
if err == nil {
fmt.Println(fib(input + 1))
} else {
fmt.Println("1")
}
}
}
# "Quick and dirty" tool to compare similarity between two executables.
# By Aleksey, https://alekseyyy.github.io
# - @EpsilonCalculus on Twitter/Keybase
# - @EntropyThot on decompetition.io
# "Inspired" by Malware Data Science (2018, ch. 5)
import sys
J = lambda X, Y: float(len(X.intersection(Y))) / float(len(X.union(Y)))
d_J = lambda X, Y: 1 - J(X, Y)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("please enter two disassembly strings as arguments")
sys.exit()
bin1 = sys.argv[1]
bin2 = sys.argv[2]
print("J(X, Y) =", J(bin1, bin2))
print("dJ(X, Y) =", J(bin1, bin2))
/*
* prime reconstruction
* by Aleksey (mostly with help from Ghidra's recompiler :P)
* - https://alekseyyy.github.io
* - @EpsilonCalculus / @EntropyThot
*/
#include <stdio.h>
#include <stdlib.h>
int is_prime(long n) {
// TODO...
int prime, local_c;
if ((int) n < 2)
prime = 0;
else {
if ((n == 2) || (n == 3))
prime = 1;
else {
if (((n & 1) == 0) || ((int)n % 3 == 0))
prime = 0;
else {
local_c = 5;
while (local_c * local_c < (int)n) {
if (((int)n % local_c == 0) || ((int)n % (local_c + 2) == 0))
return 0;
local_c = local_c + 6;
}
prime = 1;
}
}
}
return prime;
}
int main(int argc, char** argv) {
// IS PRIME?
int x, y;
if (argc != 2) {
fprintf(stderr, "USAGE: %s <num>\n", *argv);
exit(1);
}
x = atoi((char*) argv[1]);
y = is_prime((long)x);
printf("is_prime(%d) = %d\n", x, y);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment