Skip to content

Instantly share code, notes, and snippets.

View sopanatx's full-sized avatar
🎯
Focusing

Sopanat Suradach sopanatx

🎯
Focusing
View GitHub Profile
@Override
@NotNull
public String encrypt(@NotNull String plainText, @NotNull String key) {
Intrinsics.checkNotNullParameter(plainText, "plainText");
Intrinsics.checkNotNullParameter(key, "key");
Cipher cipher = getCipher(1, key);
byte[] plainTextBytes = plainText.getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(plainTextBytes, "(this as java.lang.String).getBytes(charset)");
byte[] encryptedBytes = Base64.encode(cipher.doFinal(plainTextBytes));
Intrinsics.checkNotNullExpressionValue(encryptedBytes, "encode(encryptedBytes)");
@sopanatx
sopanatx / httpcanary.sh
Created December 15, 2022 13:51
A shell script is used to copy a HttpCanary certificate to the system.
#!/bin/sh
echo "Running: Remount RW /system_root'..."
$(adb shell mount -o rw,remount /system_root)
echo "Done!"
echo "Running: Copying certificate to system_root'..."
$(adb shell cp -f /data/data/com.guoshi.httpcanary/cache/HttpCanary.pem /system_root/system/etc/security/cacerts/87bc3517.0)
echo "Done!"
function getHMacSign(str, str2)
implicit none
character(len=*), intent(in) :: str, str2
character(len=128) :: result
integer :: i, j
character(len=8), parameter :: algorithm = "HmacSHA1"
character(len=64) :: secret_key = "10f29ff413c89c8de02349cb3eb9a5f510f29ff413c89c8de02349cb3eb9a5f5"
character(len=32) :: mac_bytes(16)
integer :: mac_bytes_len
@sopanatx
sopanatx / bootloader_miui.java
Created March 3, 2022 10:00
Xiaomi Bootloader Bind API
package com.android.settings.bootloader;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.android.settings.AESUtil;
import com.android.settings.bootloader.Utils;
LOWORD(result) = -99 * (char)a3;
v7 = 0;
v8 = a3 <= 0;
v9 = 2157;
v13 = -99 * a3;
if ( !v8 )
{
v10 = a4 - a5;
for ( i = a4 - a5; ; v10 = i )
{
_DWORD *__thiscall sub_5EB890(_DWORD *this)
{
//05 01 2E 03 74 00 A7 04 00 A0 00 00 65 20 07 00 2D E0 0E 03 00 4E 20 17 00 54 20 03 00 57 20 03 02 8F 02 00 60 03 00 17 20 0B 00 00 E0 00 3D E0 1B 00 01 00 00 68 03 81 00 19 00 02 04 00 00 00 00 08