Updating android app
This commit is contained in:
parent
89e7d0989f
commit
485c711a3e
@ -23,6 +23,7 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
@ -52,10 +53,10 @@ task deleteLibs(type: Delete) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//preBuild.dependsOn deleteLibs
|
preBuild.dependsOn deleteLibs
|
||||||
//preBuild.dependsOn downloadAarch
|
preBuild.dependsOn downloadAarch
|
||||||
/*preBuild.dependsOn downloadArmeabi
|
preBuild.dependsOn downloadArmeabi
|
||||||
preBuild.dependsOn downloadx86*/
|
preBuild.dependsOn downloadx86
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation libs.appcompat
|
implementation libs.appcompat
|
||||||
|
@ -7,24 +7,26 @@
|
|||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:hardwareAccelerated="true"
|
|
||||||
android:extractNativeLibs="true"
|
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:extractNativeLibs="true"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.FridaApp"
|
android:theme="@style/Theme.FridaApp"
|
||||||
tools:targetApi="34"
|
tools:replace="android:allowBackup"
|
||||||
tools:replace="android:allowBackup">
|
tools:targetApi="34">
|
||||||
|
<activity
|
||||||
|
android:name=".activity.SingleConfigActivity"
|
||||||
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:exported="true">
|
android:exported="true"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
@ -33,11 +35,14 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="com.alterdekim.fridaapp.service.FridaService"
|
android:name=".service.FridaService"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
android:foregroundServiceType="specialUse"
|
||||||
android:foregroundServiceType="specialUse">
|
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="vpn" />
|
<property
|
||||||
|
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||||
|
android:value="vpn" />
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.VpnService" />
|
<action android:name="android.net.VpnService" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -8,7 +8,7 @@ public class FridaLib {
|
|||||||
System.loadLibrary("frida");
|
System.loadLibrary("frida");
|
||||||
}
|
}
|
||||||
|
|
||||||
public native int start(String config_hex, int tun_fd, boolean close_fd_on_drop);
|
public native int start(String config_hex, int tun_fd, boolean close_fd_on_drop, String temp_file);
|
||||||
|
|
||||||
public native int stop();
|
public native int stop();
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.alterdekim.fridaapp.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
|
import com.alterdekim.fridaapp.R;
|
||||||
|
|
||||||
|
public class SingleConfigActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
setContentView(R.layout.activity_single_config);
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,6 @@ public class MainActivityController implements IController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initConfigListGUI() {
|
private void initConfigListGUI() {
|
||||||
Toast.makeText(this.mainActivity, R.string.config_adding_success, Toast.LENGTH_LONG).show();
|
|
||||||
LayoutInflater inflater = this.mainActivity.getLayoutInflater();
|
LayoutInflater inflater = this.mainActivity.getLayoutInflater();
|
||||||
this.db.userDao().getAll()
|
this.db.userDao().getAll()
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
package com.alterdekim.fridaapp.service;
|
package com.alterdekim.fridaapp.service;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.VpnService;
|
import android.net.VpnService;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.alterdekim.frida.FridaLib;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
|
||||||
import io.reactivex.rxjava3.core.Flowable;
|
import io.reactivex.rxjava3.core.Flowable;
|
||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
import io.reactivex.rxjava3.functions.Consumer;
|
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
|
||||||
|
|
||||||
public class FridaService extends VpnService {
|
public class FridaService extends VpnService {
|
||||||
private static final String TAG = FridaService.class.getSimpleName();
|
private static final String TAG = FridaService.class.getSimpleName();
|
||||||
@ -22,16 +25,40 @@ public class FridaService extends VpnService {
|
|||||||
|
|
||||||
private ParcelFileDescriptor vpnInterface = null;
|
private ParcelFileDescriptor vpnInterface = null;
|
||||||
|
|
||||||
|
private String logPath;
|
||||||
|
|
||||||
private Disposable vpnProcess;
|
private Disposable vpnProcess;
|
||||||
|
|
||||||
|
private final FridaLib lib = new FridaLib();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
Log.i(TAG, "Created");
|
Log.i(TAG, "Created");
|
||||||
setupVPN();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupVPN() {
|
private void setupVPN() {
|
||||||
try {
|
try {
|
||||||
|
File outputDir = this.getCacheDir(); // context being the Activity pointer
|
||||||
|
File outputFile = new File(outputDir, "fridalib.log");
|
||||||
|
if( outputFile.exists() ) { outputFile.delete(); }
|
||||||
|
outputFile.createNewFile();
|
||||||
|
this.logPath = outputFile.getAbsolutePath();
|
||||||
|
Log.i(TAG, logPath);
|
||||||
|
/*new Thread(() -> {
|
||||||
|
try {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(outputFile)));
|
||||||
|
String str = "";
|
||||||
|
Log.i(TAG, "Reading fd has started");
|
||||||
|
while (true) {
|
||||||
|
if((str = br.readLine()) != null) {
|
||||||
|
Log.i(TAG, str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, e.getMessage());
|
||||||
|
}
|
||||||
|
}).start();*/
|
||||||
|
|
||||||
Builder builder = new Builder();
|
Builder builder = new Builder();
|
||||||
builder.setMtu(1400);
|
builder.setMtu(1400);
|
||||||
builder.addAddress(VPN_ADDRESS, 24);
|
builder.addAddress(VPN_ADDRESS, 24);
|
||||||
@ -51,7 +78,18 @@ public class FridaService extends VpnService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void turnOff() {
|
private void turnOff() {
|
||||||
if( this.vpnProcess != null && !this.vpnProcess.isDisposed() ) this.vpnProcess.dispose();
|
if( this.vpnProcess != null ) {
|
||||||
|
Log.i(TAG, "DISPOSE");
|
||||||
|
this.vpnProcess.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void turnOffVpn() {
|
||||||
|
try {
|
||||||
|
this.vpnInterface.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, Objects.requireNonNull(e.getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,18 +98,17 @@ public class FridaService extends VpnService {
|
|||||||
String hex = intent.getExtras().getString("vpn_hex");
|
String hex = intent.getExtras().getString("vpn_hex");
|
||||||
int uid = intent.getExtras().getInt("vpn_uid");
|
int uid = intent.getExtras().getInt("vpn_uid");
|
||||||
boolean state = intent.getExtras().getBoolean("vpn_state");
|
boolean state = intent.getExtras().getBoolean("vpn_state");
|
||||||
turnOff();
|
if(!state) {
|
||||||
if(!state) return START_STICKY;
|
this.lib.stop();
|
||||||
// TODO: different configs
|
return START_STICKY;
|
||||||
/*this.vpnProcess = Flowable.fromRunnable(new NativeBinaryConnection(vpnInterface.detachFd(), hex))
|
|
||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
|
||||||
.subscribe();*/
|
|
||||||
try {
|
|
||||||
Thread t = new Thread(new NativeBinaryConnection(vpnInterface.dup().detachFd(), hex));
|
|
||||||
t.start();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
setupVPN();
|
||||||
|
// TODO: different configs
|
||||||
|
this.vpnProcess = Flowable.fromRunnable(new NativeBinaryConnection(vpnInterface.detachFd(), hex, lib, logPath))
|
||||||
|
.subscribeOn(Schedulers.newThread())
|
||||||
|
.observeOn(Schedulers.newThread())
|
||||||
|
.subscribe();
|
||||||
|
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,15 @@ public class NativeBinaryConnection implements Runnable {
|
|||||||
|
|
||||||
private final int fd;
|
private final int fd;
|
||||||
private final String hex;
|
private final String hex;
|
||||||
|
private final FridaLib lib;
|
||||||
|
private final String tempFile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Log.i(TAG, "FD: " + this.fd);
|
Log.i(TAG, "FD: " + this.fd);
|
||||||
FridaLib lib = new FridaLib();
|
|
||||||
Log.i(TAG, "Starting Frida client");
|
Log.i(TAG, "Starting Frida client");
|
||||||
Log.i(TAG, "Hex: " + this.hex);
|
int r = lib.start(this.hex.toLowerCase(), this.fd, false, this.tempFile);
|
||||||
int r = lib.start(this.hex.toLowerCase(), this.fd, false);
|
|
||||||
Log.i(TAG, "Exit code: " + r);
|
Log.i(TAG, "Exit code: " + r);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, e.getMessage());
|
Log.e(TAG, e.getMessage());
|
||||||
|
7
src/main/res/drawable/layout_bg.xml
Normal file
7
src/main/res/drawable/layout_bg.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#F3F2F8"/>
|
||||||
|
<stroke android:width="3dp" android:color="#F3F2F8" />
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
7
src/main/res/drawable/layout_switcher.xml
Normal file
7
src/main/res/drawable/layout_switcher.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#E1E1EB"/>
|
||||||
|
<stroke android:width="2.5dp" android:color="#75757F" />
|
||||||
|
<corners android:radius="8dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
7
src/main/res/drawable/layout_swl.xml
Normal file
7
src/main/res/drawable/layout_swl.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#75757F"/>
|
||||||
|
<stroke android:width="2.5dp" android:color="#75757F" />
|
||||||
|
<corners android:bottomLeftRadius="8dp" android:topLeftRadius="8dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
7
src/main/res/drawable/layout_swr.xml
Normal file
7
src/main/res/drawable/layout_swr.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#75757F"/>
|
||||||
|
<stroke android:width="2.5dp" android:color="#75757F" />
|
||||||
|
<corners android:bottomRightRadius="8dp" android:topRightRadius="8dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
26
src/main/res/layout/activity_single_config.xml
Normal file
26
src/main/res/layout/activity_single_config.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
android:id="@+id/main"
|
||||||
|
tools:context=".activity.SingleConfigActivity">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/Widget.Material3.AppBarLayout">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:popupTheme="@style/Widget.Material3.AppBarLayout" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/content_single" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
65
src/main/res/layout/content_single.xml
Normal file
65
src/main/res/layout/content_single.xml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/single_config_act"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="15dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:background="@drawable/layout_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="150dp"
|
||||||
|
android:background="@drawable/layout_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:background="@drawable/layout_switcher"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginHorizontal="20dp">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/layout_swl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="Allowed apps"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- android:background="@drawable/layout_swr" -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:text="Disallowed apps"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="#75757F"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
Loading…
x
Reference in New Issue
Block a user