Skip to content

Instantly share code, notes, and snippets.

View mcdulltii's full-sized avatar
🈳
Bored

Aaron mcdulltii

🈳
Bored
View GitHub Profile
@mcdulltii
mcdulltii / debug.hpp
Created April 13, 2022 05:53
Debugging C++ Template
#pragma once
#include <iostream>
#define debug(a) debug_out(a,0)
template<class T> void debug_out(T a,size_t b){
std::cout<<"0x";
std::cout.width(16);
std::cout.fill('0');
std::cout<<std::hex<<(((size_t *) &b)[3])<<" ";
std::cout<<std::dec;
@mcdulltii
mcdulltii / hello_world.c
Created April 13, 2022 05:48
printf shenanigans
#include <stdio.h>
void print(char* str, char s[static printf("%s", str)]) { }
int main() {
print("hello", "");
print(" ", "");
print("world", "");
}
@mcdulltii
mcdulltii / song.c
Created April 12, 2022 07:39
Twelve Days Of Christmas
#include <stdio.h>
int main(int t,int _,char *a)
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
@mcdulltii
mcdulltii / memcpy.c
Created April 12, 2022 07:36
Duff's device
void send(register short *to, register short *from, register count) {
register n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
@mcdulltii
mcdulltii / run_shellcode.py
Created March 31, 2022 14:06
A simple script for executing shellcode in Python (as opposed to C)
#!/usr/bin/python
import ctypes
# Shellcode
# x86/shikata_ga_nai succeeded with size 227 (iteration=1)
# Metasploit windows/exec calc.exe
shellcode = bytearray(
"\xdb\xc3\xd9\x74\x24\xf4\xbe\xe8\x5a\x27\x13\x5f\x31\xc9"
"\xb1\x33\x31\x77\x17\x83\xc7\x04\x03\x9f\x49\xc5\xe6\xa3"
"\x86\x80\x09\x5b\x57\xf3\x80\xbe\x66\x21\xf6\xcb\xdb\xf5"
@mcdulltii
mcdulltii / pwntools_doc.md
Created March 1, 2022 15:17
Pwntools Bruteforce func

pwnlib.util.iters

pwnlib.util.iters.bruteforce(func, alphabet, length, method = 'upto', start = None)[source]

Bruteforce func to return True. func should take a string input and return a bool(). func will be called with strings from alphabet until it returns True or the search space has been exhausted.

The argument start can be used to split the search space, which is useful if multiple CPU cores are available. Parameters:

func (function) – The function to bruteforce.

@mcdulltii
mcdulltii / octal_x86.txt
Created February 18, 2022 12:34 — forked from seanjensengrey/octal_x86.txt
x86 is an octal machine
# source:http://reocities.com/SiliconValley/heights/7052/opcode.txt
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@mcdulltii
mcdulltii / input.txt
Created December 18, 2021 17:08
AOC 2021 Day 18
[[2,[2,[4,0]]],[6,1]]
[[3,[4,[2,4]]],[[6,9],[6,1]]]
[7,[8,[8,[0,8]]]]
[[[[2,9],5],5],[[[0,1],8],[[7,9],5]]]
[[[[3,0],[7,0]],[[9,6],[1,9]]],4]
[[[0,[4,8]],8],[[[2,1],9],6]]
[[[5,[7,7]],[[9,6],2]],[[[5,8],8],0]]
[[0,3],[[8,2],[6,[2,2]]]]
[[[9,0],[4,[4,7]]],[7,[[9,1],9]]]
[0,[7,[1,1]]]
@mcdulltii
mcdulltii / ida_bigblocks.py
Last active October 3, 2024 14:25
IDA Python3 Scripts
from idaapi import *
from idc import *
from idautils import *
from math import ceil
# https://synthesis.to/2021/08/10/obfuscation_detection.html
def calc_average_instructions_per_block(address):
func_flowchart = FlowChart(get_func(address))
# number of basic blocks
@mcdulltii
mcdulltii / generate.py
Last active June 6, 2021 09:24
Random Sequence Generation using Recursion
import numpy as np
import random, sys
sys.setrecursionlimit(10**6)
class linkedseq:
def __init__(self, M, K):
# N: Length of sequence to generate
# K: Constraint for index generation
N = len(M)