Skip to content

Instantly share code, notes, and snippets.

View rw-r-r-0644's full-sized avatar

rw-r-r-0644 rw-r-r-0644

  • Italy
  • 17:26 (UTC +02:00)
View GitHub Profile
#!/usr/bin/env python3
import struct
import sys
from Crypto.Hash import SHA1
stage2file = sys.argv[1]
outfile = sys.argv[2]
stage2 = bytearray(open(stage2file, "rb").read())
int write_payload(uint8_t *ptr)
{
/* instructions placed at 0x0C+(0x20*k)
* will be corrupted if the 2 least
* significant bits are set */
/* clean the area overwritten by the stack overflow
* memset( 0x0D40E240, 0, 0xB70 ) */
write32(ptr+0x000, 0xe59f30f8); // ldr r3, [pc, #0xF8]
int ISFS_Setup(ISFS *this,int init)
{
if (init == 0)
return 0;
super = ISFS_LoadSuperblock(this);
if (!super)
return -0x8046F;
@rw-r-r-0644
rw-r-r-0644 / ISFS_LoadSuperblock.c
Created March 30, 2021 18:00
ISFS_LoadSuperblock RE
ISFS_Superblock *ISFS_LoadSuperblock(ISFS *isfs)
{
if ((isfs->initState & 2) == 0)
return;
if ((isfs->initState & 0x44) == 0x44)
return NULL;
int latestVersion = 0;
/* gensuperblock.c
*
* Copyright (C) 2021 rw-r-r-0644
* This file is under GNU GPLv2+
*/
#include <arpa/inet.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <arpa/inet.h>
#include <cstdint>
#include <cstring>
struct FST_Entry
{
char name[12];
uint8_t mode;
@rw-r-r-0644
rw-r-r-0644 / brainfuck.rkt
Last active January 28, 2021 11:31
Brainfuck interpreter in Racket/Scheme
; brainfuck.rkt
;
; A slow, limited, but fun to write brainfuck interpreter in Racket teaching language
; Input instructions are not supported
;
; (language: Intermediate Student with lambda)
;
; Copyright (C) 2021 rw-r-r-0644
; This code is under GNU GPLv2
@rw-r-r-0644
rw-r-r-0644 / boot1_payload.s
Created January 23, 2021 15:50
dump boot1 without relying on boot1 functions
.text
@ this code runs at 0x00000048 after boot1 jumps to NULL
.global _start
_start:
@ Patch PRSH checksum (offsets replaced when writing payload)
ldr r2, =0xcafe0001 @ prsh_hdr_offset
ldr r0, =0xcafe0002 @ checksum_old
str r0, [r2]
#!/bin/python3
# manhattan.py
# Solves "paths of Manhattan (2d)" problem
#
# Copyright(C) 2020 rw-r-r-0644
# This file is under GNU GPLv2
import math, sys
def tartaglia(n, k):
#!/bin/python3
from PyPDF2 import PdfFileWriter, PdfFileReader
from Levenshtein import distance
import sys
import re
# Requires PyPDF2 and python-Levenshtein.
# Install them with `pip install PyPDF2 python-Levenshtein
# Maximum distance between the same content located in