Skip to content

Instantly share code, notes, and snippets.

View ioncodes's full-sized avatar
😴
Playing with memory regions...

Layle ioncodes

😴
Playing with memory regions...
View GitHub Profile
let mut w = trucks[i].weight;
let mut h = trucks[i].height;
w = 10;
h = 10;
trucks[i].weight = w;
trucks[i].height = h;
@ioncodes
ioncodes / pair_gen.rs
Last active February 9, 2018 16:20
combination gen for mortoray
#[derive(Debug)]
struct Pair {
pub x: usize,
pub y: usize,
}
fn combs(v: Vec<usize>) -> Vec<Pair> {
let mut t = &v[1..];
let mut combinations = Vec::<Pair>::new();
@ioncodes
ioncodes / combinations.rs
Last active February 9, 2018 16:31
Generic combinations generator in Rust with iterator. Created for @mortoray.
use std::ops::{Index, IndexMut};
struct Combinations<T> {
combinations: Vec<Vec<T>>,
index: usize,
}
impl<T> Combinations<T> {
pub fn new() -> Combinations<T> {
Combinations {
@ioncodes
ioncodes / bad_combinations.rs
Created February 9, 2018 16:26
Combination generator which does NOT work. This has a reference issue. This is just to show the difference between a good structure and a bad structure. For @mortoray. (Not that your structure is bad <3)
use std::ops::{Index, IndexMut};
struct Combinations<T> {
combinations: Vec<Vec<T>>
}
impl<T> Combinations<T> {
pub fn new() -> Combinations<T> {
Combinations {
combinations: Vec::<Vec<T>>::new()
@ioncodes
ioncodes / gist:a8fb16c25b2b043834f5451ecbcd630e
Created February 11, 2018 13:59 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@ioncodes
ioncodes / encode_negative_jump.py
Last active February 24, 2018 14:06
Calculates the bytes used for a negative relative jump over 126 bytes in x64 asm (e.g: je $-300)
loc = 200
asm = [0xfa, 0xff, 0xff, 0xff]
for i in range(0, loc):
if asm[0] == 0x00:
if asm[1] == 0x00:
if asm[2] == 0x00:
asm[3] -= 1
asm[2] = 0xff
asm[1] = 0xff
@ioncodes
ioncodes / encode_positive_jump.py
Created February 24, 2018 13:33
Calculates the bytes used for a positve relative jump over 129 bytes in x64 asm (e.g: je $+300)
loc = 300
asm = [-0x06, 0x00, 0x00, 0x00]
for i in range(0, loc):
if asm[0] == 0xff:
if asm[1] == 0xff:
if asm[2] == 0xff:
asm[3] += 1
asm[2] = 0x00
asm[1] = 0x00
@ioncodes
ioncodes / electra_fix_https_fucked.md
Last active February 27, 2018 14:23
Incase I go full retard again and fuck up apt and cydia with Electra 1.x.x (https support fucked)

Download bootstrap.tar.gz from the electra repo
gunzip
IMPORTANT: Use this to to extract tar:
tar --preserve-permissions -xvkf bootstrap.tar
upload the cydia and apt files to the phone (scp)
reboot and jailbreak!!

@ioncodes
ioncodes / objcparser.re
Created March 31, 2018 09:31
ObjC Header parser regex
([\+\-]) \(([\w ]+)\)([\w]+)[:;]([\w\(\) \:\*]+)?;?
@ioncodes
ioncodes / mt.rs
Created August 20, 2018 08:44 — forked from yupferris/mt.rs
Mario's Tennis graphics decompression routine in Rust-like pseudo-code. Manual decompilation is a bitch. :)
fn decompress(mut src: *const u8, dst: *mut u8) {
// Skip first 2 bytes (they're always zero)
src += 2;
let original_dst = dst;
// Load bytes_left
let mut bytes_left = ((*src as i32) << 8) + 1;
src += 1;
bytes_left += *src as i32;