Commit 4f6ddc12 authored by maxiaoliang's avatar maxiaoliang

添加fg

parent d4cb8972
......@@ -4,6 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
......
......@@ -80,5 +80,6 @@ dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
implementation ("com.solar.fileaceoneweea.inmanagerso:l1b2t123457j1:v30-jiagu-gp")
}
\ No newline at end of file
import os
import re
import shutil
import ssl
import urllib.request
from urllib.error import URLError
import regex as re2
import requests
ssl._create_default_https_context = ssl._create_unverified_context
def sub_map_text(mapping, is_reverse=True, path='.', skip_type=None, skip_name=None):
if len(mapping) == 0:
return []
if skip_type is None:
skip_type = []
if skip_name is None:
skip_name = []
result = []
sub_map_text_impl(mapping, result, skip_type, skip_name, is_reverse, path)
return result
def sub_map_text_impl(mapping, result, skip_type, skip_name, is_reverse=True, path='.'):
listdir = os.listdir(path)
for i in listdir:
path_join = os.path.join(path, i)
if os.path.isdir(path_join):
if path.endswith('.') and i in ["build", "debug", "release"]:
continue
if path.endswith('src') and i in ["androidTest", "test"]:
continue
sub_map_text_impl(mapping, result, skip_type, skip_name, is_reverse, path_join)
elif os.path.isfile(path_join):
if path.endswith('.') and i.split('.')[-1] in ['py']:
continue
if i.split('.')[-1] in skip_type:
continue
is_skip = False
for j in skip_name:
if j in i:
is_skip = True
break
if is_skip:
continue
with open(path_join, 'r', encoding='utf-8') as f:
if not f.readable():
continue
try:
text = f.read()
except ValueError:
continue
with open(path_join, 'w', encoding='utf-8') as f:
reverse = sorted(list(mapping.keys()), key=len, reverse=is_reverse)
text_result = text
for name in reverse:
text_result = re2.sub(str(name), mapping[name], text_result)
if text_result != text:
result.append(path_join)
f.write(text_result)
def copy_folder_exclude(src, dst, exclude_names=None):
if exclude_names is None:
exclude_names = []
if not os.path.exists(dst):
os.makedirs(dst)
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if item in exclude_names:
continue
if os.path.isdir(s):
copy_folder_exclude(s, d, exclude_names)
else:
shutil.copy2(s, d)
def get_desktop_path():
# Windows 系统
if os.name == 'nt':
desktop = os.path.join(os.getenv('USERPROFILE'), 'Desktop')
# macOS 系统
elif os.name == 'posix':
desktop = os.path.join(os.getenv('HOME'), 'Desktop')
# Linux 或其他 Unix-like 系统可能需要手动指定
else:
desktop = os.path.join(os.getenv('HOME'), 'Desktop') # 可能的默认位置
return desktop
def find_text_impl(reg, result, skip_name, path, is_one):
listdir = os.listdir(path)
for i in listdir:
if is_one and len(result) > 0:
return
path_join = os.path.join(path, i)
if os.path.isdir(path_join):
if path.endswith('.') and i in ["build", "debug", "release"]:
continue
if path.endswith('src') and i in ["androidTest", "test"]:
continue
find_text_impl(reg, result, skip_name, path_join, is_one)
elif os.path.isfile(path_join):
if path.endswith('.') and i.split('.')[-1] in ['py']:
continue
is_skip = False
for j in skip_name:
if j in i:
is_skip = True
break
if is_skip:
continue
with open(path_join, 'r', encoding='utf-8') as f:
if not f.readable():
continue
try:
text = f.read()
except ValueError:
continue
findall = re.findall(reg, text)
if len(findall) > 0:
result.extend(findall)
def find_text(reg, path='.', is_one=False, skip_name=None):
if skip_name is None:
skip_name = []
result = []
if os.path.isdir(path):
find_text_impl(reg, result, skip_name, path, is_one)
else:
with open(path, 'r', encoding='utf-8') as f:
if f.readable():
try:
text = f.read()
findall = re.findall(reg, text)
if len(findall) > 0:
result.extend(findall)
except ValueError:
pass
if is_one:
return result[0]
return result
def get_path(path):
return path.replace('\\', os.path.sep)
def main():
isMinifyEnabled = find_text('release ?{\\s*?(?:isM|m)inifyEnabled(?: ?= ?| )(false|true)', is_one=True)
if isMinifyEnabled == 'false':
print('官方混淆未开启')
exit()
# 测试包名
applicationId = find_text('applicationId .*?["\'](.*?)["\']', is_one=True)
# 正式包名
packageName_id = find_text('packageName = R.string.(\\w+?).string\\(\\)', is_one=True)
packageName_id = ''.join(['\\u' + format(ord(c), '04x') for c in packageName_id[:-2]]) + '_D'
packageName = find_text('"(.*?)": "' + re.escape(packageName_id) + '"', is_one=True)
sub_map = {
applicationId: packageName
}
print('包名: %s -> %s' % (applicationId, packageName))
res = requests.get(
url="http://data-api.zhangxinhulian.com/cms/add/apps_info/getBuildCfg?tgyz=1",
params={"pkg": packageName}
)
data = res.json()['result']['data']
print(data)
fileUrl = data['fileUrl']
adIds = data.get('buildCfg')
eventUrl = data['reportDomain']
apiUrl = data['apiDomain']
facebookId = data['facebookApId']
configString = data['appCfg']
if adIds is not None:
admobId = adIds['admobApplicationId']
openId = adIds['admobOpenAdId']
interId = adIds['admobInternalAdId']
nativeId = adIds['admobNativeAdId']
rewardId = adIds['admobRewardAdId']
if admobId is not None:
sub_map['(?<="com.google.android.gms.ads.APPLICATION_ID"\\s*?android:value=")[\\w~-]*?(?=")'] = admobId
if openId is not None:
sub_map['(?<=val openAdmobId = )\\S*'] = '"' + openId + '"'
if interId is not None:
sub_map['(?<=val interAdmobId = )\\S*'] = '"' + interId + '"'
if nativeId is not None:
sub_map['(?<=val nativeAdmobId = )\\S*'] = '"' + nativeId + '"'
if rewardId is not None:
sub_map['(?<=val rewardAdmobId = )\\S*'] = '"' + rewardId + '"'
if eventUrl is not None:
sub_map['(?<=val eventUrl = )\\S*'] = '"' + eventUrl + '"'
if apiUrl is not None:
sub_map['(?<=val apiUrl = )\\S*'] = '"' + apiUrl + '"'
if configString is not None:
sub_map['(?<=var configString = )\\S*'] = '"' + configString + '"'
sub_map_text(sub_map)
if facebookId is None:
print('后台facebookId 未配置')
elif len(find_text('<string name=".*?">' + facebookId + '</string>')) == 0:
print('facebook 配置出错')
try:
urllib.request.urlretrieve(fileUrl, 'google-services.json')
print('google-services.json 替换成功')
except URLError as e:
print('google-services.json 替换失败')
print(e)
return
input('回车开始压缩(\\n)')
versionName = find_text('versionName.*?"(.*?)"', is_one=True)
path = os.path.abspath(get_path('..\\'))
new_path = os.path.join(get_desktop_path(), os.path.basename(path) + '_' + versionName)
exclusions = ['.git', '.gradle', '.idea', 'build', '.gitignore', 'local.properties', '.gitignore', 'mapping.json', 'packing.py', 'proguard.py', 'release', 'debug']
copy_folder_exclude(path, new_path, exclusions)
shutil.make_archive(new_path, 'zip', new_path)
shutil.rmtree(new_path)
print('Done!')
if __name__ == '__main__':
main()
This diff is collapsed.
......@@ -9,12 +9,14 @@
tools:ignore="ScopedStorage" />
<application
android:name=".MyApplicaiton"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/zsd_589878"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:requestLegacyExternalStorage="true"
android:requestRawExternalStorageAccess="true"
android:supportsRtl="true"
android:theme="@style/Theme.SolarMasterAce"
tools:targetApi="31">
......
package com.zxhy.solarmasterace
import android.app.Application
class MyApplicaiton:Application() {
companion object {
lateinit var context: MyApplicaiton
}
override fun onCreate() {
super.onCreate()
context = this
}
}
\ No newline at end of file
package com.zxhy.solarmasterace.tools
import android.util.Base64
import java.security.SecureRandom
import javax.crypto.Cipher
import javax.crypto.spec.GCMParameterSpec
import javax.crypto.spec.SecretKeySpec
object AESHelper {
private const val aesKey = ""
private val cipher by lazy {
Cipher.getInstance("AES/GCM/NoPadding")
}
fun encrypt(content: String): String {
try {
val iv = ByteArray(12).apply {
SecureRandom().nextBytes(this)
}
val contentBytes = content.toByteArray(Charsets.UTF_8)
val params = GCMParameterSpec(128, iv)
cipher.init(
Cipher.ENCRYPT_MODE,
secretKey, params
)
val encryptData = cipher.doFinal(contentBytes)
assert(encryptData.size == contentBytes.size + 16)
val message = ByteArray(12 + contentBytes.size + 16)
System.arraycopy(iv, 0, message, 0, 12)
System.arraycopy(encryptData, 0, message, 12, encryptData.size)
return String(Base64.encode(message, Base64.NO_WRAP), Charsets.UTF_8)
} catch (_: Exception) {
}
return content
}
@Synchronized
fun decrypt(content: String): String {
try {
val con = content.replace(" ".toRegex(), "+")
val contentByte = Base64.decode(con, Base64.NO_WRAP)
require(contentByte.size >= 12 + 16)
val params = GCMParameterSpec(128, contentByte, 0, 12)
cipher.init(
Cipher.DECRYPT_MODE,
secretKey, params
)
val decryptData = cipher.doFinal(contentByte, 12, contentByte.size - 12)
return String(decryptData, Charsets.UTF_8)
} catch (_: Exception) {
}
return content
}
private val secretKey by lazy {
SecretKeySpec(aesKey.toByteArray(), "AES")
}
}
\ No newline at end of file
package com.zxhy.solarmasterace.tools
import android.content.Context
import android.util.AttributeSet
import com.zxhy.solarmasterace.tools.KotlinExt.decode
class AESTextView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : androidx.appcompat.widget.AppCompatTextView(context, attrs) {
override fun setText(text: CharSequence?, type: BufferType?) {
super.setText(text?.toString().takeIf { it != it?.decode() }?.decode() ?: text, type)
}
}
\ No newline at end of file
package com.zxhy.solarmasterace.tools
import android.view.View
import com.zxhy.solarmasterace.MyApplicaiton
import java.text.SimpleDateFormat
import java.util.Locale
object KotlinExt {
private val aesMap = mutableMapOf<Int, String>()
fun Int.string(vararg arg: Any) = try {
(aesMap[this] ?: MyApplicaiton.context.getString(this).decode()).run {
aesMap[this@string] = this
String.format(this, *arg)
}
} catch (_: Exception) {
""
}
fun String.decode() = AESHelper.decrypt(this)
.replace("\\n", "\n")
.replace("\\'", "'")
.replace("\\?", "?")
.replace("&amp;", "&")
fun Collection<View>.setOnClickListener(listener: (View) -> Unit) {
this.forEach {
it.setOnClickListener(listener)
}
}
fun Number.toFormatSize(count: Int = 2): String {
var suffix = "B"
var fSize = this.toDouble()
if (fSize > 1024) {
suffix = "KB"
fSize /= 1024.0
}
if (fSize > 1024) {
suffix = "MB"
fSize /= 1024.0
}
if (fSize > 1024) {
suffix = "GB"
fSize /= 1024.0
}
return String.format("%.${count}f %s", fSize, suffix)
}
fun Long.toFormatTime(): String {
return SimpleDateFormat("MMM dd,yyyy", Locale.getDefault()).format(this)
}
}
\ No newline at end of file
......@@ -16,7 +16,14 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://packages.aliyun.com/maven/repository/2279663-release-AiyNZM/") {
credentials {
username = "621344be8af5d39eb3f17f3e"
password = "(ijI1DwR7[wG"
}
}
}
}
rootProject.name = "Solar Master Ace"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment