Skip to content

Instantly share code, notes, and snippets.

View Vbitz's full-sized avatar

Joshua Scarsbrook Vbitz

View GitHub Profile
@Vbitz
Vbitz / new_boot.star
Last active April 26, 2024 06:57
Starlark script to handle basic init including networking for a Linux system.
def init(ctx):
# Mount /proc filesystem.
linux_mount("proc", "proc", "/proc", ensure_path = True)
# Mount other filesystems.
linux_mount("devtmpfs", "devtmpfs", "/dev", ensure_path = True)
linux_mount("sysfs", "none", "/sys", ensure_path = True)
linux_mount("cgroup2", "cgroup2", "/sys/fs/cgroup")
linux_mount("bpf", "/bpf", "/sys/fs/bpf")
linux_mount("debugfs", "debugfs", "/sys/kernel/debug", ignore_error = True)
@Vbitz
Vbitz / search_by_hash.py
Created April 12, 2024 01:42
CVMFS repo indexer and search by content hash.
import urllib.parse
import urllib
import requests
import os.path
import zlib
import sqlite3
from struct import pack
import csv
import hashlib
from subprocess import check_output
# structcompile.py
# Joshua Scarsbrook (@jscarsbrook@infosec.exchange)
# Very horrible code.
# License: Apache-2.0
import argparse
import pycparser # Install with pip install pycparser
ast = pycparser.c_parser.c_ast
@Vbitz
Vbitz / iso9660.struct
Created January 5, 2024 04:45
Declarative Struct Format
# iso 9660
type strA string
type strD string
struct int32_lsb_msb {
lsb i32_le
msb i32_be
}
@Vbitz
Vbitz / run.sh
Created December 15, 2023 02:39
Glasgow script capable of reading and writing to SD Cards.
#!/bin/bash
# SS_EEPROM (Chip Select) Pin 2
# 3.3v -
# MISO (CIPO) Pin 0
# SCK (SCK) Pin 3
# GND -
# MOSI (COPI) Pin 1
set -x
@Vbitz
Vbitz / scenario.star
Created July 6, 2023 08:20
Cute little self-contained TinyRange scenario for downloading and compiling SIMH and a Mini-UNIX distribution. Based on the instructions at https://www.tavi.co.uk/unixhistory/mini-unix.html
"""
A cute little self-contained demo to demonstrate running Mini-Unix on a PDP-11.
"""
vm1 = main.add_vm(
"vm1",
ram = 512,
arch = "host",
accelerate = True,
login_script = """
@Vbitz
Vbitz / LICENSE
Created April 26, 2023 01:35
Github Star and Follow spidering script. Warning very hackish.
Copyright 2023 Joshua D. Scarsbrook
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
This file has been truncated, but you can view the full file.
edge TypeScript/src/compiler/corePublic.ts:3:17 5xcrr910ss4
node TypeScript/src/compiler/corePublic.ts:3:17 255 255 255 2
edge TypeScript/src/compiler/corePublic.ts:7:17 5xcrr910ss4
node TypeScript/src/compiler/corePublic.ts:7:17 255 255 255 2
edge TypeScript/src/compiler/corePublic.ts:15:9 5xcrr910ss4
node TypeScript/src/compiler/corePublic.ts:15:9 255 255 255 2
edge TypeScript/src/compiler/corePublic.ts:29:12 5xcrr910ss4
node TypeScript/src/compiler/corePublic.ts:29:12 255 255 255 2
edge TypeScript/src/compiler/corePublic.ts:35:15 5xcrr910ss4
node TypeScript/src/compiler/corePublic.ts:35:15 255 255 255 2
@Vbitz
Vbitz / viralProxies.ts
Created February 23, 2020 13:36
Spreading Proxies for JavaScript.
/*
Copyright 2020 Joshua D Scarsbrook
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@Vbitz
Vbitz / hexdump.ts
Last active January 28, 2024 15:25
Simple node.js hexdump function written in TypeScript.
function printValue(value: number): string {
if (value >= 0x20 && value <= 0x7e) {
return String.fromCharCode(value);
} else {
return '.';
}
}
export function hexDump(buff: Buffer): string {
let x = 0;