Skip to content

Instantly share code, notes, and snippets.

View novafacing's full-sized avatar
dilly dally shilly shally

Rowan Hart novafacing

dilly dally shilly shally
View GitHub Profile
@novafacing
novafacing / ago-downloader.js
Last active November 28, 2023 19:51
ago-downloader.js
const puppeteer = require("puppeteer");
const child_process = require("child_process");
const fs = require("fs");
async function sh(cmd) {
return new Promise(function (resolve, reject) {
child_process.exec(cmd, (err, stdout, stderr) => {
if (err) {
resolve(err);
} else {
@novafacing
novafacing / BUILDING_FEDORA_LINUX_KERNEL_WITH_RUST_SUPPORT.md
Last active December 12, 2023 17:28
Building the Fedora Linux Kernel with Rust Support!

Building the Fedora Linux Kernel with Rust Support

I've been using Fedora Linux for a couple years now, and this week I wanted to write a kernel module for some reasons. Of course, I try to write all software I possibly can in Rust, and Linux recently has support for writing modules, including out of tree modules, in Rust! Great, so it should be really easy, just copy the rust-out-of-tree-module Makefile and Kbuild, run make, and

@novafacing
novafacing / NOTES_ON_OOT_KMOD_WITH_BUILDROOT.md
Created November 1, 2023 18:30
Some Notes On Building Out-Of-Tree Kernel Modules With Buildroot

Note 1

Your Config.in file...it needs to have a newline after endmenu, if you have menu. So basically:

menu "Kernel Modules"
    source "$BR2_EXTERNAL_TEST_KERNEL_MODULES_PATH/package/kernel-modules/test-mod/Config.in"
endmenu
@novafacing
novafacing / RUST_OPTION_RESULT_CONVERSIONS.md
Created October 17, 2023 23:13
Rust Option/Result conversion functions

I used to have a site bookmarked with a table of all these functions, but the link is dead. Here's a matrix of Option and Result conversion functions. These become second nature once you have used Rust for any significant length of time, but it's useful to have a table reference.

For each of the below:

  • T is the value possibly contained in an input Ok Result or Some Option.
  • U is a new value created by transforming or replacing an input T. Note that when U appears in methods like map, U ?= T, for example by calling
@novafacing
novafacing / RUST_LIBRARY_NAMING.md
Last active August 31, 2023 00:31
Rust's Expected/Produced Library naming

Rust's expected/produced library naming

What rustc/your linker expects

Rust handles libraries that it links with in a somewhat "magical" way, in that if you want to link to libpixman-1.so.0 you would just write:

println!("cargo:rustc-link-lib=pixman-1");
@novafacing
novafacing / RPATH_VS_RUNPATH.md
Last active August 29, 2023 23:04
RPATH vs RUNPATH in readelf

RPATH vs RUNPATH

I'm doing some ELF parsing and I need to simulate ld.so's lookup routine (man ld.so). To do that, I need to grab RPATH as well as RUNPATH from binaries, so to test my tool I naturally need to make some binaries with each of those. Here's how you do it.

cat <<EOF > /tmp/a.c
int main(){}
EOF
# sh <(curl -L https://nixos.org/nix/install)
# nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
# ./result/bin/darwin-installer
# Go through installer, put this file where you want it
# darwin-rebuild switch -I darwin-config=${HOME}/wherever/you/put/it/configuration.nix
# There will probably be errors :)
{ config, pkgs, lib, ... }:
let
username = "novafacing";
@novafacing
novafacing / solve_mra.py
Created May 3, 2021 00:40
Solve script for MRA from Defcon 29 Quals
from pwn import *
from subprocess import run, PIPE
from pathlib import Path
import re
import random
context.arch = "arm"
context.bits = 64
PC_REG = r"\(void \(\*\)\(\)\) (0x[0-9a-f]+)"