Compare commits
2 Commits
v1.3-potat
...
v4.0-unive
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bba61b68d6 | ||
|
|
157bf7db2e |
@@ -9,13 +9,15 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.cbcren.vpn"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 4
|
||||
versionName "1.3-potato"
|
||||
targetSdkVersion 34 // Compatible con Android 14/15/16
|
||||
versionCode 8
|
||||
versionName "4.0-universal-embedded"
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
// ¡IMPORTANTE! Habilitar ambas arquitecturas
|
||||
ndk {
|
||||
// Forzar solo 32 bits (ARMv7). Muchas cajas chinas crashean si intentan cargar 64 bits o x86.
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +31,7 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// Motor WireGuard Embebido (Versión estable 2021)
|
||||
implementation 'com.wireguard.android:tunnel:1.0.20211029'
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#Mon Feb 09 23:07:19 CET 2026
|
||||
#Tue Feb 10 00:24:44 CET 2026
|
||||
com.cbcren.vpn.app-main-15\:/mipmap-anydpi-v26/ic_launcher.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/mipmap-anydpi-v26_ic_launcher.xml.flat
|
||||
com.cbcren.vpn.app-main-15\:/layout/activity_main.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/layout_activity_main.xml.flat
|
||||
com.cbcren.vpn.app-main-15\:/drawable/ic_launcher_foreground.xml=/home/ren/androidtv/app/build/intermediates/merged_res/debug/drawable_ic_launcher_foreground.xml.flat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Mon Feb 09 23:07:20 CET 2026
|
||||
#Tue Feb 10 00:24:45 CET 2026
|
||||
com.cbcren.vpn.app-main-5\:/drawable/ic_launcher_foreground.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/drawable/ic_launcher_foreground.xml
|
||||
com.cbcren.vpn.app-main-5\:/layout/activity_main.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/layout/activity_main.xml
|
||||
com.cbcren.vpn.app-main-5\:/mipmap-anydpi-v26/ic_launcher.xml=/home/ren/androidtv/app/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="4"
|
||||
android:versionName="1.3-potato" >
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="33" />
|
||||
android:targetSdkVersion="34" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
@@ -21,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -34,6 +36,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="4"
|
||||
android:versionName="1.3-potato" >
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="33" />
|
||||
android:targetSdkVersion="34" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
@@ -21,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -34,6 +36,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 4,
|
||||
"versionName": "1.3-potato",
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@@ -1,14 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.cbcren.vpn"
|
||||
android:versionCode="4"
|
||||
android:versionName="1.3-potato" >
|
||||
android:versionCode="8"
|
||||
android:versionName="4.0-universal-embedded" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="21"
|
||||
android:targetSdkVersion="33" />
|
||||
android:targetSdkVersion="34" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
@@ -21,7 +23,7 @@
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:debuggable="true"
|
||||
android:label="Xuper VPN"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar" >
|
||||
<activity
|
||||
android:name="com.cbcren.vpn.MainActivity"
|
||||
@@ -34,6 +36,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service
|
||||
android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 4,
|
||||
"versionName": "1.3-potato",
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="32dp"
|
||||
android:background="#121212">
|
||||
android:background="#222222">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statusText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Listo para conectar"
|
||||
android:text="XUPER VPN UNIVERSAL"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectBtn"
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ACTIVAR (60s)"
|
||||
android:padding="16dp"/>
|
||||
android:text="INICIAR"
|
||||
android:padding="20dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 4,
|
||||
"versionName": "1.3-potato",
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"outputFile": "resources-debug.ap_"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 4,
|
||||
"versionName": "1.3-potato",
|
||||
"versionCode": 8,
|
||||
"versionName": "4.0-universal-embedded",
|
||||
"outputFile": "app-debug.apk"
|
||||
}
|
||||
],
|
||||
|
||||
Binary file not shown.
@@ -3,12 +3,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
|
||||
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
|
||||
<application
|
||||
android:label="Xuper VPN"
|
||||
android:label="Xuper VPN Universal"
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
|
||||
|
||||
@@ -21,6 +23,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Servicio VPN Embebido (Parcheado para Android 12+) -->
|
||||
<service android:name="com.wireguard.android.backend.GoBackend$VpnService"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.cbcren.vpn;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.os.Handler;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
// Imports de WireGuard
|
||||
// Imports del Motor Embebido
|
||||
import com.wireguard.android.backend.Backend;
|
||||
import com.wireguard.android.backend.GoBackend;
|
||||
import com.wireguard.android.backend.Tunnel;
|
||||
@@ -19,23 +21,24 @@ import com.wireguard.config.Peer;
|
||||
import com.wireguard.config.InetEndpoint;
|
||||
import com.wireguard.config.InetNetwork;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private TextView statusText;
|
||||
private Button connectBtn;
|
||||
private Backend backend;
|
||||
private Config config;
|
||||
private Tunnel tunnel;
|
||||
private CountDownTimer timer;
|
||||
|
||||
// --- CONFIGURACIÓN QUEMADA ---
|
||||
// --- CONFIGURACIÓN WIREGUARD ---
|
||||
private static final String CLIENT_PRIV_KEY = "ULfX2KspqzSv9cgfvYxGjbL/3FkOS27iCVCyL+LWGmE=";
|
||||
private static final String SERVER_PUB_KEY = "44dNaTOCc/nY6vkqy3fJ+L1RqWDqFqEaEq1IBL/InRM=";
|
||||
private static final String SERVER_ENDPOINT = "194.163.191.200:51820";
|
||||
private static final String CLIENT_IP = "10.66.66.2/32";
|
||||
// -----------------------------
|
||||
|
||||
// --- CONFIGURACIÓN APP OBJETIVO ---
|
||||
private static final String TARGET_PACKAGE = "com.android.mgstv"; // XuperTV
|
||||
// ----------------------------------
|
||||
|
||||
private Backend backend;
|
||||
private Tunnel tunnel;
|
||||
private Config config;
|
||||
private TextView statusText;
|
||||
private Button connectBtn;
|
||||
private CountDownTimer timer;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -44,17 +47,30 @@ public class MainActivity extends Activity {
|
||||
|
||||
statusText = findViewById(R.id.statusText);
|
||||
connectBtn = findViewById(R.id.connectBtn);
|
||||
connectBtn.setText("ACTIVAR Y ABRIR TV");
|
||||
|
||||
// Inicializar Backend
|
||||
// 1. Inicializar Motor VPN
|
||||
try {
|
||||
backend = new GoBackend(getApplicationContext());
|
||||
tunnel = new SimpleTunnel("XuperTunnel");
|
||||
tunnel = new SimpleTunnel("XuperVPN");
|
||||
config = createConfig();
|
||||
} catch (Exception e) {
|
||||
statusText.setText("Error Init: " + e.getMessage());
|
||||
statusText.setText("Error Motor VPN: " + e.getMessage());
|
||||
connectBtn.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
connectBtn.setOnClickListener(v -> startVpnSequence());
|
||||
// 2. Verificar XuperTV
|
||||
if (!isPackageInstalled(TARGET_PACKAGE)) {
|
||||
Toast.makeText(this, "Aviso: XuperTV no detectada", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
connectBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startVpnSequence();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Config createConfig() throws Exception {
|
||||
@@ -66,7 +82,7 @@ public class MainActivity extends Activity {
|
||||
Peer.Builder peerBuilder = new Peer.Builder();
|
||||
peerBuilder.parsePublicKey(SERVER_PUB_KEY);
|
||||
peerBuilder.parseEndpoint(SERVER_ENDPOINT);
|
||||
peerBuilder.parseAllowedIPs("0.0.0.0/0"); // Todo por el tunel
|
||||
peerBuilder.parseAllowedIPs("0.0.0.0/0");
|
||||
|
||||
return new Config.Builder()
|
||||
.setInterface(interfaceBuilder.build())
|
||||
@@ -75,19 +91,13 @@ public class MainActivity extends Activity {
|
||||
}
|
||||
|
||||
private void startVpnSequence() {
|
||||
if (backend == null) return;
|
||||
|
||||
connectBtn.setEnabled(false);
|
||||
statusText.setText("Conectando...");
|
||||
|
||||
// Lanzar Intent de VPN (El sistema pedirá permiso la primera vez)
|
||||
// Pedir permiso de VPN al sistema (Android dialog)
|
||||
Intent intent = GoBackend.VpnService.prepare(this);
|
||||
if (intent != null) {
|
||||
startActivityForResult(intent, 0);
|
||||
return;
|
||||
} else {
|
||||
onActivityResult(0, RESULT_OK, null);
|
||||
}
|
||||
|
||||
connectTunnel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,36 +105,44 @@ public class MainActivity extends Activity {
|
||||
if (resultCode == RESULT_OK) {
|
||||
connectTunnel();
|
||||
} else {
|
||||
statusText.setText("Permiso denegado");
|
||||
connectBtn.setEnabled(true);
|
||||
statusText.setText("Permiso de VPN denegado");
|
||||
}
|
||||
}
|
||||
|
||||
private void connectTunnel() {
|
||||
try {
|
||||
// Si ya está corriendo, apagar primero
|
||||
backend.setState(tunnel, Tunnel.State.DOWN, null);
|
||||
// Asegurar limpieza
|
||||
try { backend.setState(tunnel, Tunnel.State.DOWN, null); } catch (Exception e) {}
|
||||
|
||||
// Encender
|
||||
// CONECTAR
|
||||
backend.setState(tunnel, Tunnel.State.UP, config);
|
||||
|
||||
startTimer();
|
||||
} catch (Exception e) {
|
||||
statusText.setText("Error Conexión: " + e.getMessage());
|
||||
connectBtn.setEnabled(true);
|
||||
}
|
||||
}
|
||||
statusText.setText("CONECTADO.\nLanzando TV en 2s...");
|
||||
connectBtn.setEnabled(false);
|
||||
|
||||
private void startTimer() {
|
||||
// Auto-Launch XuperTV
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
launchTargetApp();
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
// Temporizador 60s
|
||||
timer = new CountDownTimer(60000, 1000) {
|
||||
public void onTick(long millisUntilFinished) {
|
||||
statusText.setText("VPN ACTIVA\n" + (millisUntilFinished / 1000) + " segundos");
|
||||
statusText.setText("VPN ACTIVA: " + millisUntilFinished / 1000 + "s");
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
disconnectTunnel();
|
||||
}
|
||||
}.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
statusText.setText("Error Conexión: " + e.getMessage());
|
||||
connectBtn.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void disconnectTunnel() {
|
||||
@@ -132,15 +150,35 @@ public class MainActivity extends Activity {
|
||||
if (backend != null) {
|
||||
backend.setState(tunnel, Tunnel.State.DOWN, null);
|
||||
}
|
||||
statusText.setText("Desconectado.\nAbre XuperTV.");
|
||||
statusText.setText("DESCONECTADO.\nListo.");
|
||||
connectBtn.setEnabled(true);
|
||||
connectBtn.setText("RECONECTAR");
|
||||
connectBtn.setText("REINICIAR");
|
||||
} catch (Exception e) {
|
||||
// Ignorar
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPackageInstalled(String packageName) {
|
||||
try {
|
||||
getPackageManager().getPackageInfo(packageName, 0);
|
||||
return true;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void launchTargetApp() {
|
||||
try {
|
||||
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(TARGET_PACKAGE);
|
||||
if (launchIntent != null) {
|
||||
startActivity(launchIntent);
|
||||
Toast.makeText(this, "Abriendo XuperTV...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignorar
|
||||
}
|
||||
}
|
||||
|
||||
// Clase auxiliar simple para identificar el tunel
|
||||
private static class SimpleTunnel implements Tunnel {
|
||||
private final String name;
|
||||
SimpleTunnel(String name) { this.name = name; }
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="32dp"
|
||||
android:background="#121212">
|
||||
android:background="#222222">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/statusText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Listo para conectar"
|
||||
android:text="XUPER VPN UNIVERSAL"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
@@ -19,9 +19,10 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/connectBtn"
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ACTIVAR (60s)"
|
||||
android:padding="16dp"/>
|
||||
android:text="INICIAR"
|
||||
android:padding="20dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user