Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bannedbook committed Apr 24, 2020
1 parent c6c2e67 commit d021ee4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ buildscript {
compileSdkVersion = 29
buildToolsVersion = '29.0.3'
desugarLibsVersion = '1.0.5'
versionCode = 422
versionName = '5.0.6.2R'
versionCode = 423
versionName = '5.0.6.3R'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
}

Expand Down
21 changes: 18 additions & 3 deletions core/src/main/java/SpeedUpVPN/VpnEncrypt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,38 @@ package SpeedUpVPN
import android.os.Build
import android.util.Log
import java.io.File
import java.util.*
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec


object VpnEncrypt{
private const val theKey="your aes key"
const val freesuburl="https://raw.githubusercontent.com/ssrsub/ssr/master/ssrsub"
const val vpnGroupName="SpeedUp.VPN"
const val freesubGroupName="https://git.io/jmsfq"
const val testing="test..."
const val HTTP_PROXY_PORT = 58200
@JvmStatic fun aesEncrypt(v:String, secretKey:String=theKey) = AES256.encrypt(v, secretKey)
@JvmStatic fun aesDecrypt(v:String, secretKey:String=theKey) = AES256.decrypt(v, secretKey)
@JvmStatic fun readFileAsTextUsingInputStream(fileName: String) = File(fileName).inputStream().readBytes().toString(Charsets.UTF_8)
const val HTTP_PROXY_PORT = 58200
}
@JvmStatic fun getUniqueID(): Int {
var szDevIDShort = "168169"
try {
szDevIDShort+=Build.BOARD.length % 10 + Build.BRAND.length % 10 + Build.DEVICE.length % 10 + Build.MANUFACTURER.length % 10 + Build.MODEL.length % 10 + Build.PRODUCT.length % 10
} catch (exception: Exception) {}
var serial: String? = null
try {
serial = Build::class.java.getField("SERIAL")[null].toString()
// Go ahead and return the serial for api => 9
return UUID(szDevIDShort.hashCode() as Long, serial.hashCode() as Long).hashCode()
} catch (exception: Exception) { // String needs to be initialized
serial = "https://git.io/jww" // some value
}

return UUID(szDevIDShort.hashCode().toLong(), serial.hashCode().toLong()).hashCode()
}
}

private object AES256{
private fun cipher(opmode:Int, secretKey:String):Cipher{
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/java/com/github/shadowsocks/Core.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*******************************************************************************/

package com.github.shadowsocks

import SpeedUpVPN.VpnEncrypt
import android.app.*
import android.app.admin.DevicePolicyManager
Expand Down Expand Up @@ -129,7 +128,11 @@ object Core {
fun importFreeSubs(): Boolean {
try {
GlobalScope.launch {
SSRSubManager.createBuiltinSub(VpnEncrypt.freesuburl)
var freesuburl = app.resources.getStringArray(R.array.freesuburl)
for (i in freesuburl.indices) {
var freeSub=SSRSubManager.createBuiltinSub(freesuburl[i])
if (freeSub != null) break
}
}
} catch (e: Exception) {
e.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ object ProfileManager {
* Note: It's caller's responsibility to update DirectBoot profile if necessary.
*/
@Throws(SQLException::class)
fun updateProfile(profile: Profile) = check(PrivateDatabase.profileDao.update(profile) == 1)
fun updateProfile(profile: Profile) = try {check(PrivateDatabase.profileDao.update(profile) == 1)}catch (t:Throwable){printLog(t)}

@Throws(IOException::class)
fun getProfile(id: Long): Profile? = try {
Expand All @@ -165,10 +165,10 @@ object ProfileManager {
check(PrivateDatabase.profileDao.delete(id) == 1)
listener?.onRemove(id)
if (id in Core.activeProfileIds && DataStore.directBootAware) DirectBoot.clean()
} catch (e: Exception) {
Log.e("speedup.vpn","",e)
}

catch (e:Exception){
Log.e("delProfile",e.toString())
}
}

@Throws(SQLException::class)
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,8 @@
<string-array name="builtinSubUrls">
<item>https://your_builtinSubUrls.com/path/sub.txt</item>
</string-array>
<string-array name="freesuburl">
<item>https://your_freeSubUrls.com/path/sub.txt</item>
</string-array>
<string name="update_check_url">https://raw.githubusercontent.com/bannedbook/SpeedUp.VPN/master/update.json</string>
</resources>
2 changes: 1 addition & 1 deletion gitupdate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ git pull origin master
git add -A
git commit -m "update"
git push origin master
git tag -a v5.0.6.2 -m "release v5.0.6.2"
git tag -a v5.0.6.3 -m "release v5.0.6.3"
git push origin --tags
pause
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,9 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
Core.stopService()
var isProxyStarted=false
for (k in 0 until profilesAdapter.profiles.size) {
if(testInvalidOnly && profilesAdapter.profiles[k].elapsed>0)continue
Log.e("real_ping_all",k.toString())
try {
if(testInvalidOnly && profilesAdapter.profiles[k].elapsed>0)continue
Log.e("real_ping_all",k.toString())
profilesAdapter.profiles[k].elapsed=-2
val old = DataStore.profileId
Core.switchProfile(profilesAdapter.profiles[k].id)
Expand All @@ -728,7 +728,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
while (tcping("127.0.0.1", DataStore.portProxy) < 0 || tcping("127.0.0.1", VpnEncrypt.HTTP_PROXY_PORT) < 0) {
Log.e("starting", "$k try $ttt ...")
if (ttt == 5) {
activity.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
activity?.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
Log.e("realTestProfiles","Server: "+profilesAdapter.profiles[k].name+" or the one before it caused the test to be interrupted.")
Core.stopService()
return@launch
Expand Down

0 comments on commit d021ee4

Please sign in to comment.