Primer paso de la investigacion. Se aportan el .apk, las carpetas con el apk extraido y el apk descompilado. El archivo API_DOCUMENTATION.md es un archivo donde se anotaran los descubrimientos del funcionamiento de la API, y los .py son scripts para probar la funcionalidad de la API con los métodos que vayamos encontrando. Finalmente, los archivos .js son scripts de Frida para extraer informacion de la APP durante la ejecucion.

This commit is contained in:
2025-12-04 13:59:54 +01:00
parent f2fd1c3bf5
commit e0133d2ca2
10432 changed files with 1019085 additions and 1 deletions

View File

@@ -0,0 +1,52 @@
package com.google.firebase.heartbeatinfo;
import java.util.List;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public final class AutoValue_HeartBeatResult extends HeartBeatResult {
private final List<String> usedDates;
private final String userAgent;
public AutoValue_HeartBeatResult(String str, List<String> list) {
if (str == null) {
throw new NullPointerException("Null userAgent");
}
this.userAgent = str;
if (list == null) {
throw new NullPointerException("Null usedDates");
}
this.usedDates = list;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof HeartBeatResult) {
HeartBeatResult heartBeatResult = (HeartBeatResult) obj;
if (this.userAgent.equals(heartBeatResult.getUserAgent()) && this.usedDates.equals(heartBeatResult.getUsedDates())) {
return true;
}
}
return false;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatResult
public List<String> getUsedDates() {
return this.usedDates;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatResult
public String getUserAgent() {
return this.userAgent;
}
public int hashCode() {
return this.usedDates.hashCode() ^ ((this.userAgent.hashCode() ^ 1000003) * 1000003);
}
public String toString() {
return "HeartBeatResult{userAgent=" + this.userAgent + ", usedDates=" + this.usedDates + "}";
}
}

View File

@@ -0,0 +1,53 @@
package com.google.firebase.heartbeatinfo;
import C.w;
/* loaded from: classes3.dex */
final class AutoValue_SdkHeartBeatResult extends SdkHeartBeatResult {
private final long millis;
private final String sdkName;
public AutoValue_SdkHeartBeatResult(String str, long j4) {
if (str == null) {
throw new NullPointerException("Null sdkName");
}
this.sdkName = str;
this.millis = j4;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof SdkHeartBeatResult) {
SdkHeartBeatResult sdkHeartBeatResult = (SdkHeartBeatResult) obj;
if (this.sdkName.equals(sdkHeartBeatResult.getSdkName()) && this.millis == sdkHeartBeatResult.getMillis()) {
return true;
}
}
return false;
}
@Override // com.google.firebase.heartbeatinfo.SdkHeartBeatResult
public long getMillis() {
return this.millis;
}
@Override // com.google.firebase.heartbeatinfo.SdkHeartBeatResult
public String getSdkName() {
return this.sdkName;
}
public int hashCode() {
int hashCode = (this.sdkName.hashCode() ^ 1000003) * 1000003;
long j4 = this.millis;
return ((int) (j4 ^ (j4 >>> 32))) ^ hashCode;
}
public String toString() {
StringBuilder sb = new StringBuilder("SdkHeartBeatResult{sdkName=");
sb.append(this.sdkName);
sb.append(", millis=");
return w.q(sb, this.millis, "}");
}
}

View File

@@ -0,0 +1,132 @@
package com.google.firebase.heartbeatinfo;
import K.k;
import android.content.Context;
import android.util.Base64OutputStream;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.FirebaseApp;
import com.google.firebase.annotations.concurrent.Background;
import com.google.firebase.components.Component;
import com.google.firebase.components.ComponentContainer;
import com.google.firebase.components.Dependency;
import com.google.firebase.components.Qualified;
import com.google.firebase.heartbeatinfo.HeartBeatInfo;
import com.google.firebase.inject.Provider;
import com.google.firebase.platforminfo.UserAgentPublisher;
import java.io.ByteArrayOutputStream;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.zip.GZIPOutputStream;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class DefaultHeartBeatController implements HeartBeatController, HeartBeatInfo {
private final Context applicationContext;
private final Executor backgroundExecutor;
private final Set<HeartBeatConsumer> consumers;
private final Provider<HeartBeatInfoStorage> storageProvider;
private final Provider<UserAgentPublisher> userAgentProvider;
private DefaultHeartBeatController(Context context, String str, Set<HeartBeatConsumer> set, Provider<UserAgentPublisher> provider, Executor executor) {
this(new com.google.firebase.a(context, str), set, executor, provider, context);
}
public static Component<DefaultHeartBeatController> component() {
Qualified qualified = Qualified.qualified(Background.class, Executor.class);
return Component.builder(DefaultHeartBeatController.class, HeartBeatController.class, HeartBeatInfo.class).add(Dependency.required((Class<?>) Context.class)).add(Dependency.required((Class<?>) FirebaseApp.class)).add(Dependency.setOf((Class<?>) HeartBeatConsumer.class)).add(Dependency.requiredProvider((Class<?>) UserAgentPublisher.class)).add(Dependency.required((Qualified<?>) qualified)).factory(new b(qualified, 0)).build();
}
public static /* synthetic */ DefaultHeartBeatController lambda$component$3(Qualified qualified, ComponentContainer componentContainer) {
return new DefaultHeartBeatController((Context) componentContainer.get(Context.class), ((FirebaseApp) componentContainer.get(FirebaseApp.class)).getPersistenceKey(), (Set<HeartBeatConsumer>) componentContainer.setOf(HeartBeatConsumer.class), (Provider<UserAgentPublisher>) componentContainer.getProvider(UserAgentPublisher.class), (Executor) componentContainer.get(qualified));
}
public /* synthetic */ String lambda$getHeartBeatsHeader$1() throws Exception {
String byteArrayOutputStream;
synchronized (this) {
try {
HeartBeatInfoStorage heartBeatInfoStorage = this.storageProvider.get();
List<HeartBeatResult> allHeartBeats = heartBeatInfoStorage.getAllHeartBeats();
heartBeatInfoStorage.deleteAllHeartBeats();
JSONArray jSONArray = new JSONArray();
for (int i = 0; i < allHeartBeats.size(); i++) {
HeartBeatResult heartBeatResult = allHeartBeats.get(i);
JSONObject jSONObject = new JSONObject();
jSONObject.put("agent", heartBeatResult.getUserAgent());
jSONObject.put("dates", new JSONArray((Collection) heartBeatResult.getUsedDates()));
jSONArray.put(jSONObject);
}
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("heartbeats", jSONArray);
jSONObject2.put("version", "2");
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
Base64OutputStream base64OutputStream = new Base64OutputStream(byteArrayOutputStream2, 11);
try {
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(base64OutputStream);
try {
gZIPOutputStream.write(jSONObject2.toString().getBytes("UTF-8"));
gZIPOutputStream.close();
base64OutputStream.close();
byteArrayOutputStream = byteArrayOutputStream2.toString("UTF-8");
} finally {
}
} catch (Throwable th) {
try {
base64OutputStream.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
throw th;
}
} catch (Throwable th3) {
throw th3;
}
}
return byteArrayOutputStream;
}
public static /* synthetic */ HeartBeatInfoStorage lambda$new$2(Context context, String str) {
return new HeartBeatInfoStorage(context, str);
}
public /* synthetic */ Void lambda$registerHeartBeat$0() throws Exception {
synchronized (this) {
this.storageProvider.get().storeHeartBeat(System.currentTimeMillis(), this.userAgentProvider.get().getUserAgent());
}
return null;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatInfo
public synchronized HeartBeatInfo.HeartBeat getHeartBeatCode(String str) {
long currentTimeMillis = System.currentTimeMillis();
HeartBeatInfoStorage heartBeatInfoStorage = this.storageProvider.get();
if (!heartBeatInfoStorage.shouldSendGlobalHeartBeat(currentTimeMillis)) {
return HeartBeatInfo.HeartBeat.NONE;
}
heartBeatInfoStorage.postHeartBeatCleanUp();
return HeartBeatInfo.HeartBeat.GLOBAL;
}
@Override // com.google.firebase.heartbeatinfo.HeartBeatController
public Task<String> getHeartBeatsHeader() {
return !k.a(this.applicationContext) ? Tasks.forResult("") : Tasks.call(this.backgroundExecutor, new a(this, 0));
}
public Task<Void> registerHeartBeat() {
if (this.consumers.size() > 0 && k.a(this.applicationContext)) {
return Tasks.call(this.backgroundExecutor, new a(this, 1));
}
return Tasks.forResult(null);
}
public DefaultHeartBeatController(Provider<HeartBeatInfoStorage> provider, Set<HeartBeatConsumer> set, Executor executor, Provider<UserAgentPublisher> provider2, Context context) {
this.storageProvider = provider;
this.consumers = set;
this.backgroundExecutor = executor;
this.userAgentProvider = provider2;
this.applicationContext = context;
}
}

View File

@@ -0,0 +1,5 @@
package com.google.firebase.heartbeatinfo;
/* loaded from: classes3.dex */
public interface HeartBeatConsumer {
}

View File

@@ -0,0 +1,14 @@
package com.google.firebase.heartbeatinfo;
import com.google.firebase.components.Component;
/* loaded from: classes3.dex */
public class HeartBeatConsumerComponent {
private HeartBeatConsumerComponent() {
}
public static Component<?> create() {
return Component.intoSet(new HeartBeatConsumer() { // from class: com.google.firebase.heartbeatinfo.HeartBeatConsumerComponent.1
}, (Class<HeartBeatConsumer>) HeartBeatConsumer.class);
}
}

View File

@@ -0,0 +1,8 @@
package com.google.firebase.heartbeatinfo;
import com.google.android.gms.tasks.Task;
/* loaded from: classes3.dex */
public interface HeartBeatController {
Task<String> getHeartBeatsHeader();
}

View File

@@ -0,0 +1,25 @@
package com.google.firebase.heartbeatinfo;
/* loaded from: classes3.dex */
public interface HeartBeatInfo {
/* loaded from: classes3.dex */
public enum HeartBeat {
NONE(0),
SDK(1),
GLOBAL(2),
COMBINED(3);
private final int code;
HeartBeat(int i) {
this.code = i;
}
public int getCode() {
return this.code;
}
}
HeartBeat getHeartBeatCode(String str);
}

View File

@@ -0,0 +1,211 @@
package com.google.firebase.heartbeatinfo;
import android.content.Context;
import android.content.SharedPreferences;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public class HeartBeatInfoStorage {
private static final String GLOBAL = "fire-global";
private static final String HEARTBEAT_PREFERENCES_NAME = "FirebaseHeartBeat";
private static final int HEART_BEAT_COUNT_LIMIT = 30;
private static final String HEART_BEAT_COUNT_TAG = "fire-count";
private static final String LAST_STORED_DATE = "last-used-date";
private static final String PREFERENCES_NAME = "FirebaseAppHeartBeat";
private static HeartBeatInfoStorage instance;
private final SharedPreferences firebaseSharedPreferences;
public HeartBeatInfoStorage(Context context, String str) {
this.firebaseSharedPreferences = context.getSharedPreferences(HEARTBEAT_PREFERENCES_NAME + str, 0);
}
private synchronized void cleanUpStoredHeartBeats() {
try {
long j4 = this.firebaseSharedPreferences.getLong(HEART_BEAT_COUNT_TAG, 0L);
String str = "";
String str2 = null;
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
for (String str3 : (Set) entry.getValue()) {
if (str2 != null && str2.compareTo(str3) <= 0) {
}
str = entry.getKey();
str2 = str3;
}
}
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.remove(str2);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).putLong(HEART_BEAT_COUNT_TAG, j4 - 1).commit();
} catch (Throwable th) {
throw th;
}
}
private synchronized String getFormattedDate(long j4) {
return new Date(j4).toInstant().atOffset(ZoneOffset.UTC).toLocalDateTime().format(DateTimeFormatter.ISO_LOCAL_DATE);
}
private synchronized String getStoredUserAgentString(String str) {
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
Iterator it = ((Set) entry.getValue()).iterator();
while (it.hasNext()) {
if (str.equals((String) it.next())) {
return entry.getKey();
}
}
}
}
return null;
}
private synchronized void removeStoredDate(String str) {
try {
String storedUserAgentString = getStoredUserAgentString(str);
if (storedUserAgentString == null) {
return;
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(storedUserAgentString, new HashSet()));
hashSet.remove(str);
if (hashSet.isEmpty()) {
this.firebaseSharedPreferences.edit().remove(storedUserAgentString).commit();
} else {
this.firebaseSharedPreferences.edit().putStringSet(storedUserAgentString, hashSet).commit();
}
} catch (Throwable th) {
throw th;
}
}
private synchronized void updateStoredUserAgent(String str, String str2) {
removeStoredDate(str2);
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.add(str2);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).commit();
}
public synchronized void deleteAllHeartBeats() {
try {
SharedPreferences.Editor edit = this.firebaseSharedPreferences.edit();
int i = 0;
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
Set set = (Set) entry.getValue();
String formattedDate = getFormattedDate(System.currentTimeMillis());
String key = entry.getKey();
if (set.contains(formattedDate)) {
HashSet hashSet = new HashSet();
hashSet.add(formattedDate);
i++;
edit.putStringSet(key, hashSet);
} else {
edit.remove(key);
}
}
}
if (i == 0) {
edit.remove(HEART_BEAT_COUNT_TAG);
} else {
edit.putLong(HEART_BEAT_COUNT_TAG, i);
}
edit.commit();
} catch (Throwable th) {
throw th;
}
}
public synchronized List<HeartBeatResult> getAllHeartBeats() {
ArrayList arrayList;
try {
arrayList = new ArrayList();
for (Map.Entry<String, ?> entry : this.firebaseSharedPreferences.getAll().entrySet()) {
if (entry.getValue() instanceof Set) {
HashSet hashSet = new HashSet((Set) entry.getValue());
hashSet.remove(getFormattedDate(System.currentTimeMillis()));
if (!hashSet.isEmpty()) {
arrayList.add(HeartBeatResult.create(entry.getKey(), new ArrayList(hashSet)));
}
}
}
updateGlobalHeartBeat(System.currentTimeMillis());
} catch (Throwable th) {
throw th;
}
return arrayList;
}
public int getHeartBeatCount() {
return (int) this.firebaseSharedPreferences.getLong(HEART_BEAT_COUNT_TAG, 0L);
}
public synchronized long getLastGlobalHeartBeat() {
return this.firebaseSharedPreferences.getLong(GLOBAL, -1L);
}
public synchronized boolean isSameDateUtc(long j4, long j5) {
return getFormattedDate(j4).equals(getFormattedDate(j5));
}
public synchronized void postHeartBeatCleanUp() {
String formattedDate = getFormattedDate(System.currentTimeMillis());
this.firebaseSharedPreferences.edit().putString(LAST_STORED_DATE, formattedDate).commit();
removeStoredDate(formattedDate);
}
public synchronized boolean shouldSendGlobalHeartBeat(long j4) {
return shouldSendSdkHeartBeat(GLOBAL, j4);
}
public synchronized boolean shouldSendSdkHeartBeat(String str, long j4) {
if (!this.firebaseSharedPreferences.contains(str)) {
this.firebaseSharedPreferences.edit().putLong(str, j4).commit();
return true;
}
if (isSameDateUtc(this.firebaseSharedPreferences.getLong(str, -1L), j4)) {
return false;
}
this.firebaseSharedPreferences.edit().putLong(str, j4).commit();
return true;
}
public synchronized void storeHeartBeat(long j4, String str) {
String formattedDate = getFormattedDate(j4);
if (this.firebaseSharedPreferences.getString(LAST_STORED_DATE, "").equals(formattedDate)) {
String storedUserAgentString = getStoredUserAgentString(formattedDate);
if (storedUserAgentString == null) {
return;
}
if (storedUserAgentString.equals(str)) {
return;
}
updateStoredUserAgent(str, formattedDate);
return;
}
long j5 = this.firebaseSharedPreferences.getLong(HEART_BEAT_COUNT_TAG, 0L);
if (j5 + 1 == 30) {
cleanUpStoredHeartBeats();
j5 = this.firebaseSharedPreferences.getLong(HEART_BEAT_COUNT_TAG, 0L);
}
HashSet hashSet = new HashSet(this.firebaseSharedPreferences.getStringSet(str, new HashSet()));
hashSet.add(formattedDate);
this.firebaseSharedPreferences.edit().putStringSet(str, hashSet).putLong(HEART_BEAT_COUNT_TAG, j5 + 1).putString(LAST_STORED_DATE, formattedDate).commit();
}
public synchronized void updateGlobalHeartBeat(long j4) {
this.firebaseSharedPreferences.edit().putLong(GLOBAL, j4).commit();
}
public HeartBeatInfoStorage(SharedPreferences sharedPreferences) {
this.firebaseSharedPreferences = sharedPreferences;
}
}

View File

@@ -0,0 +1,16 @@
package com.google.firebase.heartbeatinfo;
import com.google.auto.value.AutoValue;
import java.util.List;
@AutoValue
/* loaded from: classes3.dex */
public abstract class HeartBeatResult {
public static HeartBeatResult create(String str, List<String> list) {
return new AutoValue_HeartBeatResult(str, list);
}
public abstract List<String> getUsedDates();
public abstract String getUserAgent();
}

View File

@@ -0,0 +1,20 @@
package com.google.firebase.heartbeatinfo;
import com.google.auto.value.AutoValue;
@AutoValue
/* loaded from: classes3.dex */
public abstract class SdkHeartBeatResult implements Comparable<SdkHeartBeatResult> {
public static SdkHeartBeatResult create(String str, long j4) {
return new AutoValue_SdkHeartBeatResult(str, j4);
}
public abstract long getMillis();
public abstract String getSdkName();
@Override // java.lang.Comparable
public int compareTo(SdkHeartBeatResult sdkHeartBeatResult) {
return getMillis() < sdkHeartBeatResult.getMillis() ? -1 : 1;
}
}

View File

@@ -0,0 +1,30 @@
package com.google.firebase.heartbeatinfo;
import java.util.concurrent.Callable;
/* loaded from: classes3.dex */
public final /* synthetic */ class a implements Callable {
/* renamed from: a, reason: collision with root package name */
public final /* synthetic */ int f5986a;
/* renamed from: b, reason: collision with root package name */
public final /* synthetic */ DefaultHeartBeatController f5987b;
public /* synthetic */ a(DefaultHeartBeatController defaultHeartBeatController, int i) {
this.f5986a = i;
this.f5987b = defaultHeartBeatController;
}
@Override // java.util.concurrent.Callable
public final Object call() {
int i = this.f5986a;
DefaultHeartBeatController defaultHeartBeatController = this.f5987b;
switch (i) {
case 0:
return DefaultHeartBeatController.a(defaultHeartBeatController);
default:
return DefaultHeartBeatController.d(defaultHeartBeatController);
}
}
}

View File

@@ -0,0 +1,38 @@
package com.google.firebase.heartbeatinfo;
import com.google.firebase.components.ComponentContainer;
import com.google.firebase.components.ComponentFactory;
import com.google.firebase.components.Qualified;
import com.google.firebase.crashlytics.CrashlyticsRegistrar;
import com.google.firebase.remoteconfig.RemoteConfigRegistrar;
/* loaded from: classes3.dex */
public final /* synthetic */ class b implements ComponentFactory {
/* renamed from: a, reason: collision with root package name */
public final /* synthetic */ int f5988a;
/* renamed from: b, reason: collision with root package name */
public final /* synthetic */ Object f5989b;
public /* synthetic */ b(Object obj, int i) {
this.f5988a = i;
this.f5989b = obj;
}
@Override // com.google.firebase.components.ComponentFactory
public final Object create(ComponentContainer componentContainer) {
DefaultHeartBeatController lambda$component$3;
int i = this.f5988a;
Object obj = this.f5989b;
switch (i) {
case 0:
lambda$component$3 = DefaultHeartBeatController.lambda$component$3((Qualified) obj, componentContainer);
return lambda$component$3;
case 1:
return RemoteConfigRegistrar.a((Qualified) obj, componentContainer);
default:
return CrashlyticsRegistrar.a((CrashlyticsRegistrar) obj, componentContainer);
}
}
}