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,314 @@
package com.google.android.gms.ads.identifier;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log;
import com.google.android.gms.common.BlockingServiceConnection;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.common.GooglePlayServicesUtilLight;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.annotation.KeepForSdkWithMembers;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.internal.ShowFirstParty;
import com.google.android.gms.common.stats.ConnectionTracker;
import com.google.android.gms.common.util.VisibleForTesting;
import com.google.android.gms.internal.ads_identifier.zze;
import com.google.android.gms.internal.ads_identifier.zzf;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.firebase.messaging.Constants;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
@KeepForSdk
/* loaded from: classes3.dex */
public class AdvertisingIdClient {
BlockingServiceConnection zza;
zzf zzb;
boolean zzc;
final Object zzd;
zzb zze;
final long zzf;
private final Context zzg;
@KeepForSdkWithMembers
/* loaded from: classes3.dex */
public static final class Info {
private final String zza;
private final boolean zzb;
@Deprecated
public Info(String str, boolean z3) {
this.zza = str;
this.zzb = z3;
}
public String getId() {
return this.zza;
}
public boolean isLimitAdTrackingEnabled() {
return this.zzb;
}
public String toString() {
String str = this.zza;
boolean z3 = this.zzb;
StringBuilder sb = new StringBuilder(String.valueOf(str).length() + 7);
sb.append("{");
sb.append(str);
sb.append("}");
sb.append(z3);
return sb.toString();
}
}
@KeepForSdk
public AdvertisingIdClient(Context context) {
this(context, 30000L, false, false);
}
@KeepForSdk
public static Info getAdvertisingIdInfo(Context context) throws IOException, IllegalStateException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
AdvertisingIdClient advertisingIdClient = new AdvertisingIdClient(context, -1L, true, false);
try {
long elapsedRealtime = SystemClock.elapsedRealtime();
advertisingIdClient.zzb(false);
Info zzd = advertisingIdClient.zzd(-1);
advertisingIdClient.zzc(zzd, true, BitmapDescriptorFactory.HUE_RED, SystemClock.elapsedRealtime() - elapsedRealtime, "", null);
return zzd;
} finally {
}
}
@KeepForSdk
public static boolean getIsAdIdFakeForDebugLogging(Context context) throws IOException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
boolean zzd;
AdvertisingIdClient advertisingIdClient = new AdvertisingIdClient(context, -1L, false, false);
try {
advertisingIdClient.zzb(false);
Preconditions.checkNotMainThread("Calling this from your main thread can lead to deadlock");
synchronized (advertisingIdClient) {
try {
if (!advertisingIdClient.zzc) {
synchronized (advertisingIdClient.zzd) {
zzb zzbVar = advertisingIdClient.zze;
if (zzbVar == null || !zzbVar.zzb) {
throw new IOException("AdvertisingIdClient is not connected.");
}
}
try {
advertisingIdClient.zzb(false);
if (!advertisingIdClient.zzc) {
throw new IOException("AdvertisingIdClient cannot reconnect.");
}
} catch (Exception e4) {
throw new IOException("AdvertisingIdClient cannot reconnect.", e4);
}
}
Preconditions.checkNotNull(advertisingIdClient.zza);
Preconditions.checkNotNull(advertisingIdClient.zzb);
try {
zzd = advertisingIdClient.zzb.zzd();
} catch (RemoteException e5) {
Log.i("AdvertisingIdClient", "GMS remote exception ", e5);
throw new IOException("Remote exception");
}
} catch (Throwable th) {
throw th;
}
}
advertisingIdClient.zze();
advertisingIdClient.zza();
return zzd;
} catch (Throwable th2) {
advertisingIdClient.zza();
throw th2;
}
}
@ShowFirstParty
@KeepForSdk
public static void setShouldSkipGmsCoreVersionCheck(boolean z3) {
}
private final Info zzd(int i) throws IOException {
Info info;
Preconditions.checkNotMainThread("Calling this from your main thread can lead to deadlock");
synchronized (this) {
try {
if (!this.zzc) {
synchronized (this.zzd) {
zzb zzbVar = this.zze;
if (zzbVar == null || !zzbVar.zzb) {
throw new IOException("AdvertisingIdClient is not connected.");
}
}
try {
zzb(false);
if (!this.zzc) {
throw new IOException("AdvertisingIdClient cannot reconnect.");
}
} catch (Exception e4) {
throw new IOException("AdvertisingIdClient cannot reconnect.", e4);
}
}
Preconditions.checkNotNull(this.zza);
Preconditions.checkNotNull(this.zzb);
try {
info = new Info(this.zzb.zzc(), this.zzb.zze(true));
} catch (RemoteException e5) {
Log.i("AdvertisingIdClient", "GMS remote exception ", e5);
throw new IOException("Remote exception");
}
} catch (Throwable th) {
throw th;
}
}
zze();
return info;
}
private final void zze() {
synchronized (this.zzd) {
zzb zzbVar = this.zze;
if (zzbVar != null) {
zzbVar.zza.countDown();
try {
this.zze.join();
} catch (InterruptedException unused) {
}
}
long j4 = this.zzf;
if (j4 > 0) {
this.zze = new zzb(this, j4);
}
}
}
public final void finalize() throws Throwable {
zza();
super.finalize();
}
@KeepForSdk
public Info getInfo() throws IOException {
return zzd(-1);
}
@KeepForSdk
public void start() throws IOException, IllegalStateException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
zzb(true);
}
public final void zza() {
Preconditions.checkNotMainThread("Calling this from your main thread can lead to deadlock");
synchronized (this) {
try {
if (this.zzg == null || this.zza == null) {
return;
}
try {
if (this.zzc) {
ConnectionTracker.getInstance().unbindService(this.zzg, this.zza);
}
} catch (Throwable th) {
Log.i("AdvertisingIdClient", "AdvertisingIdClient unbindService failed.", th);
}
this.zzc = false;
this.zzb = null;
this.zza = null;
} catch (Throwable th2) {
throw th2;
}
}
}
@VisibleForTesting
public final void zzb(boolean z3) throws IOException, IllegalStateException, GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException {
Preconditions.checkNotMainThread("Calling this from your main thread can lead to deadlock");
synchronized (this) {
try {
if (this.zzc) {
zza();
}
Context context = this.zzg;
try {
context.getPackageManager().getPackageInfo("com.android.vending", 0);
int isGooglePlayServicesAvailable = GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(context, GooglePlayServicesUtilLight.GOOGLE_PLAY_SERVICES_VERSION_CODE);
if (isGooglePlayServicesAvailable != 0 && isGooglePlayServicesAvailable != 2) {
throw new IOException("Google Play services not available");
}
BlockingServiceConnection blockingServiceConnection = new BlockingServiceConnection();
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
intent.setPackage("com.google.android.gms");
try {
if (!ConnectionTracker.getInstance().bindService(context, intent, blockingServiceConnection, 1)) {
throw new IOException("Connection failure");
}
this.zza = blockingServiceConnection;
try {
this.zzb = zze.zza(blockingServiceConnection.getServiceWithTimeout(10000L, TimeUnit.MILLISECONDS));
this.zzc = true;
if (z3) {
zze();
}
} catch (InterruptedException unused) {
throw new IOException("Interrupted exception");
} catch (Throwable th) {
throw new IOException(th);
}
} finally {
IOException iOException = new IOException(th);
}
} catch (PackageManager.NameNotFoundException unused2) {
throw new GooglePlayServicesNotAvailableException(9);
}
} catch (Throwable th2) {
throw th2;
}
}
}
@VisibleForTesting
public final boolean zzc(Info info, boolean z3, float f2, long j4, String str, Throwable th) {
if (Math.random() > FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
return false;
}
HashMap hashMap = new HashMap();
hashMap.put("app_context", "1");
if (info != null) {
hashMap.put("limit_ad_tracking", true != info.isLimitAdTrackingEnabled() ? "0" : "1");
String id = info.getId();
if (id != null) {
hashMap.put("ad_id_size", Integer.toString(id.length()));
}
}
if (th != null) {
hashMap.put(Constants.IPC_BUNDLE_KEY_SEND_ERROR, th.getClass().getName());
}
hashMap.put("tag", "AdvertisingIdClient");
hashMap.put("time_spent", Long.toString(j4));
new zza(this, hashMap).start();
return true;
}
@VisibleForTesting
public AdvertisingIdClient(Context context, long j4, boolean z3, boolean z4) {
Context applicationContext;
this.zzd = new Object();
Preconditions.checkNotNull(context);
if (z3 && (applicationContext = context.getApplicationContext()) != null) {
context = applicationContext;
}
this.zzg = context;
this.zzc = false;
this.zzf = j4;
}
}

View File

@@ -0,0 +1,23 @@
package com.google.android.gms.ads.identifier;
import android.net.Uri;
import java.util.Map;
/* loaded from: classes3.dex */
final class zza extends Thread {
final /* synthetic */ Map zza;
public zza(AdvertisingIdClient advertisingIdClient, Map map) {
this.zza = map;
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
Map map = this.zza;
Uri.Builder buildUpon = Uri.parse("https://pagead2.googlesyndication.com/pagead/gen_204?id=gmob-apps").buildUpon();
for (String str : map.keySet()) {
buildUpon.appendQueryParameter(str, (String) map.get(str));
}
zzc.zza(buildUpon.build().toString());
}
}

View File

@@ -0,0 +1,41 @@
package com.google.android.gms.ads.identifier;
import com.google.android.gms.common.util.VisibleForTesting;
import java.lang.ref.WeakReference;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@VisibleForTesting
/* loaded from: classes3.dex */
final class zzb extends Thread {
final CountDownLatch zza = new CountDownLatch(1);
boolean zzb = false;
private final WeakReference<AdvertisingIdClient> zzc;
private final long zzd;
public zzb(AdvertisingIdClient advertisingIdClient, long j4) {
this.zzc = new WeakReference<>(advertisingIdClient);
this.zzd = j4;
start();
}
private final void zza() {
AdvertisingIdClient advertisingIdClient = this.zzc.get();
if (advertisingIdClient != null) {
advertisingIdClient.zza();
this.zzb = true;
}
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
try {
if (this.zza.await(this.zzd, TimeUnit.MILLISECONDS)) {
return;
}
zza();
} catch (InterruptedException unused) {
zza();
}
}
}

View File

@@ -0,0 +1,48 @@
package com.google.android.gms.ads.identifier;
import android.util.Log;
import com.google.android.gms.internal.ads_identifier.zzi;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/* loaded from: classes3.dex */
public final class zzc {
public static final void zza(String str) {
try {
zzi.zzb(263);
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
try {
int responseCode = httpURLConnection.getResponseCode();
if (responseCode < 200 || responseCode >= 300) {
StringBuilder sb = new StringBuilder(String.valueOf(str).length() + 65);
sb.append("Received non-success response code ");
sb.append(responseCode);
sb.append(" from pinging URL: ");
sb.append(str);
Log.w("HttpUrlPinger", sb.toString());
}
} finally {
httpURLConnection.disconnect();
}
} catch (IndexOutOfBoundsException e4) {
String message = e4.getMessage();
StringBuilder sb2 = new StringBuilder(String.valueOf(str).length() + 32 + String.valueOf(message).length());
sb2.append("Error while parsing ping URL: ");
sb2.append(str);
sb2.append(". ");
sb2.append(message);
Log.w("HttpUrlPinger", sb2.toString(), e4);
} catch (IOException | RuntimeException e5) {
String message2 = e5.getMessage();
StringBuilder sb3 = new StringBuilder(String.valueOf(str).length() + 27 + String.valueOf(message2).length());
sb3.append("Error while pinging URL: ");
sb3.append(str);
sb3.append(". ");
sb3.append(message2);
Log.w("HttpUrlPinger", sb3.toString(), e5);
} finally {
zzi.zza();
}
}
}