Skip to content

Instantly share code, notes, and snippets.

@iddoeldor
iddoeldor / UiccUnlock.cpp
Last active November 21, 2021 20:05 — forked from tewilove/UiccUnlock.cpp
Looks like a quasi-exploit to do a SIM unlock
#include <android/log.h>
#include <jni.h>
#include <binder/Binder.h>
#include <binder/Parcel.h>
#include <binder/IServiceManager.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
from ghidra.program.model.address import Address
from ghidra.program.model.mem import MemoryAccessException
from ghidra.program.flatapi import FlatProgramAPI
from ghidra.util.task import TaskMonitor
import math
import json
from os.path import isfile, join, dirname
import struct as st
import string
#include <speex/speex.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <iterator>
#include <cassert>
int main(int argc, char const *argv[])
{
if (argc < 2)
import sark
for segname in ['.bss', '.data']:
for line in sark.Segment(name=segname).lines:
if not line.name:
continue
if line.name.startswith('g_'):
continue
@iddoeldor
iddoeldor / ida_sarlk_function_strings_ref.py
Created August 17, 2020 22:45 — forked from yannayl/ida_sarlk_function_strings_ref.py
A function which returns all the strings referenced from function
def strs(f=None, visited=None, level=0, maxlevel=-1):
if maxlevel >= 0 and level > maxlevel:
return [], set()
if not f:
f = sark.Function()
if not visited:
visited = set()
root = True
else:
root = False
def _masquerade(self,origin):
self.__class__ = type(origin.__class__.__name__,(self.__class__,origin.__class__),{})
self.__dict__ = origin.__dict__
@iddoeldor
iddoeldor / frida-hook-generator.py
Created May 11, 2020 22:01 — forked from FrankSpierings/frida-hook-generator.py
Generate Frida hooks based on c header files using pyclibrary
from pyclibrary import CParser
import re
hook_template = '''
(function() {
var name = '__NAME__';
var address = Module.findExportByName(null, name);
if (address != null) {
console.log('[!] Hooking: ' + name + ' @ 0x' + address.toString(16));
@iddoeldor
iddoeldor / pyc.py
Created May 2, 2020 13:51 — forked from adamnew123456/pyc.py
Using Inline C Code In Python Programs
"""
Inserts C code directly into Python files, which can then be dynamically linked
in and called via ctypes.
"""
import atexit
import ctypes
import os
import shlex
import sys
import tempfile
@iddoeldor
iddoeldor / bheap.py
Last active January 16, 2020 08:40 — forked from yannayl/babyheap.py
0ctf 2018 heap challenge exploit
from pwn import *
context.bits = 64
#libc = ELF('./libc-2.23.so')
libc = ELF('./libc-2.24.so')
main = ELF('./babyheap.dbg')
#main = ELF('./babyheap')
#dbg_file = './libc-2.23.debug'
def gdb_load_symbols_cmd(sym_file, elf, base):
typedef void **va_list;
typedef uint8_t jboolean;
typedef int8_t jbyte;
typedef uint16_t jchar;
typedef int16_t jshort;
typedef int32_t jint;
typedef int64_t jlong;
typedef float jfloat;
typedef double jdouble;