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 / fix-magisk-stock-backup-does-not-exist.md
Created March 25, 2023 20:14 — forked from zander21510/fix-magisk-stock-backup-does-not-exist.md
Added additional instructions and corrected/explained filename issues.

How To Fix "Stock Backup Does Not Exist" message in Magisk when using "Restore Images" to flash OTA

DISCLAIMER: I didn't come up with these steps, nor do I provide any support for these steps. I just wanted to add some additional information that helped me. Not responsible if you brick your phone/cause thermonuclear war/etc. Use at your own risk/PLEASE google/research if you are unsure of what you're doing.

STEP 1:

Connect your phone to your computer via ADB. If you don't know how to do this, please search before following these steps

STEP 2:

put stock boot.img into /sdcard/boot.img. MAKE SURE the name of the file is "boot.img", otherwise you will need to alter the following commands to use the name of the file. MAKE SURE your stock boot.img IS A VALID BOOT FILE, if it is not, Magisk will still restore the image, but the OTA will not work and your phone will not work upon reboot.

@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