Tags: rev 

Rating:

I was given android apk file [chargetracker.apk](https://github.com/mar232320/ctf-writeups/raw/main/chargetracker.apk)

I looked in internet for online apk decompilers decompiled the file and looked for the java source files The most interesting one was `MainActivity.java`

```
package com.bsdiessf.chargetracker;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

public class MainActivity extends AppCompatActivity {
private ImageView batteryImage;
private TextView batteryValue;
private BroadcastReceiver mBatteryReceiver = new BroadcastReceiver() {
/* class com.bsdiessf.chargetracker.MainActivity.AnonymousClass1 */

public void onReceive(Context context, Intent intent) {
int intExtra = intent.getIntExtra("level", 0);
String valueOf = String.valueOf(intExtra);
Log.d("Battery update:", valueOf);
if (intExtra == 49) {
Log.d("Flag:", MainActivity.this.getResources().getString(R.string.part1) + MainActivity.this.part2 + "1tN0w}");
}
TextView textView = MainActivity.this.batteryValue;
textView.setText(valueOf + "%");
if (intExtra > 79) {
MainActivity.this.batteryImage.setImageResource(R.drawable.high);
} else if (intExtra <= 30 || intExtra >= 80) {
MainActivity.this.batteryImage.setImageResource(R.drawable.low);
} else {
MainActivity.this.batteryImage.setImageResource(R.drawable.med);
}
}
};
private String part2 = "R3charg3";

/* access modifiers changed from: protected */
@Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_main);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
this.batteryImage = (ImageView) findViewById(R.id.batteryImageView);
this.batteryValue = (TextView) findViewById(R.id.percentValue);
int intProperty = ((BatteryManager) getSystemService("batterymanager")).getIntProperty(4);
TextView textView = this.batteryValue;
textView.setText(String.valueOf(intProperty) + "%");
registerReceiver(this.mBatteryReceiver, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
}

/* access modifiers changed from: protected */
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
public void onDestroy() {
super.onDestroy();
unregisterReceiver(this.mBatteryReceiver);
}
}

```

I could see `1tN0w}` as last part at the end and `R3charg3` in `private String part2` I assumed that the first part is `CTF{`

> CTF{R3charg31tN0w}