Commit 482578fe by sikang

update script

parent 7ca6d605
...@@ -14,6 +14,10 @@ config = Function().load_properties("../../gradle.properties") ...@@ -14,6 +14,10 @@ config = Function().load_properties("../../gradle.properties")
config['root'] = "../.." config['root'] = "../.."
config['jks_path'] = "../../jks" config['jks_path'] = "../../jks"
config['properties'] = "../../gradle.properties" config['properties'] = "../../gradle.properties"
config['apk_path'] = "../../resGuardApks/%s_%s_release.apk"% (config["corp_id"],config["app_name"])
config['jiagu_account'] = "15902141504"
config['jiagu_pwd'] = "qwqw10010"
config['jiagu_jar'] = "/Users/connor/Documents/resources/app/jiagubao/jiagu/jiagu.jar"
print(" ") print(" ")
...@@ -39,6 +43,7 @@ print("18、四大组件混淆") ...@@ -39,6 +43,7 @@ print("18、四大组件混淆")
print("19、包路径混淆") print("19、包路径混淆")
print("20、插入Activity") print("20、插入Activity")
print("21、reset project") print("21、reset project")
print("22、加固")
print("26、启用/禁用代码") print("26、启用/禁用代码")
command = int(input("请输入指令编号:")) command = int(input("请输入指令编号:"))
...@@ -127,5 +132,8 @@ elif command == 20: ...@@ -127,5 +132,8 @@ elif command == 20:
elif command == 21: elif command == 21:
Shell().reset_project(config) Shell().reset_project(config)
elif command == 21:
Shell().jiagu(config)
elif command == 26: elif command == 26:
SdkManager().sdk_manage(config) SdkManager().sdk_manage(config)
...@@ -4,11 +4,11 @@ import os ...@@ -4,11 +4,11 @@ import os
class Shell: class Shell:
#编译 待开发 # 编译 待开发
def build_release(self, config): def build_release(self, config):
command = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s"%config['root'], "cd %s" % config['root'],
"rm -rf resGuardApks", "rm -rf resGuardApks",
"gradlew clean", "gradlew clean",
"cd lib_base/script/garble", "cd lib_base/script/garble",
...@@ -19,32 +19,32 @@ class Shell: ...@@ -19,32 +19,32 @@ class Shell:
) )
os.system(command) os.system(command)
# commit&push project
#commit&push project def push_project(self, config):
def push_project(self,config):
command = "%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s"%config['root'], "cd %s" % config['root'],
"git add .", "git add .",
"git commit -m \"%s\"" % (config['app_id'] +" " + config['version_name']), "git commit -m \"%s\"" % (config['app_id'] +
" " + config['version_name']),
"git push origin %s" % config['git_branch'] "git push origin %s" % config['git_branch']
) )
os.system(command) os.system(command)
#commit&push lib_base # commit&push lib_base
def push_base(self,config): def push_base(self, config):
commit_msg = input("输入commit msg: ") commit_msg = input("输入commit msg: ")
command = "%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s/%s" % (config['root'],"lib_base"), "cd %s/%s" % (config['root'], "lib_base"),
"git add .", "git add .",
"git commit -m \"%s\"" % commit_msg, "git commit -m \"%s\"" % commit_msg,
"git push origin master" "git push origin master"
) )
os.system(command) os.system(command)
#pull lib_base & cash_plugin_toolbox # pull lib_base & cash_plugin_toolbox
def pull_base(self,config): def pull_base(self, config):
command = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s" % config['root'], "cd %s" % config['root'],
...@@ -61,29 +61,28 @@ class Shell: ...@@ -61,29 +61,28 @@ class Shell:
) )
os.system(command) os.system(command)
#push with tag # push with tag
def push_with_tag(self,config): def push_with_tag(self, config):
self.push_project(config) self.push_project(config)
tagName="t%s-%s" % (config['corp_id'],config['app_id']) tagName = "t%s-%s" % (config['corp_id'], config['app_id'])
command = "%s\n%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s" % config['root'], "cd %s" % config['root'],
"git tag -d %s" % tagName, "git tag -d %s" % tagName,
"git push origin --delete tag %s" % tagName, "git push origin --delete tag %s" % tagName,
"git tag -a %s -m %s" % (tagName,tagName), "git tag -a %s -m %s" % (tagName, tagName),
"git push origin %s" % tagName, "git push origin %s" % tagName,
) )
os.system(command) os.system(command)
# push with tag
def reset_by_pkgname(self, config):
#push with tag
def reset_by_pkgname(self,config):
pkgname = input("输入包名: ") pkgname = input("输入包名: ")
command = "%s\n%s" \ command = "%s\n%s" \
% ( % (
"cd %s" % config['root'], "cd %s" % config['root'],
"git log --grep %s"% pkgname "git log --grep %s" % pkgname
) )
os.system(command) os.system(command)
print(" ") print(" ")
...@@ -93,22 +92,30 @@ class Shell: ...@@ -93,22 +92,30 @@ class Shell:
command = "%s\n%s" \ command = "%s\n%s" \
% ( % (
"cd %s" % config['root'], "cd %s" % config['root'],
"git reset --hard %s"% commit_id "git reset --hard %s" % commit_id
) )
os.system(command) os.system(command)
print(" ") print(" ")
# reset project
#reset project def reset_project(self, config):
def reset_project(self,config):
command = "%s\n%s\n%s\n%s\n%s\n%s\n" \ command = "%s\n%s\n%s\n%s\n%s\n%s\n" \
% ( % (
"cd %s" % config['root'], "cd %s" % config['root'],
"git checkout . && git clean -df", "git checkout . && git clean -df",
"git reset --hard origin/%s"%config['git_branch'], "git reset --hard origin/%s" % config['git_branch'],
"cd lib_base || { echo \"lib_base not exist!\"; exit 1; }", "cd lib_base || { echo \"lib_base not exist!\"; exit 1; }",
"git checkout . && git clean -df", "git checkout . && git clean -df",
"git reset --hard origin/master", "git reset --hard origin/master",
) )
os.system(command) os.system(command)
def jiagu(self, config):
command = "%s\n%s\n%s\n%s\n"\
%(
"java -jar %s -login %s %s" % (config['jiagu_jar'], config['jiagu_account'], config["jiagu_pwd"]),
"java -jar %s -importsign %s/app/%s %s %s %s"% (config['jiagu_jar'], config['root'], config['signing_certificate'], config['signging_certificatePassword'], config['signing_keyAlias'], config['signging_storePassword']),
"java - jar %s - config - update - nocert" % config['jiagu_jar'],
"java - jar %s - jiagu %s %s -autosign"% (config['jiagu_jar'], config['apk_path'], config['apk_path'])
)
os.system(command)
\ No newline at end of file
#加固
root=${1}
jar_path=${2}
account='15902141504'
pwd='qwqw10010'
key_path="${root}/jks/"
java -jar ${jar_path} -login ${account} ${pwd}
java -jar ${jar_path} -importsign ../../${project_name}/app/${signing_certificate} ${signging_certificatePassword} ${signing_keyAlias} ${signging_storePassword}
#java -jar jiagu.jar -showsign
java -jar ${jar_path} -config -update -nocert
java -jar ${jar_path} -jiagu ../../${project_name}/resGuardApks/${project_name}_release.apk ../../${project_name}/resGuardApks -autosigns
cd ../../${project_name}
jiagu_apk=""
for file in resGuardApks/*; do
if [[ ${file} == *jiagu.apk ]]
then
jiagu_apk=${file}
fi
done
# V1 签名
jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA \
-keystore app/${signing_certificate} \
-storepass ${signging_storePassword} \
-keypass ${signging_certificatePassword} \
-signedjar resGuardApks/${project_name}_release_jg.apk ${jiagu_apk} \
${signing_keyAlias}
#copy到指定目录
now_time=$(date "+%Y-%m-%d %H_%M_%S")
cp "resGuardApks/${project_name}_release_jg.apk" "/Users/connor/Documents/apks/${project_name}_jg_${now_time}.apk"
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