Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedsh committed Nov 20, 2024
2 parents 2d8de32 + 90caf61 commit b104b7a
Show file tree
Hide file tree
Showing 23 changed files with 277 additions and 99 deletions.
30 changes: 30 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -1217,3 +1217,33 @@
* Fixed detection of whether a cellular network interface can provide an internet connection.
* Fixed I2PD subscriptions option.
* Updated German, Spanish, Greek, Chinese, Portuguese (Brazil), Persian and Bulgarian translations.

**InviZible Pro stable 6.9.0**
* Updated Tor to version 4.8.13.
* Updated Purple I2P to version 2.54.0.
* Added a stop button to the notification.
* Added an option for quick access to Always-on VPN settings.
* Implemented the ability to use the firewall when other modules are stopped.
* Tor apps isolation is enabled by default.
* Fixed requesting Tor bridges via the app.
* Updated translations.

**InviZible Pro beta 2.3.8**
* Updated default Tor bridges.
* Fixed LAN rules handling for firewall in root mode.
* Attempt to fix obfs4 protocol blocking in some countries.
* Updated Polish and French translations.

**InviZible Pro beta 2.3.9**
* Updated Tor Snowflake bridge to version 2.10.1.
* Fixed downloading DNSCrypt rules when Block connections without VPN is enabled.
* The app switches to VPN mode from Root mode if root becomes unavailable.
* Fixes related to root detection and root commands execution.
* Other minor fixes.

**InviZible Pro stable 6.9.1**
* Updated default Tor bridges.
* Updated Tor Obfs4 obfuscation bridge.
* Updated Tor Snowflake bridge to version 2.10.1.
* Fixed LAN rules handling for firewall.
* Updated translations.
5 changes: 5 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/100238.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**InviZible Pro beta 2.3.8**
* Updated default Tor bridges.
* Fixed LAN rules handling for firewall in root mode.
* Attempt to fix obfs4 protocol blocking in some countries.
* Updated Polish and French translations.
6 changes: 6 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/100239.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**InviZible Pro beta 2.3.9**
* Updated Tor Snowflake bridge to version 2.10.1.
* Fixed downloading DNSCrypt rules when Block connections without VPN is enabled.
* The app switches to VPN mode from Root mode if root becomes unavailable.
* Fixes related to root detection and root commands execution.
* Other minor fixes.
4 changes: 2 additions & 2 deletions tordnscrypt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {

fdroid{
applicationId "pan.alexander.tordnscrypt.stable"
versionName "6.9.0"
versionName "6.9.1"
dimension = 'version'
resValue 'string', 'package_name', applicationId
}
Expand Down Expand Up @@ -56,7 +56,7 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
versionCode 237
versionCode 239

resConfigs "en", "ru", "pl", "de", "fa", "fi", "in", "fr", "ja", "zh", "es", "pt", "pt-rBR", "el", "tr", "it", "uk", "bg", "ar"

Expand Down
Binary file modified tordnscrypt/libs/arm64-v8a/libobfs4proxy.so
Binary file not shown.
Binary file modified tordnscrypt/libs/arm64-v8a/libsnowflake.so
Binary file not shown.
Binary file modified tordnscrypt/libs/armeabi-v7a/libobfs4proxy.so
Binary file not shown.
Binary file modified tordnscrypt/libs/armeabi-v7a/libsnowflake.so
Binary file not shown.
10 changes: 5 additions & 5 deletions tordnscrypt/owner.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ android {
productFlavors {
lite {
applicationId "pan.alexander.tordnscrypt.stable"
versionName "6.9.0"
versionName "6.9.1"
dimension = 'version'
signingConfig signingConfigs.stablesign
resValue 'string', 'package_name', applicationId
}

pro {
applicationId "pan.alexander.tordnscrypt.stable"
versionName "6.9.0"
versionName "6.9.1"
dimension = 'version'
signingConfig signingConfigs.stablesign
resValue 'string', 'package_name', applicationId
}

beta {
applicationId "pan.alexander.tordnscrypt"
versionName "2.3.7"
versionName "2.3.9"
dimension = 'version'
signingConfig signingConfigs.betasign
resValue 'string', 'package_name', applicationId
Expand All @@ -60,7 +60,7 @@ android {
google_play {
minSdkVersion 22
applicationId "pan.alexander.tordnscrypt.gp"
versionName "6.9.0"
versionName "6.9.1"
dimension = 'version'
signingConfig signingConfigs.stablesign
resValue 'string', 'package_name', applicationId
Expand Down Expand Up @@ -92,7 +92,7 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 34
versionCode 237
versionCode 239

resConfigs "en", "ru", "pl", "de", "fa", "fi", "in", "fr", "ja", "zh", "es", "pt", "pt-rBR", "el", "tr", "it", "uk", "bg", "ar"

Expand Down
Binary file modified tordnscrypt/src/main/assets/tor.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ private void observeRootState() {

setSUInfo(suResult, suVersion);
setBBinfo(bbResult);
} else if (rootState instanceof RootState.RootNotAvailable) {
rootIsAvailable = false;
PreferenceRepository preferences = preferenceRepository.get();
preferences.setBoolPreference(ROOT_IS_AVAILABLE, false);
preferences.setBoolPreference("bbOK", false);
}

performInitTasksBackgroundWork();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package pan.alexander.tordnscrypt
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.distinctUntilChanged
import androidx.lifecycle.viewModelScope
import eu.chainfire.libsuperuser.Shell
import kotlinx.coroutines.CoroutineDispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,27 @@ class IptablesFirewall @Inject constructor(
).plus(
"$iptables -A $FILTER_OUTPUT_FIREWALL -m mark --mark $FIREWALL_RETURN_MARK -j RETURN"
).plus(
listOf(
//These sources should not be managed as LAN
"$iptables -A $FILTER_FIREWALL_LAN -p udp --sport 53 -j RETURN",
"$iptables -A $FILTER_FIREWALL_LAN -p tcp --sport 53 -j RETURN"
)
).let {
if (modulesStatus.torState == ModuleState.RUNNING) {
//This destination should not be managed as LAN
it.plus("$iptables -A $FILTER_FIREWALL_LAN -p tcp --dport ${pathVars.torTransPort} -j RETURN")
} else {
it
}
}.let {
if (modulesStatus.itpdState == ModuleState.RUNNING) {
//These destinations should not be managed as LAN
it.plus("$iptables -A $FILTER_FIREWALL_LAN -p tcp --dport ${pathVars.itpdHttpProxyPort} -j RETURN")
.plus("$iptables -A $FILTER_FIREWALL_LAN -p udp --dport ${pathVars.itpdHttpProxyPort} -j RETURN")
} else {
it
}
}.plus(
getAppLanRules(iptables, uidLanAllowed)
).plus(
"$iptables -A $FILTER_FIREWALL_LAN -m mark --mark $FIREWALL_RETURN_MARK -j RETURN"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static pan.alexander.tordnscrypt.di.SharedPreferencesModule.DEFAULT_PREFERENCES_NAME;
import static pan.alexander.tordnscrypt.utils.Constants.IPv6_REGEX_NO_BOUNDS;
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.RUNNING;
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.STARTING;
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.PROXY_MODE;
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.ROOT_MODE;
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.UNDEFINED;
Expand Down Expand Up @@ -1089,7 +1090,11 @@ private void startVPNService() {
}

if (!defaultPreferences.get().getBoolean(VPN_SERVICE_ENABLED, false)
&& (modulesStatus.getDnsCryptState() == RUNNING || modulesStatus.getTorState() == RUNNING)) {
&& (modulesStatus.getDnsCryptState() == RUNNING
|| modulesStatus.getTorState() == RUNNING
|| modulesStatus.getFirewallState() == STARTING
|| modulesStatus.getFirewallState() == RUNNING)
) {
defaultPreferences.get().edit().putBoolean(VPN_SERVICE_ENABLED, true).apply();
ServiceVPNHelper.start(
"ModulesReceiver start VPN service after revoke",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ class DownloadRemoteRulesManager @Inject constructor(
if (oldFile.isFile) {
oldFile.delete()
}
outputFile = File(path).apply {
createNewFile()
}
do {
attempts++
try {
outputFile = tryDownload(ruleName, url, path)
} catch (e: IOException) {
outputFile = null
error = e.message ?: ""
logw(
"DownloadRulesManager failed to download file $url, attempt $attempts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ class UpdateRemoteDnsRulesWorker(private val appContext: Context, workerParams:
if (it.length() > 0) {
importRulesFromFile(it, ruleType, url, ruleName)
} else {
return Result.retry()
return Result.failure()
}
} ?: return Result.failure()
} ?: return Result.retry()
return Result.success()
} catch (e: Exception) {
loge("UpdateRemoteDnsRulesWorker doWork", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ class UpdateRemoteRulesWorkManager @Inject constructor(
private fun getConstraints() = Constraints.Builder()
.setRequiresBatteryNotLow(true)
.setRequiresStorageNotLow(true)
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()

private fun getWorkName(type: DnsRuleType) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
package pan.alexander.tordnscrypt.utils.root;

import static pan.alexander.tordnscrypt.utils.AppExtension.getApp;
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.RUNNING;
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.STARTING;
import static pan.alexander.tordnscrypt.utils.logger.Logger.loge;
import static pan.alexander.tordnscrypt.utils.logger.Logger.logi;
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.OPERATION_MODE;
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.ROOT_IS_AVAILABLE;
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.VPN_SERVICE_ENABLED;
import static pan.alexander.tordnscrypt.utils.root.RootCommandsMark.NULL_MARK;
import static pan.alexander.tordnscrypt.utils.root.RootServiceNotificationManager.DEFAULT_NOTIFICATION_ID;

Expand All @@ -31,20 +35,29 @@
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.VpnService;
import android.os.Build;
import android.os.IBinder;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;

import java.util.List;
import java.util.Objects;

import javax.inject.Inject;
import javax.inject.Named;

import dagger.Lazy;
import pan.alexander.tordnscrypt.App;
import pan.alexander.tordnscrypt.R;
import pan.alexander.tordnscrypt.di.SharedPreferencesModule;
import pan.alexander.tordnscrypt.domain.preferences.PreferenceRepository;
import pan.alexander.tordnscrypt.modules.ModulesStatus;
import pan.alexander.tordnscrypt.utils.enums.OperationMode;
import pan.alexander.tordnscrypt.vpn.service.ServiceVPNHelper;

@SuppressLint("UnsafeOptInUsageWarning")
public class RootExecService extends Service
Expand All @@ -59,6 +72,11 @@ public RootExecService() {

@Inject
RootExecutor rootExecutor;
@Inject
@Named(SharedPreferencesModule.DEFAULT_PREFERENCES_NAME)
Lazy<SharedPreferences> defaultPreferences;
@Inject
Lazy<PreferenceRepository> preferenceRepository;

private NotificationManager systemNotificationManager;
private RootServiceNotificationManager serviceNotificationManager;
Expand Down Expand Up @@ -134,10 +152,12 @@ public int onStartCommand(Intent intent, int flags, int startId) {
RootCommands rootCommands = (RootCommands) intent.getSerializableExtra("Commands");
int mark = intent.getIntExtra("Mark", 0);

rootExecutor.execute(
rootCommands.getCommands(),
mark
);
if (rootCommands != null && rootCommands.getCommands() != null) {
rootExecutor.execute(
rootCommands.getCommands(),
mark
);
}
}

return START_NOT_STICKY;
Expand All @@ -149,6 +169,11 @@ private void sendResult(List<String> commandsResult, int mark) {
return;
}

if (!commandsResult.isEmpty()
&& commandsResult.get(0).equals(RootConsoleClosedException.message)) {
switchToVpnMode();
}

RootCommands comResult = new RootCommands(commandsResult);
Intent intent = new Intent(COMMAND_RESULT);
intent.putExtra("CommandsResult", comResult);
Expand Down Expand Up @@ -211,4 +236,42 @@ public void onTimeout(int startId) {
moveServiceToBackground();
super.onTimeout(startId);
}

private void switchToVpnMode() {

final Intent prepareIntent = VpnService.prepare(this);
final boolean vpnServiceEnabled = defaultPreferences.get().getBoolean(VPN_SERVICE_ENABLED, false);
if (prepareIntent != null || vpnServiceEnabled) {
return;
}

ModulesStatus modulesStatus = ModulesStatus.getInstance();
modulesStatus.setMode(OperationMode.VPN_MODE);
preferenceRepository.get()
.setStringPreference(OPERATION_MODE, OperationMode.VPN_MODE.toString());
logi("VPN mode enabled");


if (modulesStatus.getDnsCryptState() == RUNNING
|| modulesStatus.getTorState() == RUNNING
|| modulesStatus.getFirewallState() == STARTING
|| modulesStatus.getFirewallState() == RUNNING) {
defaultPreferences.get().edit().putBoolean(VPN_SERVICE_ENABLED, true).apply();
ServiceVPNHelper.start(
"Root exec service start VPN service after root console failed",
this
);
}
}

static class RootConsoleClosedException extends IllegalStateException {

private static final String message = "Root is not available!";

@Nullable
@Override
public String getMessage() {
return message;
}
}
}
Loading

0 comments on commit b104b7a

Please sign in to comment.