Skip to content

Instantly share code, notes, and snippets.

View AndrewFasano's full-sized avatar

Andrew Fasano AndrewFasano

View GitHub Profile
@AndrewFasano
AndrewFasano / README.md
Last active March 14, 2023 16:49
C++ coroutine yield from

Pure C++20 coroutine example demonstrating how one coroutine can yield from another.

$ g++ -v
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
$ g++ --std=c++20 -fcoroutines -g example.cpp
$ ./a.out
            main_counter yields 0
    main[0] =>0
 main_counter yields 1
@AndrewFasano
AndrewFasano / mknod_everything.sh
Last active July 25, 2022 18:03
Make nearly every standard /dev entry using `mknod`. Specify a non-root path by editing the `$BASE` variable
This file has been truncated, but you can view the full file.
#!/bin/bash
BASE=''
mknod $BASE/dev/mem c 1 1 # Memory devices
mknod $BASE/dev/kmem c 1 2 # Memory devices
mknod $BASE/dev/null c 1 3 # Memory devices
mknod $BASE/dev/port c 1 4 # Memory devices
mknod $BASE/dev/zero c 1 5 # Memory devices
mknod $BASE/dev/core c 1 6 # Memory devices
mknod $BASE/dev/full c 1 7 # Memory devices
mknod $BASE/dev/random c 1 8 # Memory devices
@AndrewFasano
AndrewFasano / instructions.md
Last active March 10, 2020 15:20
Guide to running a raspberry PI image in PANDA

Instructions for botting a Raspberry PI image in PANDA:

These steps mostly mirror those from the great guide at https://azeria-labs.com/emulate-raspberry-pi-with-qemu/ except for how to modify the guest's fstab file.

Download and extract filesystem

$ wget http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-04-10/2017-04-10-raspbian-jessie.zip
$ unzip 2017-04-10-raspbian-jessie.zip
@AndrewFasano
AndrewFasano / map_fns_to_blocks.py
Created March 23, 2019 15:04
Ghidra plugin to map all function names in a binary to a list of the basic blocks it contains
# Print a mapping of function names to basic blocks in JSON
#@author Andrew Fasano & Brendan Dolan-Gavitt
#@category CodeAnalysis
#@keybinding
#@menupath
#@toolbar
from ghidra.program.model.block import BasicBlockModel
import json
@AndrewFasano
AndrewFasano / extract-vmlinux.sh
Created September 28, 2018 21:23
Extract vmlinux from a zimage file
#!/bin/sh
# Given a linux zimage, extract the vmlinux file. Useful for getting symbols into gdb when debugging linux kernels
# Requires binwalk for extracting the slightly malformed xz data
set -e
file=$1
# Get 2nd offset of 7zXZ
@AndrewFasano
AndrewFasano / mcafee_intercept.sh
Created December 12, 2016 17:01
Intercept messages between McAfee webserver and root service
#!/bin/bash
_restore() {
mv /var/opt/NAI/LinuxShield/dev/nails_monitor{_real,}
}
echo "Restarting nails"
/etc/init.d/nails restart 2>&1 > /dev/null
mv /var/opt/NAI/LinuxShield/dev/nails_monitor{,_real}
@AndrewFasano
AndrewFasano / exploit.py
Created December 12, 2016 16:20
McAfee PoC
#!/bin/python3
import time
import requests
import os
import sys
import re
import threading
import subprocess
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn