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
@gauravssnl
gauravssnl / SampleEncPrefs.kt
Created January 30, 2024 15:23 — forked from scottyab/SampleEncPrefs.kt
Simple example of using EncrypredSharedPreferences
package com.scottyab.whatsnewplayground.data
import android.content.Context
import android.content.SharedPreferences
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKeys
import com.scottyab.whatsnewplayground.BuildConfig
internal class SampleEncPrefs(context: Context) {
@gauravssnl
gauravssnl / SignatureCheck.java
Created January 30, 2024 15:22 — forked from scottyab/SignatureCheck.java
Simple Android signature check. Please note: This was created in 2013, not actively maintained and may not be compatible with the latest Android versions. It's not particularly difficult for an attacker to decompile an .apk, find this tamper check, replace the APP_SIGNATURE with theirs and rebuild (or use method hooking to return true from `vali…
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
public class TamperCheck {
//we store the hash of the signture for a little more protection
private static final String APP_SIGNATURE = "1038C0E34658923C4192E61B16846";
@gauravssnl
gauravssnl / SimpleApkV2.java
Created January 30, 2024 14:58 — forked from vvb2060/SimpleApkV2.java
SimpleApkV2
// package me.piebridge;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.AppComponentFactory;
import android.content.pm.ApplicationInfo;
import android.util.Log;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipFile;
@gauravssnl
gauravssnl / hiddenapibypass.cpp
Created January 30, 2024 14:56 — forked from vvb2060/hiddenapibypass.cpp
`JNI_OnLoad` called by system
jint JNI_OnLoad(JavaVM *jvm, void *) {
JNIEnv *env;
jclass clazz;
if (jvm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {
return JNI_ERR;
}
jclass vm = env->FindClass("dalvik/system/VMRuntime");
jclass string = env->FindClass("java/lang/String");
@gauravssnl
gauravssnl / am_proc_start.cpp
Created January 30, 2024 14:55 — forked from vvb2060/am_proc_start.cpp
monitor app process start
#include <unistd.h>
#include <string>
#include <cinttypes>
#include <android/log.h>
#include <sys/system_properties.h>
using namespace std;
extern "C" {
.segment "HEADER"
.byte "NES", $1A ; Constant
.byte 2 ; 2 x 16KB PRG ROM
.byte 1 ; 1 x 8KB CHR ROM
.segment "CHARS"
;-------------------------------------------------------------
; CREATE SPRITES
;-------------------------------------------------------------
; The following creates one sprite. The following two bitmaps
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
/**
* Educational "Free-list" memory allocator.
*
* Maintains explicit list of free memory blocks, reuses blocks on free.
* Implements "first-fit" strategy. Uses pre-allocated heap of 64 bytes,
* with 32-bit machine word size.
*
* TODO:
*
* - Implement "best-fit" strategy
/**
* 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:
*