Skip to content

Instantly share code, notes, and snippets.

@Ralireza
Ralireza / debugsharedlibraryinandroid.md
Created December 13, 2022 13:56
debug .so file in android

Debug Sharedlibrary (.so file) in android application:

need:

  • gdb
  • gdbserver
  • emulator

step 1

  • open application on emulator
  • adb shell
  • ps | grep
private void measureLine(String line) {
lineCount++;
int lineSize = line.length();
totalChars += lineSize;
lineWidthHistogram.addLine(lineSize, lineCount);
recordWidestLine(lineSize);
}
package fitnesse.wikitext.widgets;
import java.util.regex.*;
public class BoldWidget extends ParentWidget {
public static final String REGEXP = "'''.+?'''";
private static final Pattern pattern = Pattern.compile("'''(.+?)'''",
Pattern.MULTILINE + Pattern.DOTALL);
public BoldWidget(ParentWidget parent, String text) throws Exception {
super(parent);
Matcher match = pattern.matcher(text); match.find(); addChildWidgets(match.group(1));
}
package fitnesse.wikitext.widgets;
import java.util.regex.*;
public class BoldWidget extends ParentWidget {
public static final String REGEXP = "'''.+?'''";
private static final Pattern pattern = Pattern.compile("'''(.+?)'''",
Pattern.MULTILINE + Pattern.DOTALL );
public BoldWidget(ParentWidget parent, String text) throws Exception {
String str = Utils.usern;
String str2 = Utils.enkey;
StringBuilder sb = new StringBuilder();
sb.append("{\"username\": \"");
sb.append(UpdateProfileActivity.this.name.getText().toString());
sb.append("\"}");
sb.append(str2);
String md5 = CryptoHandler.md5(sb.toString());
UpdateReq updateReq = new UpdateReq();
updateReq.username = UpdateProfileActivity.this.name.getText().toString();
{
"code":200,
"data":
{
"blc_currency":1,
"id":37,
"role_id":"RID5EF655B2-60C0-4F32-9AF3-BCB8A47CCF63",
"username":"asdsdad",
"uuid":"d15466f0-40ef-4194-bbca-6ca306acd819"
}
Java.perform(function x(){
var my_class = Java.use("com.asisctf.Andex.ConfigurationActivity");
my_class.getDex1.implementation = function(x){
var someClass = Java.use("com.asisctf.Andex.Utils");
someClass.user_profile_url.value="/api/userClass/me";
someClass.shop_order_url.value="/api/shop/order/";
someClass.shop_item_url.value="/api/shop/items/get_data";
var intent=Java.use("android.content.Intent");
var c=Java.use("com.asisctf.Andex.MenuActivity");
var result = intent.$new(this, c.class);
Utils.config = strArr;
Utils.shop_item_url = strArr[0];
Utils.shop_order_url = strArr[1];
Utils.user_profile_url = strArr[2];
public void getDex1(String str) {
....
sb.append(externalStoragePublicDirectory.getAbsolutePath());
sb.append("/conf/1plain.dex");
sb3.append("/conf/1.dex");
CryptoHandler.decrypt(sb2, sb3.toString(), Utils.enkey);
Class classFromDex = DexJob.getClassFromDex(sb2, "com.asisctf.config.SayHelloToYourLittleFriend", ConfigurationActivity.this.getApplicationContext());
String[] strArr = (String[]) classFromDex.getMethod("config", new Class[]{Context.class}).invoke(classFromDex.newInstance(), new Object[]{ConfigurationActivity.this.getApplicationContext()});
if (strArr.length == 0) {
ConfigurationActivity.this.state.setText("can't load configuration, review your registeriation");
public class SayHelloToYourLittleFriend {
public String[] config(Context context) {
String shop_item = "/api/shop/items/get_data";
String shop_order = " /api/shop/order/";
String user_profile = "/api/userClass/me";
String[] config = new String[0];
if (new RootBeer(context).isRooted() || isEmulator()) {
return config;
}
return new String[]{shop_item, shop_order, user_profile};