Skip to content

Commit b104b7a

Browse files
committed
Merge branch 'master' into stable
2 parents 2d8de32 + 90caf61 commit b104b7a

File tree

23 files changed

+277
-99
lines changed

23 files changed

+277
-99
lines changed

ChangeLog.md

+30
Original file line numberDiff line numberDiff line change
@@ -1217,3 +1217,33 @@
12171217
* Fixed detection of whether a cellular network interface can provide an internet connection.
12181218
* Fixed I2PD subscriptions option.
12191219
* Updated German, Spanish, Greek, Chinese, Portuguese (Brazil), Persian and Bulgarian translations.
1220+
1221+
**InviZible Pro stable 6.9.0**
1222+
* Updated Tor to version 4.8.13.
1223+
* Updated Purple I2P to version 2.54.0.
1224+
* Added a stop button to the notification.
1225+
* Added an option for quick access to Always-on VPN settings.
1226+
* Implemented the ability to use the firewall when other modules are stopped.
1227+
* Tor apps isolation is enabled by default.
1228+
* Fixed requesting Tor bridges via the app.
1229+
* Updated translations.
1230+
1231+
**InviZible Pro beta 2.3.8**
1232+
* Updated default Tor bridges.
1233+
* Fixed LAN rules handling for firewall in root mode.
1234+
* Attempt to fix obfs4 protocol blocking in some countries.
1235+
* Updated Polish and French translations.
1236+
1237+
**InviZible Pro beta 2.3.9**
1238+
* Updated Tor Snowflake bridge to version 2.10.1.
1239+
* Fixed downloading DNSCrypt rules when Block connections without VPN is enabled.
1240+
* The app switches to VPN mode from Root mode if root becomes unavailable.
1241+
* Fixes related to root detection and root commands execution.
1242+
* Other minor fixes.
1243+
1244+
**InviZible Pro stable 6.9.1**
1245+
* Updated default Tor bridges.
1246+
* Updated Tor Obfs4 obfuscation bridge.
1247+
* Updated Tor Snowflake bridge to version 2.10.1.
1248+
* Fixed LAN rules handling for firewall.
1249+
* Updated translations.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**InviZible Pro beta 2.3.8**
2+
* Updated default Tor bridges.
3+
* Fixed LAN rules handling for firewall in root mode.
4+
* Attempt to fix obfs4 protocol blocking in some countries.
5+
* Updated Polish and French translations.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**InviZible Pro beta 2.3.9**
2+
* Updated Tor Snowflake bridge to version 2.10.1.
3+
* Fixed downloading DNSCrypt rules when Block connections without VPN is enabled.
4+
* The app switches to VPN mode from Root mode if root becomes unavailable.
5+
* Fixes related to root detection and root commands execution.
6+
* Other minor fixes.

tordnscrypt/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ android {
1616

1717
fdroid{
1818
applicationId "pan.alexander.tordnscrypt.stable"
19-
versionName "6.9.0"
19+
versionName "6.9.1"
2020
dimension = 'version'
2121
resValue 'string', 'package_name', applicationId
2222
}
@@ -56,7 +56,7 @@ android {
5656
defaultConfig {
5757
minSdkVersion 19
5858
targetSdkVersion 34
59-
versionCode 237
59+
versionCode 239
6060

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

0 Bytes
Binary file not shown.
-426 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-414 KB
Binary file not shown.

tordnscrypt/owner.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ android {
3535
productFlavors {
3636
lite {
3737
applicationId "pan.alexander.tordnscrypt.stable"
38-
versionName "6.9.0"
38+
versionName "6.9.1"
3939
dimension = 'version'
4040
signingConfig signingConfigs.stablesign
4141
resValue 'string', 'package_name', applicationId
4242
}
4343

4444
pro {
4545
applicationId "pan.alexander.tordnscrypt.stable"
46-
versionName "6.9.0"
46+
versionName "6.9.1"
4747
dimension = 'version'
4848
signingConfig signingConfigs.stablesign
4949
resValue 'string', 'package_name', applicationId
5050
}
5151

5252
beta {
5353
applicationId "pan.alexander.tordnscrypt"
54-
versionName "2.3.7"
54+
versionName "2.3.9"
5555
dimension = 'version'
5656
signingConfig signingConfigs.betasign
5757
resValue 'string', 'package_name', applicationId
@@ -60,7 +60,7 @@ android {
6060
google_play {
6161
minSdkVersion 22
6262
applicationId "pan.alexander.tordnscrypt.gp"
63-
versionName "6.9.0"
63+
versionName "6.9.1"
6464
dimension = 'version'
6565
signingConfig signingConfigs.stablesign
6666
resValue 'string', 'package_name', applicationId
@@ -92,7 +92,7 @@ android {
9292
defaultConfig {
9393
minSdkVersion 19
9494
targetSdkVersion 34
95-
versionCode 237
95+
versionCode 239
9696

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

tordnscrypt/src/main/assets/tor.mp3

-13 Bytes
Binary file not shown.

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/TopFragment.java

+5
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ private void observeRootState() {
362362

363363
setSUInfo(suResult, suVersion);
364364
setBBinfo(bbResult);
365+
} else if (rootState instanceof RootState.RootNotAvailable) {
366+
rootIsAvailable = false;
367+
PreferenceRepository preferences = preferenceRepository.get();
368+
preferences.setBoolPreference(ROOT_IS_AVAILABLE, false);
369+
preferences.setBoolPreference("bbOK", false);
365370
}
366371

367372
performInitTasksBackgroundWork();

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/TopFragmentViewModel.kt

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package pan.alexander.tordnscrypt
2222
import androidx.lifecycle.LiveData
2323
import androidx.lifecycle.MutableLiveData
2424
import androidx.lifecycle.ViewModel
25-
import androidx.lifecycle.distinctUntilChanged
2625
import androidx.lifecycle.viewModelScope
2726
import eu.chainfire.libsuperuser.Shell
2827
import kotlinx.coroutines.CoroutineDispatcher

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/iptables/IptablesFirewall.kt

+21
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,27 @@ class IptablesFirewall @Inject constructor(
166166
).plus(
167167
"$iptables -A $FILTER_OUTPUT_FIREWALL -m mark --mark $FIREWALL_RETURN_MARK -j RETURN"
168168
).plus(
169+
listOf(
170+
//These sources should not be managed as LAN
171+
"$iptables -A $FILTER_FIREWALL_LAN -p udp --sport 53 -j RETURN",
172+
"$iptables -A $FILTER_FIREWALL_LAN -p tcp --sport 53 -j RETURN"
173+
)
174+
).let {
175+
if (modulesStatus.torState == ModuleState.RUNNING) {
176+
//This destination should not be managed as LAN
177+
it.plus("$iptables -A $FILTER_FIREWALL_LAN -p tcp --dport ${pathVars.torTransPort} -j RETURN")
178+
} else {
179+
it
180+
}
181+
}.let {
182+
if (modulesStatus.itpdState == ModuleState.RUNNING) {
183+
//These destinations should not be managed as LAN
184+
it.plus("$iptables -A $FILTER_FIREWALL_LAN -p tcp --dport ${pathVars.itpdHttpProxyPort} -j RETURN")
185+
.plus("$iptables -A $FILTER_FIREWALL_LAN -p udp --dport ${pathVars.itpdHttpProxyPort} -j RETURN")
186+
} else {
187+
it
188+
}
189+
}.plus(
169190
getAppLanRules(iptables, uidLanAllowed)
170191
).plus(
171192
"$iptables -A $FILTER_FIREWALL_LAN -m mark --mark $FIREWALL_RETURN_MARK -j RETURN"

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/modules/ModulesReceiver.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static pan.alexander.tordnscrypt.di.SharedPreferencesModule.DEFAULT_PREFERENCES_NAME;
2323
import static pan.alexander.tordnscrypt.utils.Constants.IPv6_REGEX_NO_BOUNDS;
2424
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.RUNNING;
25+
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.STARTING;
2526
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.PROXY_MODE;
2627
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.ROOT_MODE;
2728
import static pan.alexander.tordnscrypt.utils.enums.OperationMode.UNDEFINED;
@@ -1089,7 +1090,11 @@ private void startVPNService() {
10891090
}
10901091

10911092
if (!defaultPreferences.get().getBoolean(VPN_SERVICE_ENABLED, false)
1092-
&& (modulesStatus.getDnsCryptState() == RUNNING || modulesStatus.getTorState() == RUNNING)) {
1093+
&& (modulesStatus.getDnsCryptState() == RUNNING
1094+
|| modulesStatus.getTorState() == RUNNING
1095+
|| modulesStatus.getFirewallState() == STARTING
1096+
|| modulesStatus.getFirewallState() == RUNNING)
1097+
) {
10931098
defaultPreferences.get().edit().putBoolean(VPN_SERVICE_ENABLED, true).apply();
10941099
ServiceVPNHelper.start(
10951100
"ModulesReceiver start VPN service after revoke",

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/settings/dnscrypt_rules/remote/DownloadRemoteRulesManager.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,12 @@ class DownloadRemoteRulesManager @Inject constructor(
6969
if (oldFile.isFile) {
7070
oldFile.delete()
7171
}
72-
outputFile = File(path).apply {
73-
createNewFile()
74-
}
7572
do {
7673
attempts++
7774
try {
7875
outputFile = tryDownload(ruleName, url, path)
7976
} catch (e: IOException) {
77+
outputFile = null
8078
error = e.message ?: ""
8179
logw(
8280
"DownloadRulesManager failed to download file $url, attempt $attempts",

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/settings/dnscrypt_rules/remote/UpdateRemoteDnsRulesWorker.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ class UpdateRemoteDnsRulesWorker(private val appContext: Context, workerParams:
8989
if (it.length() > 0) {
9090
importRulesFromFile(it, ruleType, url, ruleName)
9191
} else {
92-
return Result.retry()
92+
return Result.failure()
9393
}
94-
} ?: return Result.failure()
94+
} ?: return Result.retry()
9595
return Result.success()
9696
} catch (e: Exception) {
9797
loge("UpdateRemoteDnsRulesWorker doWork", e)

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/settings/dnscrypt_rules/remote/UpdateRemoteRulesWorkManager.kt

-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class UpdateRemoteRulesWorkManager @Inject constructor(
153153
private fun getConstraints() = Constraints.Builder()
154154
.setRequiresBatteryNotLow(true)
155155
.setRequiresStorageNotLow(true)
156-
.setRequiredNetworkType(NetworkType.CONNECTED)
157156
.build()
158157

159158
private fun getWorkName(type: DnsRuleType) =

tordnscrypt/src/main/java/pan/alexander/tordnscrypt/utils/root/RootExecService.java

+67-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
package pan.alexander.tordnscrypt.utils.root;
2121

2222
import static pan.alexander.tordnscrypt.utils.AppExtension.getApp;
23+
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.RUNNING;
24+
import static pan.alexander.tordnscrypt.utils.enums.ModuleState.STARTING;
2325
import static pan.alexander.tordnscrypt.utils.logger.Logger.loge;
2426
import static pan.alexander.tordnscrypt.utils.logger.Logger.logi;
27+
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.OPERATION_MODE;
2528
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.ROOT_IS_AVAILABLE;
29+
import static pan.alexander.tordnscrypt.utils.preferences.PreferenceKeys.VPN_SERVICE_ENABLED;
2630
import static pan.alexander.tordnscrypt.utils.root.RootCommandsMark.NULL_MARK;
2731
import static pan.alexander.tordnscrypt.utils.root.RootServiceNotificationManager.DEFAULT_NOTIFICATION_ID;
2832

@@ -31,20 +35,29 @@
3135
import android.app.Service;
3236
import android.content.Context;
3337
import android.content.Intent;
38+
import android.content.SharedPreferences;
39+
import android.net.VpnService;
3440
import android.os.Build;
3541
import android.os.IBinder;
3642

3743
import androidx.annotation.NonNull;
44+
import androidx.annotation.Nullable;
3845
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
3946

4047
import java.util.List;
4148
import java.util.Objects;
4249

4350
import javax.inject.Inject;
51+
import javax.inject.Named;
4452

53+
import dagger.Lazy;
4554
import pan.alexander.tordnscrypt.App;
4655
import pan.alexander.tordnscrypt.R;
56+
import pan.alexander.tordnscrypt.di.SharedPreferencesModule;
4757
import pan.alexander.tordnscrypt.domain.preferences.PreferenceRepository;
58+
import pan.alexander.tordnscrypt.modules.ModulesStatus;
59+
import pan.alexander.tordnscrypt.utils.enums.OperationMode;
60+
import pan.alexander.tordnscrypt.vpn.service.ServiceVPNHelper;
4861

4962
@SuppressLint("UnsafeOptInUsageWarning")
5063
public class RootExecService extends Service
@@ -59,6 +72,11 @@ public RootExecService() {
5972

6073
@Inject
6174
RootExecutor rootExecutor;
75+
@Inject
76+
@Named(SharedPreferencesModule.DEFAULT_PREFERENCES_NAME)
77+
Lazy<SharedPreferences> defaultPreferences;
78+
@Inject
79+
Lazy<PreferenceRepository> preferenceRepository;
6280

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

137-
rootExecutor.execute(
138-
rootCommands.getCommands(),
139-
mark
140-
);
155+
if (rootCommands != null && rootCommands.getCommands() != null) {
156+
rootExecutor.execute(
157+
rootCommands.getCommands(),
158+
mark
159+
);
160+
}
141161
}
142162

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

172+
if (!commandsResult.isEmpty()
173+
&& commandsResult.get(0).equals(RootConsoleClosedException.message)) {
174+
switchToVpnMode();
175+
}
176+
152177
RootCommands comResult = new RootCommands(commandsResult);
153178
Intent intent = new Intent(COMMAND_RESULT);
154179
intent.putExtra("CommandsResult", comResult);
@@ -211,4 +236,42 @@ public void onTimeout(int startId) {
211236
moveServiceToBackground();
212237
super.onTimeout(startId);
213238
}
239+
240+
private void switchToVpnMode() {
241+
242+
final Intent prepareIntent = VpnService.prepare(this);
243+
final boolean vpnServiceEnabled = defaultPreferences.get().getBoolean(VPN_SERVICE_ENABLED, false);
244+
if (prepareIntent != null || vpnServiceEnabled) {
245+
return;
246+
}
247+
248+
ModulesStatus modulesStatus = ModulesStatus.getInstance();
249+
modulesStatus.setMode(OperationMode.VPN_MODE);
250+
preferenceRepository.get()
251+
.setStringPreference(OPERATION_MODE, OperationMode.VPN_MODE.toString());
252+
logi("VPN mode enabled");
253+
254+
255+
if (modulesStatus.getDnsCryptState() == RUNNING
256+
|| modulesStatus.getTorState() == RUNNING
257+
|| modulesStatus.getFirewallState() == STARTING
258+
|| modulesStatus.getFirewallState() == RUNNING) {
259+
defaultPreferences.get().edit().putBoolean(VPN_SERVICE_ENABLED, true).apply();
260+
ServiceVPNHelper.start(
261+
"Root exec service start VPN service after root console failed",
262+
this
263+
);
264+
}
265+
}
266+
267+
static class RootConsoleClosedException extends IllegalStateException {
268+
269+
private static final String message = "Root is not available!";
270+
271+
@Nullable
272+
@Override
273+
public String getMessage() {
274+
return message;
275+
}
276+
}
214277
}

0 commit comments

Comments
 (0)