Skip to content

Instantly share code, notes, and snippets.

@John-K
John-K / PSP HW Regs.md
Last active January 17, 2023 02:31
PSP 0xBCxxxxxx Register Descriptions

0xbc10003c

  • 0x1 - sceSysreg_driver_0x4841B2D2(int) (set), sceSysreg_driver_0x4E5C86AA (read, clear, restore)
    • also if (int == 0) reg &= 0xe0000000
  • 0x1 - sceSysregDoTimerEvent(0, 1 or 3) (set), sceSysregDoTimerEvent(0, 0 or 2) (clear)
  • 0x2 - sceSysregDoTimerEvent(1, 1 or 3) (set), sceSysregDoTimerEvent(1, 0 or 2) (clear)

0xbc100040

  • (>> 8) - sceSysregGetTachyonVersion
  • 0x100 - sceSysregSetAwEdramSize(arg1)
  • if (tachyonVersion >= 0x500000)
@John-K
John-K / me_wrapper.c
Last active October 6, 2020 04:07
me_wrapper.prx
// func_00002070
// sceMeWrapper_driver_0x24317CD0
int module_start(void) {
int tachyonVersion;
float pllFreq;
undefined4 local_20;
int local_1c;
initMEAtomicsAndInterruptHandler();
sceLfatfsWaitReady();
@John-K
John-K / covid.py
Created March 29, 2020 19:52
parse NYT covid data into python dictionaries
#!/usr/bin/env python
# run from the NYT data directory:
# python covid.py
import csv
import pprint
# data structures
@John-K
John-K / minignore.go
Created August 12, 2019 17:08
go script to minimize gitignore rules for those super hairy repos
// minignore.go
// John Kelley <john@kelley.ca>
// January 2019
// Covered by BSD license
//
// minignore parses all of the rules in your gitignore files and omits those rules which are covered by others
// (including duplicate lines). The output is written to the given path with '.new' appended to the filename
//
// Usage: go run minignore.go .gitignore
@John-K
John-K / gist:b2dae21562a70fb51ed8151ffc876951
Last active May 15, 2018 18:45
CH554 Quickstart Guide
See examples, headers, english datasheet from https://github.com/Blinkinlabs/ch554_sdcc
Open source wchisp https://github.com/rgwan/librech551
To program, short 2-pins of ISP header as you plug board into USB
@John-K
John-K / crc32_brute.c
Last active June 5, 2018 05:38
Reverse Engineering a Book Cover: bruteforcing crc32 values
//gcc -msse4.2 brute.c
#include <stdio.h>
int crc32(int crc, char c) {
return __builtin_ia32_crc32qi(crc, c);
}
int main() {
int value = 0;
int tableIndex = 22;
int table[] = {0x564d94ce,0x56487985,0xcd6966e6,0x791b5538,0xbdc0bfb7,0x8ecbf593,0xc652c4a2,0x94a3ebf7,0x2673b49e,0x89f7731e,0x32c1eb44,0x7886f083,0x52e2bb44,0xc7fdffaa,0x69f9005a,0xe04743ac,0x44229524,0xe8032961,0x8cc30f1e,0x084cdea3,0xeb48d1ad,0x90809740,0xe4292d5a };
@John-K
John-K / cover_re.py
Last active June 5, 2018 05:29
Reverse Engineering a Book Cover
#!/bin/env python2
# -*- coding: utf-8 -*-
# Solution to Book Cover Crackme from "Praktyczna inżynieria wstecznia
# Edited by Gynvael Coldwind and Mateusz Jurczyk. (Applied Reverse Engineering)
# PWN Bookstore: https://ksiegarnia.pwn.pl/Praktyczna-inzynieria-wsteczna,622427233,p.html
#
# Props to @radekk for his excellent writeup and for capturing the flag. Read his
# writeup at https://vulnsec.com/2017/reverse-engineering-a-book-cover/
#
# This was a fun opportunity to learn how to use Unicorn Engine, Capstone Engine,
@John-K
John-K / cmv_snap3.c
Last active May 21, 2016 09:18
Apertus cmv_snap3 flipped ordered pixel output
664 union dpixel {
665 uint32_t p;
666 uint8_t b[4];
667 } pix_out;
668 for (int frame = 0; frame < num_frames; frame++) {
669 for (int row = 0; row < 3072; row+=2) {
670 //
671 // pixel order is (1,0) (1,1) (0,0) (0,1) <16-bit overlay> when in flipped mode
672 // 52^ 40^ 28^ 16^
673 for (int i = 0; i < 32*128*2/4; ++i) {
#!/bin/sh
natd -interface tun0
ipfw -f flush
ipfw add divert natd ip from any to any via tun0
ipfw add pass all from any to any
sysctl -w net.inet.ip.forwarding=1
@John-K
John-K / gist:afaf29b7cf561f07c08c
Created March 15, 2016 03:24
wget mirror command
#cut-dirs is the number of leading directories to throw away
wget -q -R '*index.html' -np -r -P out -nH --cut-dirs=4 <URL>