Skip to content

Instantly share code, notes, and snippets.

View mrpapercut's full-sized avatar

Mischa Rodermond mrpapercut

View GitHub Profile
@mrpapercut
mrpapercut / raw-dns-req.py
Last active July 12, 2025 19:13
Raw DNS requests with python
#!/usr/bin/env python3
import binascii
import socket
import sys
from collections import OrderedDict
# See https://web.archive.org/web/20180919041301/https://routley.io/tech/2017/12/28/hand-writing-dns-messages.html
# See https://tools.ietf.org/html/rfc1035
@mrpapercut
mrpapercut / shell.php
Last active May 19, 2025 08:35
Interactive PHP webshell
<?php
function escapetext($text) {
return str_replace("\n", "<br>", htmlentities($text));
}
function exec_command($cmd, $internal = false) {
try {
$shell_exec = shell_exec($cmd);
} catch (Exception $e) {
@mrpapercut
mrpapercut / UnicodeBlocks.json
Created May 16, 2021 16:26
JSON object of all Unicode blocks
/* "<name of block>": [<start of block>, <end of block>] */
{
"Basic Latin": [0x0000, 0x007F],
"Latin-1 Supplement": [0x0080, 0x00FF],
"Latin Extended-A": [0x0100, 0x017F],
"Latin Extended-B": [0x0180, 0x024F],
"IPA Extensions": [0x0250, 0x02AF],
"Spacing Modifier Letters": [0x02B0, 0x02FF],
"Combining Diacritical Marks": [0x0300, 0x036F],
"Greek and Coptic": [0x0370, 0x03FF],
class NumberFormatter {
constructor() {
}
toDec(numstr) {
return parseInt(numstr, 10).toString(10);
}
toHex(numstr) {
@mrpapercut
mrpapercut / createElement.js
Last active September 30, 2023 00:52
ES6-only createElement function
const createElement = (tagname = '') => {
return (...content) => {
const el = document.createElement(tagname);
if (content[0] instanceof Object && !(content[0] instanceof HTMLElement)) {
let attributes = content.shift();
for (let attr in attributes) {
switch (attr) {
case 'events':
@mrpapercut
mrpapercut / bitstringToBigInt.js
Created March 30, 2023 08:22
Javascript bitstring to BigInt
const bitstringToBigInt = bstr => {
let counter = 0n;
let byteindex = 0n;
for (let i = bstr.length - 1; i >= 0; i--) {
if (bstr[i] === '1') {
counter += 2n**byteindex;
}
byteindex++;
@mrpapercut
mrpapercut / app.js
Last active September 29, 2023 17:15
Chrome Packaged App example
/*
* Javascript goes here
*/
@mrpapercut
mrpapercut / 01.Callable_COM_Objects.txt
Last active September 29, 2023 13:22
Callable & uncallable COMObjects in wscript/cscript
// The following COMobjects are all callable in cscript with WScript.CreateObject(COMObject)
ADODB.Command is callable!
ADODB.Command.6.0 is callable!
ADODB.Connection is callable!
ADODB.Connection.6.0 is callable!
ADODB.Error is callable!
ADODB.Error.6.0 is callable!
ADODB.Parameter is callable!
ADODB.Parameter.6.0 is callable!
ADODB.Record is callable!
@mrpapercut
mrpapercut / 01. T5KParser.php
Last active April 6, 2023 08:33
T5K primelist parser
<?php
class T5KParser {
private $primelistURL = 'https://t5k.org/primes/lists/all.txt';
private $primelistRaw;
public $primes = [];
public $proofcodes = [];
public function parse() {
This file has been truncated, but you can view the full file.