Skip to content

Instantly share code, notes, and snippets.

View mcdulltii's full-sized avatar
🈳
Bored

Aaron mcdulltii

🈳
Bored
View GitHub Profile
@mcdulltii
mcdulltii / terminal-capture.md
Created January 7, 2025 08:01 — forked from worldofprasanna/terminal-capture.md
Multiple screen terminal capture using asciinema & tmux

Commands Reference

  1. Start a new tmux named session tmux new -s terminal-capture
  2. Split the screen using these commands,
  • vertical split <C-b>"
  • horizontal split <C-b>%
  1. To navigate between the panes,
  • To goto Left pane <C-b> left-key
  • To goto Right pane <C-b> right-key
  • To goto Top pane up-key
@mcdulltii
mcdulltii / Fizz_Buzz.c
Created October 23, 2023 10:21
Obfuscated Fizz Buzz
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
return (((*argv)[4] = 0) || ((!(argc%3) && printf(*argv)) + (!(argc%5) && printf((*argv)+5))) || printf("%d",argc)) != printf("\n") != argc++ < 100 && main(argc, argc);
}
@mcdulltii
mcdulltii / formulae.md
Created April 8, 2023 12:56
Magical Fibonacci Formulae
>>> f = lambda n: 3**(n*(n+1)) // (3**(2*n) - 3**n - 1) % 3**n
>>> [f(n) for n in range(10)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
>>> f=lambda n:(b:=2<<n)**n*b//(b*b-b-1)%b
>>> [f(n) for n in range(10)]
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
@mcdulltii
mcdulltii / Makefile
Created November 20, 2022 08:07
Automatically document your Makefile
help: ## show this help
@sed -ne "s/^##\(.*\)/\1/p" $(MAKEFILE_LIST)
@printf "────────────────────────`tput bold``tput setaf 2` Make Commands `tput sgr0`────────────────────────────────\n"
@sed -ne "/@sed/!s/\(^[^#?=]*:\).*##\(.*\)/`tput setaf 2``tput bold`\1`tput sgr0`\2/p" $(MAKEFILE_LIST)
@printf "────────────────────────`tput bold``tput setaf 4` Make Variables `tput sgr0`───────────────────────────────\n"
@sed -ne "/@sed/!s/\(.*\)?=\(.*\)##\(.*\)/`tput setaf 4``tput bold`\1:`tput setaf 5`\2`tput sgr0`\3/p" $(MAKEFILE_LIST)
@printf "───────────────────────────────────────────────────────────────────────\n"
# remove if you want another default.
.DEFAULT_GOAL := help
@mcdulltii
mcdulltii / compress.py
Created November 12, 2022 07:58
Compress python code using unicode
import sys
import warnings
if sys.version_info[0] != 3 or sys.version_info[1] < 10:
warnings.warn("The python interpreter may break on versions earlier than 3.10 (see https://github.com/DaCoolOne/DumbIdeas/issues/1)", stacklevel=2)
UNKNOWN_CHAR_MAP = { 0: 'Null (\\0)', 1: 'SOH', 2: 'STX', 3: 'ETX', 4: 'EOT', 5: 'ENQ', 6: 'ACK', 7: 'BEL', 8: 'Backspace (\\b)', 9: 'Tab (\\t) (Did you mean to indent with spaces?)', 11: 'Vertical Tab (\\v)', 12: 'Form Feed (\\f)', 14: 'SO', 15: 'SI', 16: 'DLE', 17: 'DC1', 18: 'DC2', 19: 'DC3', 20: 'DC4', 21: 'NAK', 22: 'SYN', 23: 'ETB', 24: 'CAN', 25: 'EM', 26: 'SUB', 27: 'ESC', 28: 'FS', 29: 'GS', 30: 'RS', 31: 'US', 127: 'DEL' }
class UnknownCharacterException(ValueError):
def __init__(self, character: int, line: int) -> None:
if character < 128:
@mcdulltii
mcdulltii / party_mode.ipynb
Created August 26, 2022 10:17 — forked from v--/party_mode.md
Achieve full runtime nondeterminism by randomly selecting which function to run
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mcdulltii
mcdulltii / HInvoke.cs
Created August 12, 2022 05:11 — forked from dr4k0nia/HInvoke.cs
A very minimalistic approach of calling .net runtime functions or accessing properties using only hashes as identifiers. It does not leave any strings or import references since we dynamically resolve the required member from the mscorlib assembly on runtime. Read the blog post: https://dr4k0nia.github.io/dotnet/coding/2022/08/10/HInvoke-and-avo…
using System.Linq;
using System.Reflection;
namespace HashInvoke;
public class HInvoke
{
public static T InvokeMethod<T>(uint classID, uint methodID, object[]? args = null)
{
// Get the System assembly and go trough all its types hash their name
@mcdulltii
mcdulltii / ms-msdt.MD
Created May 31, 2022 13:21 — forked from tothi/ms-msdt.MD
The MS-MSDT 0-day Office RCE Proof-of-Concept Payload Building Process

MS-MSDT 0-day Office RCE

MS Office docx files may contain external OLE Object references as HTML files. There is an HTML sceme "ms-msdt:" which invokes the msdt diagnostic tool, what is capable of executing arbitrary code (specified in parameters).

The result is a terrifying attack vector for getting RCE through opening malicious docx files (without using macros).

Here are the steps to build a Proof-of-Concept docx:

  1. Open Word (used up-to-date 2019 Pro, 16.0.10386.20017), create a dummy document, insert an (OLE) object (as a Bitmap Image), save it in docx.
@mcdulltii
mcdulltii / meta.php
Created May 26, 2022 14:42
Metamorphism in PHP
<?php goto l01;
l01: $filename = __FILE__; goto l02;
l02: $contents = file_get_contents($filename); goto l03;
l03: $lines = explode("\n",$contents); goto l04;
l04: $collection = array(); goto l05;
l05: $pattern = '%^[^:]+:.*goto [^;]+;$%'; goto l06;
l06: $i = 0; goto l07;
l07: /*while*/if ($i < count($lines)) goto l08; else goto l23;
l08: $line = $lines[$i]; goto l09;
l09: $line = trim($line); goto l10;
@mcdulltii
mcdulltii / queue.c
Last active May 15, 2022 15:22
Lock-free, Concurrent, Generic Queue in 32 bits
// A lock-free, concurrent, generic queue in 32 bits
//
// This is a bit of a mess since I wanted to hit many different combinations
// of implementations with the same code, especially under TSan:
//
// impl threads atom target cmd
// ---- ------- ---- ------ ----------
// GCC pthreads C11 spsc gcc -O3 -DNTHR=1 -DPTHREADS queue.c
// GCC pthreads GNU spsc gcc -O3 -std=c99 -DNTHR=1 -DPTHREADS queue.c
// GCC win32 C11 spsc gcc -O3 -DNTHR=1 queue.c