Compare commits

..

10 Commits

Author SHA1 Message Date
Your Name
74ff304e40 wip 2024-03-03 22:28:29 -06:00
Brian Hanson
5cfcd2c3c7 updated readme 2023-06-22 13:50:21 -05:00
Brian Hanson
cdf6094579 - Renamed project namespace to hanson.xyz.vpnhotspotmod
- Added BroadcastReceiver to recive intents to start wifi and bluetooth tether options via tasker
- Modified TetherService to run sticky
- Modified TetherManager to 'monitor' all new interfaces as soon as they are created
2023-06-22 13:34:13 -05:00
Mygod
a21f3c307e v2.16.5 2023-06-13 02:09:35 -04:00
Mygod
bba6336b6c Suppress boot config errors 2023-06-12 22:41:54 -04:00
Mygod
5766919216 Use SdkExtensions for HttpEngine 2023-06-12 22:24:57 -04:00
Mygod
82b2fd4e93 Set doOutput before writing 2023-06-12 21:45:29 -04:00
Mygod
c72b4c4f27 Fix hiddenapibypass 2023-06-08 21:51:13 -04:00
Mygod
26fbbc36e5 Add support for foreground service permission 2023-06-08 19:49:48 -04:00
Mygod
10565bcba7 Update to API 34 2023-06-08 19:45:23 -04:00
113 changed files with 750 additions and 634 deletions

17
.gitignore vendored
View File

@@ -1,8 +1,9 @@
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
*.iml
.gradle
/local.properties
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
release/vpnhotspotmod.apk

View File

@@ -1,3 +1,23 @@
# VPN Hotspot MOD
This is a modification of Mygod/VPNHotspot which allows bluetooth and wifi hotspots to be started automatically via intent. All interfaces are set to monitor when the hotspot is started.
To start the hotspot via tasker, create a new action to send an intent. Into the settings put:
Action: hanson.xyz.vpnhotspotmod.WIFI_TETHER_START
Package: hanson.xyz.vpnhotspotmod
To stop:
Action: hanson.xyz.vpnhotspotmod.WIFI_TETHER_STOP
Package: hanson.xyz.vpnhotspotmod
Intents BLUETOOTH_TETHER_START and BLUETOOTH_TETHER_STOP are also available.
This has been tested and developed on Android 13, on a Pixel 7, in June 2023.
Original README.md follows:
# VPN Hotspot
[![CircleCI](https://circleci.com/gh/Mygod/VPNHotspot.svg?style=shield)](https://circleci.com/gh/Mygod/VPNHotspot)

View File

@@ -1,13 +1,14 @@
plugins {
id("com.android.application") version "8.2.0-alpha07" apply false
id("com.github.ben-manes.versions") version "0.46.0"
id("org.jetbrains.kotlin.android") version "1.8.21" apply false
id("com.android.application") version "8.2.0" apply false
id("com.github.ben-manes.versions") version "0.49.0"
id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
}
buildscript {
dependencies {
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.5")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.9")
classpath("com.google.android.gms:oss-licenses-plugin:0.10.6")
classpath("com.google.gms:google-services:4.3.15")
classpath("com.google.gms:google-services:4.4.0")
}
}
}

View File

@@ -1,6 +1,7 @@
#Thu Dec 21 01:34:39 CST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-rc-2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0
gradlew vendored Executable file → Normal file
View File

184
gradlew.bat vendored
View File

@@ -1,92 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -9,7 +9,7 @@ plugins {
}
android {
namespace = "be.mygod.vpnhotspot"
namespace = "hanson.xyz.vpnhotspotmod"
val javaVersion = 11
buildToolsVersion = "34.0.0"
@@ -24,18 +24,18 @@ android {
}
compileSdk = 34
defaultConfig {
applicationId = "be.mygod.vpnhotspot"
minSdk = 28
targetSdk = 33
resourceConfigurations.addAll(arrayOf("it", "pt-rBR", "ru", "zh-rCN", "zh-rTW"))
versionCode = 1004
versionName = "2.16.4"
versionCode = 1005
versionName = "2.16.5"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions.arguments.apply {
put("room.expandProjection", "true")
put("room.incremental", "true")
put("room.schemaLocation", "$projectDir/schemas")
}
applicationId = "hanson.xyz.vpnhotspotmod"
}
buildFeatures {
buildConfig = true
@@ -71,34 +71,34 @@ android {
}
dependencies {
val lifecycleVersion = "2.6.1"
val roomVersion = "2.5.1"
val lifecycleVersion = "2.6.2"
val roomVersion = "2.6.1"
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.3")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
kapt("androidx.room:room-compiler:$roomVersion")
implementation(kotlin("stdlib-jdk8"))
implementation("androidx.browser:browser:1.5.0")
implementation("androidx.core:core-ktx:1.11.0-beta02")
implementation("androidx.fragment:fragment-ktx:1.6.0")
implementation("androidx.browser:browser:1.7.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
implementation("androidx.preference:preference:1.2.0")
implementation("androidx.preference:preference:1.2.1")
implementation("androidx.room:room-ktx:$roomVersion")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("be.mygod.librootkotlinx:librootkotlinx:1.0.4")
implementation("com.android.billingclient:billing-ktx:6.0.0")
implementation("com.github.tiann:FreeReflection:3.1.0")
implementation("be.mygod.librootkotlinx:librootkotlinx:1.1.1")
implementation("com.android.billingclient:billing-ktx:6.1.0")
implementation("com.google.android.gms:play-services-base:18.2.0") // fix for GoogleApiActivity crash @ 18.1.0+
implementation("com.google.android.gms:play-services-oss-licenses:17.0.1")
implementation("com.google.android.material:material:1.9.0")
implementation("com.google.firebase:firebase-analytics-ktx:21.3.0")
implementation("com.google.firebase:firebase-crashlytics:18.3.7")
implementation("com.google.zxing:core:3.5.1")
implementation("com.google.android.material:material:1.11.0")
implementation("com.google.firebase:firebase-analytics-ktx:21.5.0")
implementation("com.google.firebase:firebase-crashlytics:18.6.0")
implementation("com.google.zxing:core:3.5.2")
implementation("com.jakewharton.timber:timber:5.0.1")
implementation("com.linkedin.dexmaker:dexmaker:2.28.3")
implementation("com.takisoft.preferencex:preferencex-simplemenu:1.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.5")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
add("googleImplementation", "com.google.android.play:app-update-ktx:2.1.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.room:room-testing:$roomVersion")

View File

@@ -10,7 +10,7 @@
"client_info": {
"mobilesdk_app_id": "1:13108846109:android:63120dcb2e900ed0",
"android_client_info": {
"package_name": "be.mygod.vpnhotspot"
"package_name": "hanson.xyz.vpnhotspotmod"
}
},
"oauth_client": [

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.room
package hanson.xyz.vpnhotspotmod.room
import androidx.room.testing.MigrationTestHelper
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory

View File

@@ -1,10 +1,10 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.app.Activity
import android.net.Uri
import androidx.core.content.edit
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.BuildConfig
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.BuildConfig
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive

View File

@@ -1,8 +1,8 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.app.Activity
import android.net.Uri
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.InstallException
import com.google.android.play.core.install.model.InstallErrorCode
@@ -23,7 +23,7 @@ object UpdateChecker {
} catch (e: Exception) {
Timber.w(e)
app.customTabsIntent.launchUrl(activity,
Uri.parse("https://play.google.com/store/apps/details?id=be.mygod.vpnhotspot"))
Uri.parse("https://play.google.com/store/apps/details?id=hanson.xyz.vpnhotspotmod"))
}
}
private class UpdateDownloading(private val update: AppUpdateResult.InProgress) : AppUpdate {

View File

@@ -32,6 +32,7 @@
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS"
tools:ignore="ProtectedPermissions" />
@@ -102,11 +103,13 @@
<service
android:name=".LocalOnlyHotspotService"
android:directBootAware="true"
android:foregroundServiceType="location|connectedDevice"/>
android:foregroundServiceType="location|connectedDevice"
tools:ignore="ForegroundServicePermission"/>
<service
android:name=".RepeaterService"
android:directBootAware="true"
android:foregroundServiceType="location|connectedDevice"/>
android:foregroundServiceType="location|connectedDevice"
tools:ignore="ForegroundServicePermission"/>
<service
android:name=".TetheringService"
android:directBootAware="true"
@@ -211,9 +214,18 @@
</intent-filter>
</receiver>
<receiver android:name=".MyBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="hanson.xyz.vpnhotspotmod.WIFI_TETHER_START" />
<action android:name="hanson.xyz.vpnhotspotmod.WIFI_TETHER_STOP" />
<action android:name="hanson.xyz.vpnhotspotmod.BT_TETHER_START" />
<action android:name="hanson.xyz.vpnhotspotmod.BT_TETHER_STOP" />
</intent-filter>
</receiver>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="be.mygod.vpnhotspot.log"
android:authorities="hanson.xyz.vpnhotspotmod.log"
android:exported="false"
android:grantUriPermissions="true">
<meta-data

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.app.Activity
import android.content.DialogInterface

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.annotation.SuppressLint
import android.app.Application
@@ -18,12 +18,12 @@ import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.content.getSystemService
import androidx.preference.PreferenceManager
import be.mygod.librootkotlinx.NoShellException
import be.mygod.vpnhotspot.net.DhcpWorkaround
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.util.DeviceStorageApp
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.net.DhcpWorkaround
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.util.DeviceStorageApp
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import com.google.firebase.analytics.ktx.ParametersBuilder
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.crashlytics.FirebaseCrashlytics

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.content.BroadcastReceiver
import android.content.ComponentName
@@ -8,7 +8,7 @@ import android.content.pm.PackageManager
import android.os.Parcelable
import be.mygod.librootkotlinx.toByteArray
import be.mygod.librootkotlinx.toParcelable
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import kotlinx.parcelize.Parcelize
import timber.log.Timber
import java.io.DataInputStream
@@ -29,12 +29,7 @@ class BootReceiver : BroadcastReceiver() {
else PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP)
private val userEnabled get() = app.pref.getBoolean(KEY, false)
fun onUserSettingUpdated(shouldStart: Boolean) {
enabled = shouldStart && try {
config
} catch (e: Exception) {
Timber.w(e)
null
}?.startables?.isEmpty() == false
enabled = shouldStart && config?.startables?.isEmpty() == false
}
private fun onConfigUpdated(isNotEmpty: Boolean) {
enabled = isNotEmpty && userEnabled
@@ -46,14 +41,12 @@ class BootReceiver : BroadcastReceiver() {
DataInputStream(configFile.inputStream()).use { it.readBytes().toParcelable() }
} catch (_: FileNotFoundException) {
null
} catch (e: Exception) {
Timber.d("Boot config corrupted", e)
null
}
private fun updateConfig(work: Config.() -> Unit) = synchronized(BootReceiver) {
val config = try {
config
} catch (e: Exception) {
Timber.i("Boot config corrupted", e)
null
} ?: Config()
val config = config ?: Config()
config.work()
DataOutputStream(configFile.outputStream()).use { it.write(config.toByteArray()) }
config
@@ -85,12 +78,7 @@ class BootReceiver : BroadcastReceiver() {
private var started = false
private fun startIfNecessary() {
if (started) return
val config = try {
synchronized(BootReceiver) { config }
} catch (e: Exception) {
Timber.w(e)
null
}
val config = synchronized(BootReceiver) { config }
if (config == null || config.startables.isEmpty()) {
enabled = false
} else for (startable in config.startables.values) startable.start(app)

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.os.Bundle
import android.view.LayoutInflater
@@ -7,10 +7,10 @@ import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.lifecycle.lifecycleScope
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.databinding.FragmentEbegBinding
import be.mygod.vpnhotspot.util.launchUrl
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.databinding.FragmentEbegBinding
import hanson.xyz.vpnhotspotmod.util.launchUrl
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import com.android.billingclient.api.BillingClient
import com.android.billingclient.api.BillingClientStateListener
import com.android.billingclient.api.BillingFlowParams

View File

@@ -1,8 +1,8 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.app.Service
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import java.net.Inet4Address
abstract class IpNeighbourMonitoringService : Service(), IpNeighbourMonitor.Callback {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.content.Context
import android.content.Intent
@@ -7,21 +7,21 @@ import android.net.wifi.WifiManager
import android.os.Build
import androidx.annotation.RequiresApi
import be.mygod.librootkotlinx.RootServer
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.net.monitor.TetherTimeoutMonitor
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat.Companion.toCompat
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.net.wifi.WifiApManager.wifiApState
import be.mygod.vpnhotspot.root.LocalOnlyHotspotCallbacks
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.WifiApCommands
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.StickyEvent1
import be.mygod.vpnhotspot.util.broadcastReceiver
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.TetherTimeoutMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat.Companion.toCompat
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager.wifiApState
import hanson.xyz.vpnhotspotmod.root.LocalOnlyHotspotCallbacks
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.WifiApCommands
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.StickyEvent1
import hanson.xyz.vpnhotspotmod.util.broadcastReceiver
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.*
import kotlinx.parcelize.Parcelize
import timber.log.Timber

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.os.Bundle
import android.view.MenuItem
@@ -12,17 +12,17 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import be.mygod.vpnhotspot.client.ClientViewModel
import be.mygod.vpnhotspot.client.ClientsFragment
import be.mygod.vpnhotspot.databinding.ActivityMainBinding
import be.mygod.vpnhotspot.manage.TetheringFragment
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
import be.mygod.vpnhotspot.util.AppUpdate
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.UpdateChecker
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.client.ClientViewModel
import hanson.xyz.vpnhotspotmod.client.ClientsFragment
import hanson.xyz.vpnhotspotmod.databinding.ActivityMainBinding
import hanson.xyz.vpnhotspotmod.manage.TetheringFragment
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.wifi.WifiDoubleLock
import hanson.xyz.vpnhotspotmod.util.AppUpdate
import hanson.xyz.vpnhotspotmod.util.ServiceForegroundConnector
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.UpdateChecker
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.navigation.NavigationBarView
import kotlinx.coroutines.launch

View File

@@ -0,0 +1,53 @@
package hanson.xyz.vpnhotspotmod
import android.bluetooth.BluetoothManager
import android.content.*
import android.graphics.drawable.Icon
import android.os.Build
import android.os.IBinder
import android.service.quicksettings.Tile
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.TetheringService
import hanson.xyz.vpnhotspotmod.manage.BluetoothTethering
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.TetheringManager.tetheredIfaces
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.util.broadcastReceiver
import hanson.xyz.vpnhotspotmod.util.readableMessage
import hanson.xyz.vpnhotspotmod.util.stopAndUnbind
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import timber.log.Timber
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.os.Looper
// added by hansonxyz
class MyBroadcastReceiver : BroadcastReceiver(), TetheringManager.StartTetheringCallback {
private val handler = Handler(Looper.getMainLooper())
override fun onReceive(context: Context, intent: Intent) {
if (intent.action.toString().contains("BT_TETHER_START")) {
TetheringManager.startTethering(TetheringManager.TETHERING_BLUETOOTH, false, this)
}
if (intent.action.toString().contains("BT_TETHER_STOP")) {
TetheringManager.stopTethering(TetheringManager.TETHERING_BLUETOOTH)
}
if (intent.action.toString().contains("WIFI_TETHER_START")) {
TetheringManager.startTethering(TetheringManager.TETHERING_WIFI, false, this)
}
if (intent.action.toString().contains("WIFI_TETHER_STOP")) {
TetheringManager.stopTethering(TetheringManager.TETHERING_WIFI)
}
}
}

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.annotation.SuppressLint
import android.annotation.TargetApi
@@ -18,27 +18,27 @@ import android.provider.Settings
import androidx.annotation.RequiresApi
import androidx.annotation.StringRes
import androidx.core.content.edit
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.MacAddressCompat
import be.mygod.vpnhotspot.net.MacAddressCompat.Companion.toLong
import be.mygod.vpnhotspot.net.monitor.TetherTimeoutMonitor
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat
import be.mygod.vpnhotspot.net.wifi.VendorElements
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestConnectionInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestGroupInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestP2pState
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setVendorElements
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.startWps
import be.mygod.vpnhotspot.net.wifi.WifiSsidCompat
import be.mygod.vpnhotspot.root.RepeaterCommands
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.util.*
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat.Companion.toLong
import hanson.xyz.vpnhotspotmod.net.monitor.TetherTimeoutMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat
import hanson.xyz.vpnhotspotmod.net.wifi.VendorElements
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestConnectionInfo
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestGroupInfo
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestP2pState
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.setVendorElements
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.startWps
import hanson.xyz.vpnhotspotmod.net.wifi.WifiSsidCompat
import hanson.xyz.vpnhotspotmod.root.RepeaterCommands
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.util.*
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.*
import kotlinx.parcelize.Parcelize
import timber.log.Timber

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.os.Build
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.Routing
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.Routing
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.wifi.WifiDoubleLock
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.runBlocking
import timber.log.Timber

View File

@@ -1,10 +1,12 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.app.*
import android.content.Context
import android.content.Intent
import android.content.pm.ServiceInfo
import android.os.Build
import androidx.core.content.getSystemService
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import java.util.*
object ServiceNotification {
@@ -53,7 +55,10 @@ object ServiceNotification {
synchronized(this) {
deviceCountsMap[service] = deviceCounts
if (inactive.isEmpty()) inactiveMap.remove(service) else inactiveMap[service] = inactive
service.startForeground(NOTIFICATION_ID, buildNotification(service))
if (Build.VERSION.SDK_INT >= 33) {
service.startForeground(NOTIFICATION_ID, buildNotification(service),
ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE)
} else service.startForeground(NOTIFICATION_ID, buildNotification(service))
}
}
fun stopForeground(service: Service) = synchronized(this) {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.content.Intent
import android.os.Build
@@ -8,21 +8,21 @@ import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.TwoStatePreference
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.TetherOffloadManager
import be.mygod.vpnhotspot.net.monitor.FallbackUpstreamMonitor
import be.mygod.vpnhotspot.net.monitor.IpMonitor
import be.mygod.vpnhotspot.net.monitor.UpstreamMonitor
import be.mygod.vpnhotspot.net.wifi.WifiDoubleLock
import be.mygod.vpnhotspot.preference.AutoCompleteNetworkPreferenceDialogFragment
import be.mygod.vpnhotspot.preference.SharedPreferenceDataStore
import be.mygod.vpnhotspot.preference.SummaryFallbackProvider
import be.mygod.vpnhotspot.root.Dump
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.launchUrl
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.TetherOffloadManager
import hanson.xyz.vpnhotspotmod.net.monitor.FallbackUpstreamMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.IpMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.UpstreamMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.WifiDoubleLock
import hanson.xyz.vpnhotspotmod.preference.AutoCompleteNetworkPreferenceDialogFragment
import hanson.xyz.vpnhotspotmod.preference.SharedPreferenceDataStore
import hanson.xyz.vpnhotspotmod.preference.SummaryFallbackProvider
import hanson.xyz.vpnhotspotmod.root.Dump
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.launchUrl
import hanson.xyz.vpnhotspotmod.util.showAllowingStateLoss
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.CancellationException
@@ -120,7 +120,7 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
.setType("text/x-log")
.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
.putExtra(Intent.EXTRA_STREAM,
FileProvider.getUriForFile(context, "be.mygod.vpnhotspot.log", logFile)),
FileProvider.getUriForFile(context, "hanson.xyz.vpnhotspotmod.log", logFile)),
context.getString(androidx.appcompat.R.string.abc_shareactionprovider_share_with)))
}
true

View File

@@ -1,14 +1,16 @@
package be.mygod.vpnhotspot
package hanson.xyz.vpnhotspotmod
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.os.Looper
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.Routing
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.util.Event0
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.Routing
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.util.Event0
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.*
import kotlinx.parcelize.Parcelize
import timber.log.Timber
@@ -24,14 +26,15 @@ class TetheringService : IpNeighbourMonitoringService(), TetheringManager.Tether
inner class Binder : android.os.Binder() {
val routingsChanged = Event0()
val monitoredIfaces get() = downstreams.values.filter { it.monitor }.map { it.downstream }
val monitoredIfaces get() = downstreams.values.map { it.downstream }
fun isActive(iface: String) = downstreams.containsKey(iface)
fun isInactive(iface: String) = downstreams[iface]?.run { !started && monitor }
fun monitored(iface: String) = downstreams[iface]?.monitor
}
private class Downstream(caller: Any, downstream: String, var monitor: Boolean = false) :
// hansonxyz - changed monitor default to true
private class Downstream(caller: Any, downstream: String, var monitor: Boolean = true) :
RoutingManager(caller, downstream) {
override fun Routing.configure() {
forward()
@@ -133,7 +136,7 @@ class TetheringService : IpNeighbourMonitoringService(), TetheringManager.Tether
onDownstreamsChangedLocked()
} else if (downstreams.isEmpty()) stopSelf(startId)
}
return START_NOT_STICKY
return START_STICKY //hansonxyz changed to sticky
}
override fun onDestroy() {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.client
package hanson.xyz.vpnhotspotmod.client
import android.net.MacAddress
import android.text.SpannableStringBuilder
@@ -6,15 +6,15 @@ import android.text.Spanned
import android.text.style.StrikethroughSpan
import androidx.lifecycle.map
import androidx.recyclerview.widget.DiffUtil
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.InetAddressComparator
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.room.ClientRecord
import be.mygod.vpnhotspot.util.makeIpSpan
import be.mygod.vpnhotspot.util.makeMacSpan
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.InetAddressComparator
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.room.ClientRecord
import hanson.xyz.vpnhotspotmod.util.makeIpSpan
import hanson.xyz.vpnhotspotmod.util.makeMacSpan
import java.net.InetAddress
import java.util.*

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.client
package hanson.xyz.vpnhotspotmod.client
import android.content.ComponentName
import android.content.IntentFilter
@@ -13,18 +13,18 @@ import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.RepeaterService
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.TetheringManager.localOnlyTetheredIfaces
import be.mygod.vpnhotspot.net.TetheringManager.tetheredIfaces
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.net.wifi.WifiClient
import be.mygod.vpnhotspot.root.WifiApCommands
import be.mygod.vpnhotspot.util.broadcastReceiver
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.RepeaterService
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.TetheringManager.localOnlyTetheredIfaces
import hanson.xyz.vpnhotspotmod.net.TetheringManager.tetheredIfaces
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.net.wifi.WifiClient
import hanson.xyz.vpnhotspotmod.root.WifiApCommands
import hanson.xyz.vpnhotspotmod.util.broadcastReceiver
class ClientViewModel : ViewModel(), ServiceConnection, IpNeighbourMonitor.Callback, DefaultLifecycleObserver,
WifiApManager.SoftApCallbackCompat {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.client
package hanson.xyz.vpnhotspotmod.client
import android.content.DialogInterface
import android.net.MacAddress
@@ -26,22 +26,22 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.AlertDialogFragment
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.Empty
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.databinding.FragmentClientsBinding
import be.mygod.vpnhotspot.databinding.ListitemClientBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.net.monitor.TrafficRecorder
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.room.ClientStats
import be.mygod.vpnhotspot.room.TrafficRecord
import be.mygod.vpnhotspot.util.format
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import be.mygod.vpnhotspot.util.toPluralInt
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.AlertDialogFragment
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.Empty
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.databinding.FragmentClientsBinding
import hanson.xyz.vpnhotspotmod.databinding.ListitemClientBinding
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.TrafficRecorder
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.room.ClientStats
import hanson.xyz.vpnhotspotmod.room.TrafficRecord
import hanson.xyz.vpnhotspotmod.util.format
import hanson.xyz.vpnhotspotmod.util.showAllowingStateLoss
import hanson.xyz.vpnhotspotmod.util.toPluralInt
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.client
package hanson.xyz.vpnhotspotmod.client
import android.content.Context
import android.net.MacAddress
import androidx.annotation.MainThread
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.util.connectCancellable
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.util.connectCancellable
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.Dispatchers
@@ -73,6 +73,7 @@ object MacLookup {
var response: String? = null
try {
response = connectCancellable("https://mac-address.alldatafeeds.com/api/mac-address/lookup") { conn ->
conn.doOutput = true
conn.requestMethod = "POST"
conn.setRequestProperty("Content-Type", "application/json")
conn.outputStream.writer().use { it.write("{\"mac-address\":\"$mac\"}") }

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
@@ -8,11 +8,11 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.util.broadcastReceiver
import be.mygod.vpnhotspot.util.readableMessage
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.util.broadcastReceiver
import hanson.xyz.vpnhotspotmod.util.readableMessage
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import timber.log.Timber
import java.lang.reflect.InvocationTargetException

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import androidx.databinding.BaseObservable

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.content.Intent
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.TetheringService
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.util.formatAddresses
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.TetheringService
import hanson.xyz.vpnhotspotmod.databinding.ListitemInterfaceBinding
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.util.formatAddresses
import java.util.*
class InterfaceManager(private val parent: TetheringFragment, val iface: String) : Manager() {
@@ -28,9 +28,10 @@ class InterfaceManager(private val parent: TetheringFragment, val iface: String)
.putExtra(TetheringService.EXTRA_ADD_INTERFACES, arrayOf(iface)))
}
}
private inner class Data : be.mygod.vpnhotspot.manage.Data() {
private inner class Data : hanson.xyz.vpnhotspotmod.manage.Data() {
override val icon get() = TetherType.ofInterface(iface).icon
override val title get() = if (parent.binder?.monitored(iface) == true) {
// override val title get() = if (true) {
parent.getString(R.string.tethering_state_monitored, iface)
} else iface
override val text get() = addresses

View File

@@ -1,10 +1,10 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.service.quicksettings.Tile
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.IpNeighbour
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.util.KillableTileService
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.util.KillableTileService
import java.net.Inet4Address
abstract class IpNeighbourMonitoringTileService : KillableTileService(), IpNeighbourMonitor.Callback {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.Manifest
import android.content.ComponentName
@@ -8,12 +8,12 @@ import android.os.Build
import android.os.IBinder
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.LocalOnlyHotspotService
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.formatAddresses
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.LocalOnlyHotspotService
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.databinding.ListitemInterfaceBinding
import hanson.xyz.vpnhotspotmod.util.ServiceForegroundConnector
import hanson.xyz.vpnhotspotmod.util.formatAddresses
import java.net.NetworkInterface
class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager(), ServiceConnection {
@@ -38,7 +38,7 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
if (binder?.iface == null) manager.parent.startLocalOnlyHotspot.launch(permission) else binder.stop()
}
}
private inner class Data : be.mygod.vpnhotspot.manage.Data() {
private inner class Data : hanson.xyz.vpnhotspotmod.manage.Data() {
private val lookup: Map<String, NetworkInterface> get() = parent.ifaceLookup
override val icon get() = R.drawable.ic_action_perm_scan_wifi

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.content.ComponentName
import android.content.Context
@@ -6,9 +6,9 @@ import android.content.Intent
import android.graphics.drawable.Icon
import android.os.IBinder
import android.service.quicksettings.Tile
import be.mygod.vpnhotspot.LocalOnlyHotspotService
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.util.stopAndUnbind
import hanson.xyz.vpnhotspotmod.LocalOnlyHotspotService
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.util.stopAndUnbind
class LocalOnlyHotspotTileService : IpNeighbourMonitoringTileService() {
private val tile by lazy { Icon.createWithResource(application, R.drawable.ic_action_perm_scan_wifi) }

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.content.Context
import android.content.Intent
import android.view.View
import androidx.databinding.BaseObservable
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.databinding.ListitemManageBinding
import be.mygod.vpnhotspot.net.TetherOffloadManager
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.databinding.ListitemManageBinding
import hanson.xyz.vpnhotspotmod.net.TetherOffloadManager
object ManageBar : Manager() {
private const val TAG = "ManageBar"

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.databinding.ListitemManageBinding
import be.mygod.vpnhotspot.databinding.ListitemRepeaterBinding
import hanson.xyz.vpnhotspotmod.databinding.ListitemInterfaceBinding
import hanson.xyz.vpnhotspotmod.databinding.ListitemManageBinding
import hanson.xyz.vpnhotspotmod.databinding.ListitemRepeaterBinding
abstract class Manager {
companion object DiffCallback : DiffUtil.ItemCallback<Manager>() {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.Manifest
import android.content.ComponentName
@@ -24,21 +24,21 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.withStarted
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.AlertDialogFragment
import be.mygod.vpnhotspot.BR
import be.mygod.vpnhotspot.Empty
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.RepeaterService
import be.mygod.vpnhotspot.databinding.ListitemRepeaterBinding
import be.mygod.vpnhotspot.net.wifi.P2pSupplicantConfiguration
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat
import be.mygod.vpnhotspot.net.wifi.WifiApDialogFragment
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.net.wifi.WifiSsidCompat
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.formatAddresses
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.AlertDialogFragment
import hanson.xyz.vpnhotspotmod.BR
import hanson.xyz.vpnhotspotmod.Empty
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.RepeaterService
import hanson.xyz.vpnhotspotmod.databinding.ListitemRepeaterBinding
import hanson.xyz.vpnhotspotmod.net.wifi.P2pSupplicantConfiguration
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApDialogFragment
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.net.wifi.WifiSsidCompat
import hanson.xyz.vpnhotspotmod.util.ServiceForegroundConnector
import hanson.xyz.vpnhotspotmod.util.formatAddresses
import hanson.xyz.vpnhotspotmod.util.showAllowingStateLoss
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.content.ComponentName
import android.content.Context
@@ -7,11 +7,11 @@ import android.graphics.drawable.Icon
import android.net.wifi.p2p.WifiP2pGroup
import android.os.IBinder
import android.service.quicksettings.Tile
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.RepeaterService
import be.mygod.vpnhotspot.util.KillableTileService
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.stopAndUnbind
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.RepeaterService
import hanson.xyz.vpnhotspotmod.util.KillableTileService
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.stopAndUnbind
class RepeaterTileService : KillableTileService() {
private val tile by lazy { Icon.createWithResource(application, R.drawable.ic_action_settings_input_antenna) }

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.Manifest
import android.annotation.TargetApi
@@ -19,16 +19,16 @@ import androidx.core.view.updatePaddingRelative
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.MainActivity
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.wifi.*
import be.mygod.vpnhotspot.root.WifiApCommands
import be.mygod.vpnhotspot.util.*
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.MainActivity
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.databinding.ListitemInterfaceBinding
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.wifi.*
import hanson.xyz.vpnhotspotmod.root.WifiApCommands
import hanson.xyz.vpnhotspotmod.util.*
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@@ -78,7 +78,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
/**
* A convenient class to delegate stuff to BaseObservable.
*/
inner class Data : be.mygod.vpnhotspot.manage.Data() {
inner class Data : hanson.xyz.vpnhotspotmod.manage.Data() {
override val icon get() = tetherType.icon
override val title get() = this@TetherManager.title
override val text get() = this@TetherManager.text

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.annotation.TargetApi
import android.bluetooth.BluetoothManager
@@ -21,22 +21,22 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.*
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.databinding.FragmentTetheringBinding
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.TetheringManager.localOnlyTetheredIfaces
import be.mygod.vpnhotspot.net.TetheringManager.tetheredIfaces
import be.mygod.vpnhotspot.net.monitor.TetherTimeoutMonitor
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat.Companion.toCompat
import be.mygod.vpnhotspot.net.wifi.WifiApDialogFragment
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.WifiApCommands
import be.mygod.vpnhotspot.util.*
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.*
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.databinding.FragmentTetheringBinding
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.TetheringManager.localOnlyTetheredIfaces
import hanson.xyz.vpnhotspotmod.net.TetheringManager.tetheredIfaces
import hanson.xyz.vpnhotspotmod.net.monitor.TetherTimeoutMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat.Companion.toCompat
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApDialogFragment
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.WifiApCommands
import hanson.xyz.vpnhotspotmod.util.*
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.manage
package hanson.xyz.vpnhotspotmod.manage
import android.bluetooth.BluetoothManager
import android.content.ComponentName
@@ -12,14 +12,14 @@ import android.service.quicksettings.Tile
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.TetheringService
import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.net.TetheringManager.tetheredIfaces
import be.mygod.vpnhotspot.util.broadcastReceiver
import be.mygod.vpnhotspot.util.readableMessage
import be.mygod.vpnhotspot.util.stopAndUnbind
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.TetheringService
import hanson.xyz.vpnhotspotmod.net.TetherType
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.net.TetheringManager.tetheredIfaces
import hanson.xyz.vpnhotspotmod.util.broadcastReceiver
import hanson.xyz.vpnhotspotmod.util.readableMessage
import hanson.xyz.vpnhotspotmod.util.stopAndUnbind
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.content.SharedPreferences
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.Routing.Companion.IP
import be.mygod.vpnhotspot.root.RoutingCommands
import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.Routing.Companion.IP
import hanson.xyz.vpnhotspotmod.root.RoutingCommands
import hanson.xyz.vpnhotspotmod.util.RootSession
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import java.net.InetAddress

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.net.MacAddress
import android.os.Build
import android.system.ErrnoException
import android.system.Os
import android.system.OsConstants
import be.mygod.vpnhotspot.root.ReadArp
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.util.parseNumericAddress
import hanson.xyz.vpnhotspotmod.root.ReadArp
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.util.parseNumericAddress
import kotlinx.coroutines.CancellationException
import timber.log.Timber
import java.io.File

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.net.MacAddress
import java.nio.ByteBuffer

View File

@@ -1,22 +1,22 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.net.LinkProperties
import android.net.MacAddress
import android.net.RouteInfo
import android.system.Os
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.monitor.FallbackUpstreamMonitor
import be.mygod.vpnhotspot.net.monitor.IpNeighbourMonitor
import be.mygod.vpnhotspot.net.monitor.TrafficRecorder
import be.mygod.vpnhotspot.net.monitor.UpstreamMonitor
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.RoutingCommands
import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.util.allInterfaceNames
import be.mygod.vpnhotspot.util.allRoutes
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.monitor.FallbackUpstreamMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.IpNeighbourMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.TrafficRecorder
import hanson.xyz.vpnhotspotmod.net.monitor.UpstreamMonitor
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.RoutingCommands
import hanson.xyz.vpnhotspotmod.util.RootSession
import hanson.xyz.vpnhotspotmod.util.allInterfaceNames
import hanson.xyz.vpnhotspotmod.util.allRoutes
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import timber.log.Timber
import java.io.BufferedWriter

View File

@@ -1,8 +1,8 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.provider.Settings
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.root.SettingsGlobalPut
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.root.SettingsGlobalPut
/**
* It's hard to change tethering rules with Tethering hardware acceleration enabled for now.

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.content.res.Resources
import android.os.Build
import androidx.annotation.DrawableRes
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.util.Event0
import be.mygod.vpnhotspot.util.findIdentifier
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.util.Event0
import hanson.xyz.vpnhotspotmod.util.findIdentifier
import timber.log.Timber
import java.util.regex.Pattern

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net
package hanson.xyz.vpnhotspotmod.net
import android.annotation.SuppressLint
import android.annotation.TargetApi
@@ -12,14 +12,18 @@ import android.net.Network
import android.os.Build
import android.os.DeadObjectException
import android.os.Handler
import android.os.Looper
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat.startActivity
import androidx.core.os.ExecutorCompat
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.StartTethering
import be.mygod.vpnhotspot.root.StopTethering
import be.mygod.vpnhotspot.util.*
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.StartTethering
import hanson.xyz.vpnhotspotmod.root.StopTethering
import hanson.xyz.vpnhotspotmod.util.*
import com.android.dx.stock.ProxyBuilder
import hanson.xyz.vpnhotspotmod.App
import hanson.xyz.vpnhotspotmod.TetheringService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
@@ -335,7 +339,7 @@ object TetheringManager {
rootCache.mkdirs()
check(rootCache.exists()) { "Creating root cache dir failed" }
RootManager.use {
it.execute(be.mygod.vpnhotspot.root.StartTetheringLegacy(
it.execute(hanson.xyz.vpnhotspotmod.root.StartTetheringLegacy(
rootCache, type, showProvisioningUi))
}.value
} catch (eRoot: Exception) {
@@ -447,7 +451,9 @@ object TetheringManager {
* multiple times later upon changes.
* @param interfaces The list of tetherable interface names.
*/
fun onTetherableInterfacesChanged(interfaces: List<String?>) {}
fun onTetherableInterfacesChanged(interfaces: List<String?>) {
//hansonxyz
}
/**
* Called when there was a change in the list of tethered interfaces.
@@ -554,10 +560,29 @@ object TetheringManager {
@Suppress("UNCHECKED_CAST")
callback?.onTetherableInterfacesChanged(args!![0] as List<String?>)
}
// modified by hansonxyz
method.matches1<java.util.List<*>>("onTetheredInterfacesChanged") -> {
@Suppress("UNCHECKED_CAST")
callback?.onTetheredInterfacesChanged(args!![0] as List<String?>)
val tetheredInterfaces = args!![0] as List<String?>
callback?.onTetheredInterfacesChanged(tetheredInterfaces)
// Toast.makeText(this, "Adding Tether Interface to VPN", 5).show()
// hansonxyz
tetheredInterfaces?.let {
for (iface in it) {
App.app.startForegroundService(
Intent(App.app, TetheringService::class.java)
.putExtra(
TetheringService.EXTRA_ADD_INTERFACES,
arrayOf(iface)
)
)
}
}
}
method.matches("onError", String::class.java, Integer.TYPE) -> {
callback?.onError(args!![0] as String, args[1] as Int)
}

View File

@@ -1,12 +1,12 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.net.ConnectivityManager
import android.net.LinkProperties
import android.net.Network
import android.net.NetworkCapabilities
import android.os.Build
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.globalNetworkRequestBuilder
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.globalNetworkRequestBuilder
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,7 +1,7 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.content.SharedPreferences
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,12 +1,12 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.net.ConnectivityManager
import android.net.LinkProperties
import android.net.Network
import android.net.NetworkCapabilities
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.allInterfaceNames
import be.mygod.vpnhotspot.util.globalNetworkRequestBuilder
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.allInterfaceNames
import hanson.xyz.vpnhotspotmod.util.globalNetworkRequestBuilder
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import timber.log.Timber

View File

@@ -1,17 +1,17 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.os.Build
import androidx.core.content.edit
import be.mygod.librootkotlinx.RootServer
import be.mygod.librootkotlinx.isEBADF
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.Routing
import be.mygod.vpnhotspot.root.ProcessData
import be.mygod.vpnhotspot.root.ProcessListener
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.RoutingCommands
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.Routing
import hanson.xyz.vpnhotspotmod.root.ProcessData
import hanson.xyz.vpnhotspotmod.root.ProcessListener
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.RoutingCommands
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.consumeEach

View File

@@ -1,7 +1,7 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import be.mygod.vpnhotspot.net.IpDev
import be.mygod.vpnhotspot.net.IpNeighbour
import hanson.xyz.vpnhotspotmod.net.IpDev
import hanson.xyz.vpnhotspotmod.net.IpNeighbour
import kotlinx.collections.immutable.PersistentMap
import kotlinx.collections.immutable.persistentMapOf
import kotlinx.collections.immutable.toPersistentMap

View File

@@ -1,13 +1,13 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.content.res.Resources
import android.os.Build
import android.provider.Settings
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.root.SettingsGlobalPut
import be.mygod.vpnhotspot.util.findIdentifier
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.root.SettingsGlobalPut
import hanson.xyz.vpnhotspotmod.util.findIdentifier
import kotlinx.coroutines.*
import timber.log.Timber
import kotlin.coroutines.CoroutineContext

View File

@@ -1,16 +1,16 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.net.MacAddress
import androidx.collection.LongSparseArray
import androidx.collection.set
import be.mygod.vpnhotspot.net.IpDev
import be.mygod.vpnhotspot.net.Routing.Companion.IPTABLES
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.room.TrafficRecord
import be.mygod.vpnhotspot.util.Event2
import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.util.parseNumericAddress
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.net.IpDev
import hanson.xyz.vpnhotspotmod.net.Routing.Companion.IPTABLES
import hanson.xyz.vpnhotspotmod.room.AppDatabase
import hanson.xyz.vpnhotspotmod.room.TrafficRecord
import hanson.xyz.vpnhotspotmod.util.Event2
import hanson.xyz.vpnhotspotmod.util.RootSession
import hanson.xyz.vpnhotspotmod.util.parseNumericAddress
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.GlobalScope

View File

@@ -1,8 +1,8 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.content.SharedPreferences
import android.net.LinkProperties
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.net.monitor
package hanson.xyz.vpnhotspotmod.net.monitor
import android.net.ConnectivityManager
import android.net.LinkProperties
import android.net.Network
import android.net.NetworkCapabilities
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.globalNetworkRequestBuilder
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.globalNetworkRequestBuilder
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import timber.log.Timber

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.net.MacAddress
import android.net.wifi.p2p.WifiP2pGroup
import be.mygod.vpnhotspot.RepeaterService
import be.mygod.vpnhotspot.net.MacAddressCompat
import be.mygod.vpnhotspot.root.RepeaterCommands
import be.mygod.vpnhotspot.root.RootManager
import hanson.xyz.vpnhotspotmod.RepeaterService
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat
import hanson.xyz.vpnhotspotmod.root.RepeaterCommands
import hanson.xyz.vpnhotspotmod.root.RootManager
import com.google.firebase.crashlytics.FirebaseCrashlytics
/**

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.TargetApi
import android.os.Build
import android.os.Parcelable
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.util.LongConstantLookup
import be.mygod.vpnhotspot.util.UnblockCentral
import hanson.xyz.vpnhotspotmod.util.LongConstantLookup
import hanson.xyz.vpnhotspotmod.util.UnblockCentral
import timber.log.Timber
@JvmInline

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.SuppressLint
import android.annotation.TargetApi
@@ -10,12 +10,12 @@ import android.os.Build
import android.os.Parcelable
import android.util.SparseIntArray
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.net.monitor.TetherTimeoutMonitor
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat.Companion.requireSingleBand
import be.mygod.vpnhotspot.net.wifi.SoftApConfigurationCompat.Companion.setChannel
import be.mygod.vpnhotspot.net.wifi.WifiSsidCompat.Companion.toCompat
import be.mygod.vpnhotspot.util.ConstantLookup
import be.mygod.vpnhotspot.util.UnblockCentral
import hanson.xyz.vpnhotspotmod.net.monitor.TetherTimeoutMonitor
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat.Companion.requireSingleBand
import hanson.xyz.vpnhotspotmod.net.wifi.SoftApConfigurationCompat.Companion.setChannel
import hanson.xyz.vpnhotspotmod.net.wifi.WifiSsidCompat.Companion.toCompat
import hanson.xyz.vpnhotspotmod.util.ConstantLookup
import hanson.xyz.vpnhotspotmod.util.UnblockCentral
import kotlinx.parcelize.Parcelize
import timber.log.Timber
import java.lang.reflect.InvocationTargetException

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.TargetApi
import android.net.MacAddress
import android.os.Parcelable
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.util.ConstantLookup
import be.mygod.vpnhotspot.util.UnblockCentral
import hanson.xyz.vpnhotspotmod.util.ConstantLookup
import hanson.xyz.vpnhotspotmod.util.UnblockCentral
import timber.log.Timber
@JvmInline

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.net.wifi.ScanResult
import androidx.annotation.RequiresApi

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.SuppressLint
import android.content.ClipData
@@ -22,22 +22,21 @@ import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.Toolbar
import androidx.core.os.BuildCompat
import androidx.core.os.persistableBundleOf
import androidx.core.view.isGone
import be.mygod.librootkotlinx.toByteArray
import be.mygod.librootkotlinx.toParcelable
import be.mygod.vpnhotspot.AlertDialogFragment
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.RepeaterService
import be.mygod.vpnhotspot.databinding.DialogWifiApBinding
import be.mygod.vpnhotspot.net.monitor.TetherTimeoutMonitor
import be.mygod.vpnhotspot.util.QRCodeDialog
import be.mygod.vpnhotspot.util.RangeInput
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.readableMessage
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import hanson.xyz.vpnhotspotmod.AlertDialogFragment
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.RepeaterService
import hanson.xyz.vpnhotspotmod.databinding.DialogWifiApBinding
import hanson.xyz.vpnhotspotmod.net.monitor.TetherTimeoutMonitor
import hanson.xyz.vpnhotspotmod.util.QRCodeDialog
import hanson.xyz.vpnhotspotmod.util.RangeInput
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.readableMessage
import hanson.xyz.vpnhotspotmod.util.showAllowingStateLoss
import com.google.android.material.textfield.TextInputLayout
import kotlinx.parcelize.Parcelize
import timber.log.Timber
@@ -517,7 +516,7 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
val canGenerate = ssidOk && passwordValid && bandError == null && canCopy
(dialog as? AlertDialog)?.getButton(DialogInterface.BUTTON_POSITIVE)?.isEnabled = canGenerate
dialogView.toolbar.menu.apply {
findItem(R.id.invalid).isVisible = canGenerate && BuildCompat.isAtLeastU() && !arg.p2pMode &&
findItem(R.id.invalid).isVisible = canGenerate && Build.VERSION.SDK_INT >= 34 && !arg.p2pMode &&
!arg.readOnly && !Services.wifi.validateSoftApConfiguration(generateConfig().toPlatform())
findItem(android.R.id.copy).isEnabled = canCopy
}

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.TargetApi
import android.content.Intent
@@ -11,8 +11,8 @@ import android.os.Build
import android.os.Handler
import android.os.Parcelable
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.util.*
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.util.*
import timber.log.Timber
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method

View File

@@ -1,10 +1,10 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.TargetApi
import android.net.MacAddress
import android.os.Parcelable
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.util.UnblockCentral
import hanson.xyz.vpnhotspotmod.util.UnblockCentral
import timber.log.Timber
@JvmInline

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.SuppressLint
import android.content.SharedPreferences
@@ -12,8 +12,8 @@ import androidx.core.content.edit
import androidx.core.content.getSystemService
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.util.Services
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.util.Services
/**
* This mechanism is used to maximize profit. Source: https://stackoverflow.com/a/29657230/2245107

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.annotation.SuppressLint
import android.net.MacAddress
@@ -8,10 +8,10 @@ import android.net.wifi.p2p.WifiP2pGroup
import android.net.wifi.p2p.WifiP2pInfo
import android.net.wifi.p2p.WifiP2pManager
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.MacAddressCompat
import be.mygod.vpnhotspot.util.callSuper
import be.mygod.vpnhotspot.util.matches
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat
import hanson.xyz.vpnhotspotmod.util.callSuper
import hanson.xyz.vpnhotspotmod.util.matches
import kotlinx.coroutines.CompletableDeferred
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.net.wifi
package hanson.xyz.vpnhotspotmod.net.wifi
import android.net.wifi.WifiSsid
import android.os.Parcelable

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.preference
package hanson.xyz.vpnhotspotmod.preference
import android.content.Context
import android.net.ConnectivityManager
@@ -12,11 +12,11 @@ import androidx.core.os.bundleOf
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.withStarted
import androidx.preference.EditTextPreferenceDialogFragmentCompat
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.allInterfaceNames
import be.mygod.vpnhotspot.util.globalNetworkRequestBuilder
import be.mygod.vpnhotspot.widget.AlwaysAutoCompleteEditText
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.allInterfaceNames
import hanson.xyz.vpnhotspotmod.util.globalNetworkRequestBuilder
import hanson.xyz.vpnhotspotmod.widget.AlwaysAutoCompleteEditText
import kotlinx.coroutines.launch
class AutoCompleteNetworkPreferenceDialogFragment : EditTextPreferenceDialogFragmentCompat() {

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.preference
package hanson.xyz.vpnhotspotmod.preference
import android.content.SharedPreferences
import androidx.core.content.edit

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.preference
package hanson.xyz.vpnhotspotmod.preference
import androidx.preference.EditTextPreference
import androidx.preference.Preference

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.preference
package hanson.xyz.vpnhotspotmod.preference
import android.content.Context
import android.graphics.Typeface
@@ -10,12 +10,12 @@ import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.monitor.FallbackUpstreamMonitor
import be.mygod.vpnhotspot.net.monitor.UpstreamMonitor
import be.mygod.vpnhotspot.util.allRoutes
import be.mygod.vpnhotspot.util.format
import be.mygod.vpnhotspot.util.parseNumericAddress
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.monitor.FallbackUpstreamMonitor
import hanson.xyz.vpnhotspotmod.net.monitor.UpstreamMonitor
import hanson.xyz.vpnhotspotmod.util.allRoutes
import hanson.xyz.vpnhotspotmod.util.format
import hanson.xyz.vpnhotspotmod.util.parseNumericAddress
import kotlinx.coroutines.launch
import timber.log.Timber

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.room
package hanson.xyz.vpnhotspotmod.room
import androidx.room.Database
import androidx.room.Room
@@ -6,7 +6,7 @@ import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import be.mygod.vpnhotspot.App.Companion.app
import hanson.xyz.vpnhotspotmod.App.Companion.app
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

View File

@@ -1,10 +1,10 @@
package be.mygod.vpnhotspot.room
package hanson.xyz.vpnhotspotmod.room
import android.net.MacAddress
import androidx.lifecycle.LiveData
import androidx.lifecycle.map
import androidx.room.*
import be.mygod.vpnhotspot.net.MacAddressCompat.Companion.toLong
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat.Companion.toLong
@Entity
data class ClientRecord(@PrimaryKey

View File

@@ -1,11 +1,11 @@
package be.mygod.vpnhotspot.room
package hanson.xyz.vpnhotspotmod.room
import android.net.MacAddress
import android.text.TextUtils
import androidx.room.TypeConverter
import be.mygod.librootkotlinx.useParcel
import be.mygod.vpnhotspot.net.MacAddressCompat
import be.mygod.vpnhotspot.net.MacAddressCompat.Companion.toLong
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat.Companion.toLong
import timber.log.Timber
import java.net.InetAddress

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.room
package hanson.xyz.vpnhotspotmod.room
import android.net.MacAddress
import android.os.Parcelable

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.net.wifi.SoftApConfiguration
import android.os.Parcelable

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.content.Context
import android.os.Parcelable
@@ -6,11 +6,11 @@ import android.os.RemoteException
import android.provider.Settings
import androidx.annotation.RequiresApi
import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.Routing.Companion.IP
import be.mygod.vpnhotspot.net.Routing.Companion.IPTABLES
import be.mygod.vpnhotspot.net.TetheringManager
import be.mygod.vpnhotspot.util.Services
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.Routing.Companion.IP
import hanson.xyz.vpnhotspotmod.net.Routing.Companion.IPTABLES
import hanson.xyz.vpnhotspotmod.net.TetheringManager
import hanson.xyz.vpnhotspotmod.util.Services
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.onClosed
import kotlinx.coroutines.channels.onFailure

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.net.MacAddress
import android.net.wifi.ScanResult
@@ -10,12 +10,12 @@ import android.system.OsConstants
import android.text.TextUtils
import androidx.annotation.RequiresApi
import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setVendorElements
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import be.mygod.vpnhotspot.util.Services
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.setVendorElements
import hanson.xyz.vpnhotspotmod.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import hanson.xyz.vpnhotspotmod.util.Services
import kotlinx.parcelize.Parcelize
import java.io.File
import java.io.IOException

View File

@@ -1,12 +1,12 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.annotation.SuppressLint
import android.os.Parcelable
import android.util.Log
import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.util.Services
import be.mygod.vpnhotspot.util.UnblockCentral
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.util.Services
import hanson.xyz.vpnhotspotmod.util.UnblockCentral
import com.google.firebase.crashlytics.FirebaseCrashlytics
import kotlinx.parcelize.Parcelize
import timber.log.Timber

View File

@@ -1,9 +1,9 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.os.Parcelable
import be.mygod.librootkotlinx.RootCommand
import be.mygod.librootkotlinx.RootCommandNoResult
import be.mygod.vpnhotspot.net.Routing
import hanson.xyz.vpnhotspotmod.net.Routing
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.root
package hanson.xyz.vpnhotspotmod.root
import android.annotation.TargetApi
import android.content.ClipData
@@ -10,11 +10,11 @@ import androidx.annotation.RequiresApi
import be.mygod.librootkotlinx.ParcelableBoolean
import be.mygod.librootkotlinx.RootCommand
import be.mygod.librootkotlinx.RootCommandChannel
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.net.wifi.WifiApManager
import be.mygod.vpnhotspot.net.wifi.WifiClient
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import hanson.xyz.vpnhotspotmod.net.wifi.WifiApManager
import hanson.xyz.vpnhotspotmod.net.wifi.WifiClient
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.parcelize.Parcelize

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.app.Activity

View File

@@ -1,10 +1,10 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.os.Build
import androidx.collection.LongSparseArray
import androidx.collection.SparseArrayCompat
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.R
import timber.log.Timber
class ConstantLookup(private val prefix: String, private val lookup29: Array<out String?>,

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.text.style.URLSpan
import android.view.View

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.annotation.SuppressLint
import android.app.Application

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import java.util.concurrent.ConcurrentHashMap

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.content.ComponentName
import android.content.Intent
@@ -8,7 +8,7 @@ import android.os.DeadObjectException
import android.os.IBinder
import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
import be.mygod.vpnhotspot.BootReceiver
import hanson.xyz.vpnhotspotmod.BootReceiver
abstract class KillableTileService : TileService(), ServiceConnection {
protected var tapPending = false

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.graphics.Bitmap
import android.graphics.Color
@@ -9,7 +9,7 @@ import android.widget.ImageView
import android.widget.Toast
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import be.mygod.vpnhotspot.R
import hanson.xyz.vpnhotspotmod.R
import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.MultiFormatWriter

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
object RangeInput {
fun toString(input: IntArray) = StringBuilder().apply {

View File

@@ -1,13 +1,14 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import be.mygod.librootkotlinx.RootServer
import be.mygod.vpnhotspot.root.RootManager
import be.mygod.vpnhotspot.root.RoutingCommands
import hanson.xyz.vpnhotspotmod.root.RootManager
import hanson.xyz.vpnhotspotmod.root.RoutingCommands
import kotlinx.coroutines.runBlocking
import timber.log.Timber
import java.util.*
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
import android.util.Log
class RootSession : AutoCloseable {
companion object {
@@ -38,8 +39,12 @@ class RootSession : AutoCloseable {
fun submit(command: String) = execQuiet(command).message(listOf(command))?.let { Timber.v(it) }
fun execQuiet(command: String, redirect: Boolean = false) = runBlocking {
// Log the command to debug console
Log.d("ExecQuiet", "Executing command: $command")
server!!.execute(RoutingCommands.Process(listOf("sh", "-c", command), redirect))
}
fun exec(command: String) = execQuiet(command).check(listOf(command))
/**

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.app.Service
import android.content.Context

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.content.Context
import android.net.ConnectivityManager

View File

@@ -1,12 +1,11 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.annotation.SuppressLint
import android.net.MacAddress
import android.net.wifi.SoftApConfiguration
import android.net.wifi.p2p.WifiP2pConfig
import androidx.annotation.RequiresApi
import be.mygod.vpnhotspot.App.Companion.app
import me.weishu.reflection.Reflection
import org.lsposed.hiddenapibypass.HiddenApiBypass
/**
* The central object for accessing all the useful blocked APIs. Thanks Google!
@@ -19,7 +18,7 @@ object UnblockCentral {
/**
* Retrieve this property before doing dangerous shit.
*/
private val init by lazy { if (needInit) check(Reflection.unseal(app.deviceStorage) == 0) }
private val init by lazy { if (needInit) check(HiddenApiBypass.setHiddenApiExemptions("")) }
@RequiresApi(33)
fun getCountryCode(clazz: Class<*>) = init.let { clazz.getDeclaredMethod("getCountryCode") }

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.util
package hanson.xyz.vpnhotspotmod.util
import android.annotation.SuppressLint
import android.annotation.TargetApi
@@ -9,21 +9,22 @@ import android.net.http.ConnectionMigrationOptions
import android.net.http.HttpEngine
import android.os.Build
import android.os.RemoteException
import android.os.ext.SdkExtensions
import android.text.*
import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.annotation.RequiresApi
import androidx.annotation.RequiresExtension
import androidx.core.net.toUri
import androidx.core.os.BuildCompat
import androidx.core.view.isVisible
import androidx.databinding.BindingAdapter
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.net.MacAddressCompat
import be.mygod.vpnhotspot.widget.SmartSnackbar
import hanson.xyz.vpnhotspotmod.App.Companion.app
import hanson.xyz.vpnhotspotmod.net.MacAddressCompat
import hanson.xyz.vpnhotspotmod.widget.SmartSnackbar
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@@ -251,8 +252,8 @@ fun globalNetworkRequestBuilder() = NetworkRequest.Builder().apply {
if (Build.VERSION.SDK_INT >= 31) setIncludeOtherUidNetworks(true)
}
@get:RequiresApi(34)
private val engine by lazy @TargetApi(34) {
@get:RequiresExtension(Build.VERSION_CODES.S, 7)
private val engine by lazy @RequiresExtension(Build.VERSION_CODES.S, 7) {
val cache = File(app.deviceStorage.cacheDir, "httpEngine")
HttpEngine.Builder(app.deviceStorage).apply {
if (cache.mkdirs() || cache.isDirectory) {
@@ -267,7 +268,8 @@ private val engine by lazy @TargetApi(34) {
}.build()
}
suspend fun <T> connectCancellable(url: String, block: suspend (HttpURLConnection) -> T): T {
val conn = (if (BuildCompat.isAtLeastU()) {
val conn = (if (Build.VERSION.SDK_INT >= 34 || Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
SdkExtensions.getExtensionVersion(Build.VERSION_CODES.S) >= 7) {
engine.openConnection(URL(url))
} else @Suppress("BlockingMethodInNonBlockingContext") URL(url).openConnection()) as HttpURLConnection
return suspendCancellableCoroutine { cont ->

View File

@@ -1,4 +1,4 @@
package be.mygod.vpnhotspot.widget
package hanson.xyz.vpnhotspotmod.widget
import android.content.Context
import android.graphics.Rect

Some files were not shown because too many files have changed in this diff Show More