Skip to content

Instantly share code, notes, and snippets.

View gauravssnl's full-sized avatar
😸
use code::latest ;

GAURAV gauravssnl

😸
use code::latest ;
View GitHub Profile
/**
* Writing a Mark-Sweep Garbage Collector in C++.
*
* This is a source code for the Lecture 9 from the
* Essentials of Garbage Collectors course:
*
* http://dmitrysoshnikov.com/courses/essentials-of-garbage-collectors/
*
* See full details in:
*
let offset = 20000;
let chunk_size = 10000;
// File handle:
let mut handle = BufReader::new(File::open("data.bin").await?);
// Set cursor to needed chunk:
let mut chunk_stream = handle
.bytes()
.skip(offset)
/**
* Basic Array class, similar to std::array.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
* MIT Style License (C) 2020
*/
#ifndef __Array_h
#define __Array_h

JNI Example (Mac OS)

JNI (Java Native Interface) allows implementing methods in C/C++, and use them in Java.

1. Create JNIExample.java file

class JNIExample {

  // Native method, no body.
@gauravssnl
gauravssnl / jni_all.h
Created January 29, 2024 09:17 — forked from Jinmo/jni_all.h
Useful when reversing JNI on IDA Pro
/*
* Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@gauravssnl
gauravssnl / build.gradle.kts
Created January 22, 2024 23:03 — forked from mileskrell/build.gradle.kts
Example of declaring Android signing configs using Gradle Kotlin DSL
android {
signingConfigs {
getByName("debug") {
keyAlias = "debug"
keyPassword = "my debug key password"
storeFile = file("/home/miles/keystore.jks")
storePassword = "my keystore password"
}
create("release") {
keyAlias = "release"
@gauravssnl
gauravssnl / XHookGms.java
Created January 14, 2024 13:42 — forked from kmark/XHookGms.java
Hooking into any class in Google Play Services
package com.versobit.kmark.gist;
import android.app.Application;
import android.content.Context;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
@gauravssnl
gauravssnl / AndroidClasspath.java
Created January 14, 2024 13:41 — forked from kmark/AndroidClasspath.java
Explores the current Android classpath
try {
PathClassLoader pcl = (PathClassLoader) Thread.currentThread().getContextClassLoader();
Field f = Class.forName("dalvik.system.BaseDexClassLoader").getDeclaredField("pathList");
f.setAccessible(true);
Object dpl = f.get(pcl);
Class cls = Class.forName("dalvik.system.DexPathList");
Field f2 = cls.getDeclaredField("dexElements");
f2.setAccessible(true);
Object[] elements = (Object[])f2.get(dpl);
for(Object e : elements) {
@gauravssnl
gauravssnl / TabsAdapter.java
Created January 14, 2024 13:41 — forked from kmark/TabsAdapter.java
An extensible FragmentPagerAdapter that supports both FragmentActivity and Fragment hosts.
package you.should.change.this;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
@gauravssnl
gauravssnl / root_bypass.js
Created January 4, 2024 19:56 — forked from pich4ya/root_bypass.js
Bypass Android Root Detection / Bypass RootBeer - August 2019
// $ frida -l antiroot.js -U -f com.example.app --no-pause
// CHANGELOG by Pichaya Morimoto (p.morimoto@sth.sh):
// - I added extra whitelisted items to deal with the latest versions
// of RootBeer/Cordova iRoot as of August 6, 2019
// - The original one just fucked up (kill itself) if Magisk is installed lol
// Credit & Originally written by: https://codeshare.frida.re/@dzonerzy/fridantiroot/
// If this isn't working in the future, check console logs, rootbeer src, or libtool-checker.so
Java.perform(function() {
var RootPackages = ["com.noshufou.android.su", "com.noshufou.android.su.elite", "eu.chainfire.supersu",