Skip to content

Instantly share code, notes, and snippets.

@jamiees2
jamiees2 / astar.py
Created May 7, 2013 11:20
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@oleavr
oleavr / frida-core-1.0.vapi
Last active January 20, 2024 03:15
The frida-core API consumed by bindings like frida-python, frida-qml, etc.
[CCode (cheader_filename = "frida-core.h", cprefix = "Frida", lower_case_cprefix = "frida_")]
namespace Frida {
public static void init ();
public static void shutdown ();
public static void deinit ();
public static unowned GLib.MainContext get_main_context ();
public class DeviceManager : GLib.Object {
public DeviceManager ();
@espinchi
espinchi / DeviceUtil.java
Last active November 9, 2021 09:36
Check if the running device is an emulator
import android.os.Build;
/**
* Utility methods related to physical devies and emulators.
*/
public class DeviceUtil {
public static boolean isEmulator() {
return Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
@al3xtjames
al3xtjames / marlin-o-build.prop
Created March 21, 2017 22:56
Pixel XL (marlin) Android O DP1
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=OPP1.170223.012
ro.build.display.id=OPP1.170223.012
ro.build.version.incremental=3793265
ro.build.version.sdk=25
ro.build.version.preview_sdk=1
ro.build.version.codename=O
ro.build.version.all_codenames=O
@FrankSpierings
FrankSpierings / hookalloverloads.js
Created October 14, 2017 18:57
Hook all overloads - Java/Android - Frida
function getGenericInterceptor(className, func, parameters) {
args = []
for (i = 0; i < parameters.length; i++) {
args.push('arg_' + i)
}
var script = "result = this.__FUNCNAME__(__SEPARATED_ARG_NAMES__);\nlogmessage = '__CLASSNAME__.__FUNCNAME__(' + __SEPARATED_ARG_NAMES__ + ') => ' + result;\nconsole.log(logmessage);\nreturn result;"
script = script.replace(/__FUNCNAME__/g, func);
script = script.replace(/__SEPARATED_ARG_NAMES__/g, args.join(', '));
script = script.replace(/__CLASSNAME__/g, className);
@matandobr
matandobr / SuperSUFlash.sh
Last active August 1, 2020 14:33
Manual flashing SuperSU (2.82) on AVD armv7 android 6 - SDK23 emulator
#!/bin/sh
#
# @0xGr00t, 2018
# This is a simple shell script that does exactly what SuperSU guided in their code.
# Tested on AVD android 6 armv7 emulator (sdk23) with macOS host
# Before you run this, make sure you have downloaded SuperSu flashable zip from their site, and cd into it
# To this to work properly, run the emulator with -no-snapshot -writable-system flags
# For example: MacBook-Pro-2:tools matandobr$ ./emulator -no-snapshot -writable-system @Nexus5API23
# cd into the extracted SuperSU-v2.82 folder, and run it from there.
# There is one issue I faced - when starting the emulator it won't boot until you disable SELinux (adb shell setenforce 0)
Build.Prop for android Pixel 2
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=OPM1.171019.021
ro.build.display.id=OPM1.171019.021
ro.build.version.incremental=4565141
ro.build.version.sdk=27
ro.build.version.preview_sdk=0
ro.build.version.codename=REL
@su-vikas
su-vikas / screenshot.js
Created October 7, 2018 07:55
FRIDA script for bypassing Android FLAG_SECURE
Java.perform(function() {
var surface_view = Java.use('android.view.SurfaceView');
var set_secure = surface_view.setSecure.overload('boolean');
set_secure.implementation = function(flag){
console.log("setSecure() flag called with args: " + flag);
set_secure.call(false);
};
@oleavr
oleavr / frida-logging.md
Last active April 7, 2023 08:53
Frida logging hacks

Frida logging helper

For adding temporary logging to help understand behavior. For when it is impractical to use Frida to instrument Frida.

Choose one of these and copy-paste it into e.g. lib/interfaces/session.vala, then use log_event ("name='%s'", name); to log.

When something appears to be hanging, try applying: x-async-debug.patch.