混淆配置:调整混淆配置脚本
This commit is contained in:
@@ -299,7 +299,7 @@ xmlClassGuard {
|
||||
//用于增量混淆的 mapping 文件
|
||||
mappingFile = file("xml-class-mapping.txt")
|
||||
//更改manifest文件的package属性,即包名
|
||||
packageChange = ["com.nnbc123.app" : "app.yinm.chat",
|
||||
packageChange = ["com.nnbc123.app" : "app.yinm.app",
|
||||
"com.nnbc123.core" : "app.yinm.cc",
|
||||
"com.nnbc123.library": "app.yinm.ll"]
|
||||
|
||||
|
@@ -9,6 +9,7 @@ buildscript {
|
||||
println "\n\n\n"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven { url 'https://jitpack.io' }
|
||||
google()
|
||||
mavenCentral()
|
||||
|
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sh gradlew clean
|
||||
all_java_file=$(find ./ -name \*.java)
|
||||
echo "\n**********"
|
||||
echo "$all_java_file"
|
||||
echo "\n**********"
|
||||
same_name_file=$(echo "$all_java_file" | awk -F "/" '{print $NF}' | awk 'a[$0]++{print}' | sort | uniq)
|
||||
echo "\n**********"
|
||||
echo "$same_name_file"
|
||||
echo "\n**********"
|
||||
touch same_name_file.txt
|
||||
cat /dev/null > same_name_file.txt
|
||||
for n in ${same_name_file[*]}
|
||||
do
|
||||
echo "$all_java_file" | grep '/'"$n" >> same_name_file.txt
|
||||
done
|
||||
|
@@ -5,7 +5,7 @@
|
||||
include_path=("src/" "java/")
|
||||
|
||||
# 过滤条件:不能包含的路径||
|
||||
exclude_path=("com/nnbc123/app" "bean" "entity" "result" "ktx" "ext" "src/test" "src/androidTest")
|
||||
exclude_path=("com/nnbc123/app" "com/example/lib_encrypt" "bean" "entity" "result" "ktx" "ext" "src/test" "src/androidTest")
|
||||
|
||||
# 过滤条件:判断是否需要混淆(包中包含这些文件)
|
||||
file_extensions=("java" "kt")
|
||||
|
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
package_array=("app.yinm.b." "app.yinm.b.a." "app.yinm.b.b." "app.yinm.b.c." "app.yinm.b.d." "app.yinm.b.e.")
|
||||
same_name_files=$(cat same_name_file.txt)
|
||||
touch move_dir_map.txt
|
||||
cat /dev/null > move_dir_map.txt
|
||||
echo "[" >> move_dir_map.txt
|
||||
|
||||
end_with=(' ' '{' '.')
|
||||
|
||||
cp proguard_rules.txt proguard_rules_after_move_dir.txt
|
||||
|
||||
for file in ${same_name_files[*]}
|
||||
do
|
||||
echo "**********\n"
|
||||
|
||||
echo '文件 - '"$file"
|
||||
|
||||
split_str="/java"
|
||||
is_contain=$(echo "$file" | grep "$split_str")
|
||||
if [[ "$is_contain" == "" ]]
|
||||
then
|
||||
split_str="/src"
|
||||
fi
|
||||
|
||||
import_str=$(echo "$file" | awk -F "${split_str}/" '{print $2}' | awk -F "." '{print $1}' | sed 's/\//\./g')
|
||||
class_name=$(echo "$import_str" | awk -F "." '{print $NF}')
|
||||
package_path=$(echo "$import_str" | awk -F ".${class_name}" '{print $1}' )
|
||||
echo '包名 - '"$package_path"
|
||||
|
||||
is_gen=$(cat move_dir_map.txt | grep "$package_path")
|
||||
if [[ "$is_gen" != "" ]]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
|
||||
file_md5=$(echo "$file" | md5 | sed 's/[0-9]//g')
|
||||
random_index=$((RANDOM % ${#package_array[@]}))
|
||||
random_package=${package_array[$random_index]}
|
||||
new_name=${random_package}$(echo "$file_md5" | rev)
|
||||
echo '新包名 - '"$new_name"
|
||||
|
||||
for endStr in ${end_with[*]}
|
||||
do
|
||||
sed_format_package_path=$(echo "$package_path""$endStr" | sed 's/\./\\\./g')
|
||||
replace_str=$(echo "$new_name""$endStr" | sed 's/\./\\\./g')
|
||||
sed -i "" "s/${sed_format_package_path}/${replace_str}/g" proguard_rules_after_move_dir.txt
|
||||
done
|
||||
|
||||
echo '"'"$package_path"'" : "'"$new_name"'",' >> move_dir_map.txt
|
||||
|
||||
echo "\n**********"
|
||||
done
|
||||
|
||||
echo "]" >> move_dir_map.txt
|
57
gen_move_dir_app.sh
Executable file
57
gen_move_dir_app.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# 遍历当前文件下所有子目录,生成dir_mapping对应的K -> V
|
||||
|
||||
# 过滤条件:需包含的路径&&
|
||||
include_path=("src/" "java/" "com/nnbc123/app")
|
||||
|
||||
# 过滤条件:不能包含的路径||
|
||||
exclude_path=("bean" "entity" "result" "src/test" "src/androidTest")
|
||||
|
||||
# 过滤条件:判断是否需要混淆(包中包含这些文件)
|
||||
file_extensions=("java" "kt")
|
||||
|
||||
# 决定了输出位置(K):输出这个路径后的路径
|
||||
start_path="java/"
|
||||
|
||||
# 混淆后的包前缀(随机获取)
|
||||
package_array=("app.yinm.a." "app.yinm.a.a." "app.yinm.a.b." "app.yinm.a.c." "app.yinm.a.d." "app.yinm.a.e." "app.yinm.a.f." "app.yinm.a.g.")
|
||||
|
||||
touch move_dir.txt
|
||||
|
||||
find_include=""
|
||||
for a in "${include_path[@]}"; do
|
||||
find_include+=" -path \"*$a*\""
|
||||
done
|
||||
|
||||
find_exclude=""
|
||||
for b in "${exclude_path[@]}"; do
|
||||
find_exclude+=" -not -path \"*$b*\""
|
||||
done
|
||||
|
||||
# 构造文件扩展名参数
|
||||
file_ext_args=()
|
||||
for ext in "${file_extensions[@]}"; do
|
||||
file_ext_args+=("-o" "-name" "*.$ext")
|
||||
done
|
||||
# 删除第一个 -o
|
||||
file_ext_args=("${file_ext_args[@]:1}")
|
||||
|
||||
# 将 file_ext_args 转换为字符串
|
||||
file_ext_args_str=$(IFS=" "; echo "${file_ext_args[*]}")
|
||||
|
||||
# 使用find命令遍历子目录,找到符合条件的目录
|
||||
eval "find . -type d $find_include $find_exclude -exec sh -c 'test -n \"\$(find "{}" -maxdepth 1 -type f \( $file_ext_args_str \))\"' \; -print" | while IFS= read -r dir; do
|
||||
if [[ "$dir" == *"$start_path"* ]]; then
|
||||
key=$(echo "$dir" | awk -F "$start_path" '{print $NF}' | tr '/' '.')
|
||||
else
|
||||
key=$(echo "$dir" | tr '/' '.')
|
||||
fi
|
||||
|
||||
value=$(echo "$key" | md5 | sed 's/[0-9]//g')
|
||||
|
||||
random_index=$((RANDOM % ${#package_array[@]}))
|
||||
random_package=${package_array[$random_index]}
|
||||
move_dir="\"$key\" : \"$random_package$value\","
|
||||
echo $move_dir
|
||||
echo $move_dir >> move_dir.txt
|
||||
done
|
59
gen_move_dir_bean.sh
Executable file
59
gen_move_dir_bean.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# 遍历当前文件下所有子目录,生成dir_mapping对应的K -> V
|
||||
|
||||
# 过滤条件:需包含的路径&&
|
||||
include_path=("src/" "java/" "bean")
|
||||
#include_path=("src/" "java/" "result")
|
||||
#include_path=("src/" "java/" "entity")
|
||||
|
||||
# 过滤条件:不能包含的路径||
|
||||
exclude_path=("src/test" "src/androidTest")
|
||||
|
||||
# 过滤条件:判断是否需要混淆(包中包含这些文件)
|
||||
file_extensions=("java" "kt")
|
||||
|
||||
# 决定了输出位置(K):输出这个路径后的路径
|
||||
start_path="java/"
|
||||
|
||||
# 混淆后的包前缀(随机获取)
|
||||
package_array=("app.yinm.bean." "app.yinm.bean.a." "app.yinm.bean.b." "app.yinm.bean.c." "app.yinm.bean.d." "app.yinm.bean.e." "app.yinm.bean.f." "app.yinm.bean.g.")
|
||||
|
||||
touch move_dir.txt
|
||||
|
||||
find_include=""
|
||||
for a in "${include_path[@]}"; do
|
||||
find_include+=" -path \"*$a*\""
|
||||
done
|
||||
|
||||
find_exclude=""
|
||||
for b in "${exclude_path[@]}"; do
|
||||
find_exclude+=" -not -path \"*$b*\""
|
||||
done
|
||||
|
||||
# 构造文件扩展名参数
|
||||
file_ext_args=()
|
||||
for ext in "${file_extensions[@]}"; do
|
||||
file_ext_args+=("-o" "-name" "*.$ext")
|
||||
done
|
||||
# 删除第一个 -o
|
||||
file_ext_args=("${file_ext_args[@]:1}")
|
||||
|
||||
# 将 file_ext_args 转换为字符串
|
||||
file_ext_args_str=$(IFS=" "; echo "${file_ext_args[*]}")
|
||||
|
||||
# 使用find命令遍历子目录,找到符合条件的目录
|
||||
eval "find . -type d $find_include $find_exclude -exec sh -c 'test -n \"\$(find "{}" -maxdepth 1 -type f \( $file_ext_args_str \))\"' \; -print" | while IFS= read -r dir; do
|
||||
if [[ "$dir" == *"$start_path"* ]]; then
|
||||
key=$(echo "$dir" | awk -F "$start_path" '{print $NF}' | tr '/' '.')
|
||||
else
|
||||
key=$(echo "$dir" | tr '/' '.')
|
||||
fi
|
||||
|
||||
value=$(echo "$key" | md5 | sed 's/[0-9]//g')
|
||||
|
||||
random_index=$((RANDOM % ${#package_array[@]}))
|
||||
random_package=${package_array[$random_index]}
|
||||
move_dir="\"$key\" : \"$random_package$value\","
|
||||
echo $move_dir
|
||||
echo $move_dir >> move_dir.txt
|
||||
done
|
57
gen_move_dir_ktx.sh
Executable file
57
gen_move_dir_ktx.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# 遍历当前文件下所有子目录,生成dir_mapping对应的K -> V
|
||||
|
||||
# 过滤条件:需包含的路径&&
|
||||
include_path=("src/" "java/" "ktx")
|
||||
|
||||
# 过滤条件:不能包含的路径||
|
||||
exclude_path=("src/test" "src/androidTest")
|
||||
|
||||
# 过滤条件:判断是否需要混淆(包中包含这些文件)
|
||||
file_extensions=("java" "kt")
|
||||
|
||||
# 决定了输出位置(K):输出这个路径后的路径
|
||||
start_path="java/"
|
||||
|
||||
# 混淆后的包前缀(随机获取)
|
||||
package_array=("app.yinm.ktx.")
|
||||
|
||||
touch move_dir.txt
|
||||
|
||||
find_include=""
|
||||
for a in "${include_path[@]}"; do
|
||||
find_include+=" -path \"*$a*\""
|
||||
done
|
||||
|
||||
find_exclude=""
|
||||
for b in "${exclude_path[@]}"; do
|
||||
find_exclude+=" -not -path \"*$b*\""
|
||||
done
|
||||
|
||||
# 构造文件扩展名参数
|
||||
file_ext_args=()
|
||||
for ext in "${file_extensions[@]}"; do
|
||||
file_ext_args+=("-o" "-name" "*.$ext")
|
||||
done
|
||||
# 删除第一个 -o
|
||||
file_ext_args=("${file_ext_args[@]:1}")
|
||||
|
||||
# 将 file_ext_args 转换为字符串
|
||||
file_ext_args_str=$(IFS=" "; echo "${file_ext_args[*]}")
|
||||
|
||||
# 使用find命令遍历子目录,找到符合条件的目录
|
||||
eval "find . -type d $find_include $find_exclude -exec sh -c 'test -n \"\$(find "{}" -maxdepth 1 -type f \( $file_ext_args_str \))\"' \; -print" | while IFS= read -r dir; do
|
||||
if [[ "$dir" == *"$start_path"* ]]; then
|
||||
key=$(echo "$dir" | awk -F "$start_path" '{print $NF}' | tr '/' '.')
|
||||
else
|
||||
key=$(echo "$dir" | tr '/' '.')
|
||||
fi
|
||||
|
||||
value=$(echo "$key" | md5 | sed 's/[0-9]//g')
|
||||
|
||||
random_index=$((RANDOM % ${#package_array[@]}))
|
||||
random_package=${package_array[$random_index]}
|
||||
move_dir="\"$key\" : \"$random_package$value\","
|
||||
echo $move_dir
|
||||
echo $move_dir >> move_dir.txt
|
||||
done
|
8
recover_git.sh
Normal file
8
recover_git.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
git reset
|
||||
git checkout .
|
||||
git clean -fd app/
|
||||
git clean -fd core/
|
||||
git clean -fd library/
|
||||
git clean -fd libs/
|
||||
git clean -fd nim_uikit/
|
||||
git clean -fd android_crop_lib/
|
Reference in New Issue
Block a user