This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from elftools.elf.elffile import ELFFile | |
from elftools.elf.sections import Section, SymbolTableSection, Symbol | |
from elftools.elf.relocation import RelocationSection, Relocation | |
from elftools.elf.constants import SH_FLAGS | |
class RelocSource: | |
def __init__(self, target_section_number, symbol_section_number, r): | |
self.target_section_number = target_section_number | |
self.symbol_section_number = symbol_section_number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from elftools.elf.elffile import ELFFile | |
from pathlib import Path | |
import struct | |
import subprocess | |
# Steps | |
# | |
# 0) Read definitions with addresses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# adapted from my xtwrap | |
import os | |
import sys | |
import tty | |
import time | |
import uuid | |
import signal | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import argparse | |
import json | |
branch_instrs = [ | |
'b', | |
'bl', | |
'beq', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tetris has these pieces: | |
[][] [][] [][] [] [][][][] [] [] | |
[][] [][] [][] [][] [] [] | |
[] [][] [][] | |
If you associate a 4-byte sequence with each of these pieces and use the method | |
below to turn a tetris game with a specific piece sequence and move sequence | |
into a program using those sequences, it seems possible that that program could | |
itself be a tetris game that can write itself into memory or to some io device. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rol(r,n): | |
return (r << n) | (r >> (32 - n)) | |
def crcgen(r3,r4): | |
r6 = rol(r3,8) & 0xff00 | |
r0 = rol(r4,0) & 0xff | |
r3 = rol(r3,24) & 0xffffff | |
r4 = r3 ^ r0 | |
r0 = rol(r4,8) & 0xffffff00 | |
r0 = rol(r0,20) & 0xfffff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
img = Image.new(mode="RGB", size=(8,8)) | |
pixels = [ ] | |
# Black | |
pixels.append((0,0,0)) | |
# Greys and white | |
for i in range(15): | |
v = int((i + 1) * (255 / 15)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde_json; | |
pub enum And<T,U> { | |
These(T,U) | |
} | |
pub enum Field<T> { | |
Named(&'static str,T) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[cfg(any(test, feature = "fuzzer"))] | |
use rand::prelude::*; | |
use rand::Error; | |
use random_lfsr_256_galois::{LFSRGalois, LFSRGaloisBuilder}; | |
// A pseudo RNG which uses a slice for all entropy. It iterates a given slice | |
// many times, scrambling the bits through an LFSR in subsequent passes so that | |
// the fuzzer maintains a relationship between the original input bits and the | |
// output with some predictability. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixpoint nat_lt (a : nat) (b : nat) : bool := | |
match b with | |
| 0 => false | |
| (S b1) => | |
match a with | |
| 0 => true | |
| (S a1) => nat_lt a1 b1 | |
end | |
end. |
NewerOlder