diff --git a/aosp/vendor/common/android/etc/attributes.xml b/aosp/vendor/common/android/etc/attributes.xml index 16ecc7f399d819aee7ee0380e285fc775b490115..ff40658a4b54c34260b3ab0039f108f3d9dae656 100644 --- a/aosp/vendor/common/android/etc/attributes.xml +++ b/aosp/vendor/common/android/etc/attributes.xml @@ -29,6 +29,7 @@ jp.pokemon.pokemontcgp com.gameloft.android.ANMP.GloftA9HM com.hybeim.astra + fisheye com.HoYoverse.hkrpgoversea diff --git a/aosp/vendor/common/android/proxy/proxy b/aosp/vendor/common/android/proxy/proxy deleted file mode 100644 index 5ae6b5532db779682c570c571576918d820be3f6..0000000000000000000000000000000000000000 --- a/aosp/vendor/common/android/proxy/proxy +++ /dev/null @@ -1,425 +0,0 @@ -#!/system/bin/sh - -VERSION=1.0 - -PROXY_ADDR="" -PROXY_PORT="" -PROXY_USER="" -PROXY_PASSWD="" -PROXY_PROTOCOL="" -PROXY_ENABLE_UDP="" - -PROXY_AUTO_START_ACTION="none" -PROXY_AUTO_START="" - -BASE64_CODE="" -BASE64_DECODE="" - -ENABLE_DEBUG="" -CLOSE_PROXY="" - -LOCAL_ADDR=127.0.0.1 -LOCAL_PORT=12345 - -KEYSTORE_CLI_BIN="/system/bin/keystore_cli_v2" - -KEY_NAME=$(getprop phone.id) -TMP_KEY_FILE="/data/misc/proxy_tmp" -ENCRYPT_KEY_FILE="/data/misc/proxy_en" -DECRYPT_KEY_FILE="/data/misc/proxy_de" - -GOST_BIN="/system/bin/gost" -GOST_CFG="/system/etc/gost.yml" - -SU="/sbin/su" - -RESOLVER=$(getprop net.dns1) - -# error code -# 101 Bad Parameter -# 102 proxy address is null -# 103 proxy port is null -# 104 proxy protocol is null -# 105 proxy not support this protocol currently -# 106 proxy user is null -# 107 proxy password is null -# 108 proxy not support this function currently -# 109 Proxy fail to enable auto start on booting system -# 110 Proxy can not execute bin -# 111 Proxy can not read config -# 112 Proxy can not execute su -# 201 Proxy fail to auto start on booting system - -usage() { - echo "" - echo "Usage: proxy [-r ] [-a
] [-p ] [-s ] [-k ] [-e] [-u]" - echo "" - echo "Options:" - echo " -r Specify the proxy protocol, e.g. socks5" - echo " -a
Specify the proxy IP address" - echo " -p Specify the proxy port" - echo " -s [Optional] Specify the proxy username" - echo " -k [Optional] Specify the proxy password" - echo " -l [Optional] Specify the proxy local listening port(default is 12345)" - echo " -u [Optional] Enable UDP" - echo " -e [Optional] Enable auto start the proxy on booting system" - echo " -c Close the proxy" - echo " -x Disable auto start the proxy on booting system" - echo " -d Display debug information" - echo " -v Display version" - echo " -h Display this usage information." - echo "" -} - -parse() { - OPTIND=1 - while getopts ":a:p:r:k:s:b:l:uhdcvexg" opt ; do - case ${opt} in - h) # help - usage - exit 0 - ;; - v) # version - echo "version: ${VERSION}" - exit 0 - ;; - b) # base64 code - BASE64_CODE="${OPTARG}" - return - ;; - a) # proxy address - PROXY_ADDR="${OPTARG}" - ;; - p) # proxy port - PROXY_PORT="${OPTARG}" - ;; - s) # proxy user - PROXY_USER="${OPTARG}" - ;; - k) # proxy password - PROXY_PASSWD="${OPTARG}" - ;; - r) # proxy protocol(socks5,ss,http,...) - PROXY_PROTOCOL="${OPTARG}" - ;; - u) # enable UDP - PROXY_ENABLE_UDP="true" - ;; - l) # local port - LOCAL_PORT="${OPTARG}" - ;; - d) # enable debug - ENABLE_DEBUG="true" - ;; - c) # close proxy - CLOSE_PROXY="true" - ;; - e) # enable auto start - PROXY_AUTO_START_ACTION="enable" - ;; - x) # disable auto start - PROXY_AUTO_START_ACTION="disable" - ;; - g) # auto-start not for user - echo "warning: this command is not for user!" - PROXY_AUTO_START="true" - ;; - \?) - echo "Bad parameters" - usage - exit 101 - ;; - esac - done -} - -validate() { - if [ "${PROXY_ADDR}" = "" ] ; then - echo "Error: proxy address is null" - exit 102 - fi - if [ "${PROXY_PORT}" = "" ] ; then - echo "Error: proxy port is null" - exit 103 - fi - if [ "${PROXY_PROTOCOL}" = "" ] ; then - echo "Error: proxy protocol is null" - exit 104 - fi - if [ "${PROXY_PROTOCOL}" != "socks5" ] ; then - echo "Error: proxy protocol only support socks5 currently" - exit 105 - fi - if [ "${PROXY_USER}" = "" ] && [ "${PROXY_PASSWD}" != "" ] ; then - echo "Error: proxy user is null" - exit 106 - fi - if [ "${PROXY_USER}" != "" ] && [ "${PROXY_PASSWD}" = "" ] ; then - echo "Error: proxy password is null" - exit 107 - fi - - if [ "${RESOLVER}" = "" ] ; then - RESOLVER=1.1.1.1 - echo "Warning: resolver use 1.1.1.1" - fi -} - -debug() { - echo "PROXY_ADDR=${PROXY_ADDR}" - echo "PROXY_PORT=${PROXY_PORT}" - echo "PROXY_USER=${PROXY_USER}" - echo "PROXY_PASSWD=${PROXY_PASSWD}" - echo "PROXY_PROTOCOL=${PROXY_PROTOCOL}" - echo "PROXY_ENABLE_UDP=${PROXY_ENABLE_UDP}" - echo "LOCAL_PORT=${LOCAL_PORT}" - echo "BASE64_CODE=${BASE64_CODE}" - echo "BASE64_DECODE=${BASE64_DECODE}" -} - -proxy_close() { - killall -9 gost > /dev/null 2>&1 -} - -proxy_open() { - PROXY_CREDENTIAL="" - if [ "${PROXY_USER}" != "" ] && [ "${PROXY_PASSWD}" != "" ] ; then - PROXY_CREDENTIAL="${PROXY_USER}:${PROXY_PASSWD}@" - fi - - if [ "${PROXY_AUTO_START}" = "true" ] ; then - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - ${GOST_BIN} -C "${GOST_CFG}" -L "red://${LOCAL_ADDR}:${LOCAL_PORT}?tproxy=true" -L "redu://${LOCAL_ADDR}:${LOCAL_PORT}?ttl=30s" -F "socks5://${PROXY_CREDENTIAL}${PROXY_ADDR}:${PROXY_PORT}?resolver=${RESOLVER}" > /dev/null 2>&1 - else - ${GOST_BIN} -C "${GOST_CFG}" -L "red://${LOCAL_ADDR}:${LOCAL_PORT}?tproxy=true" -F "socks5://${PROXY_CREDENTIAL}${PROXY_ADDR}:${PROXY_PORT}?resolver=${RESOLVER}" > /dev/null 2>&1 - fi - else - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - nohup ${GOST_BIN} -C "${GOST_CFG}" -L "red://${LOCAL_ADDR}:${LOCAL_PORT}?tproxy=true" -L "redu://${LOCAL_ADDR}:${LOCAL_PORT}?ttl=30s" -F "socks5://${PROXY_CREDENTIAL}${PROXY_ADDR}:${PROXY_PORT}?resolver=${RESOLVER}" > /dev/null 2>&1 & - else - nohup ${GOST_BIN} -C "${GOST_CFG}" -L "red://${LOCAL_ADDR}:${LOCAL_PORT}?tproxy=true" -F "socks5://${PROXY_CREDENTIAL}${PROXY_ADDR}:${PROXY_PORT}?resolver=${RESOLVER}" > /dev/null 2>&1 & - fi - fi -} - -rules_open() { - # mark为1的包走路由表100,100路由表默认都看作本机需要处理 - ip rule add fwmark 1 lookup 100 > /dev/null 2>&1 - ip route add local default dev lo table 100 > /dev/null 2>&1 - - # 创建GOST链 - iptables -t mangle -N GOST > /dev/null 2>&1 - - # ADB和CAE端口不走代理 - iptables -t mangle -A GOST -p tcp ! -d "${PROXY_ADDR}" --match multiport --dports 5555,7000,7001 -j RETURN > /dev/null 2>&1 - - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - iptables -t mangle -A GOST -p udp ! -d "${PROXY_ADDR}" --match multiport --dports 7000,7002 -j RETURN > /dev/null 2>&1 - fi - - # 本地流量不走代理 - iptables -t mangle -A GOST -d 0/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 10/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 127/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 169.254/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 172.16/12 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 192.168/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 224/4 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 240/4 -j RETURN > /dev/null 2>&1 - - # 管理面流量不走代理 - iptables -t mangle -A GOST -d 100.64/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 100.125/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST -d 214/8 -j RETURN > /dev/null 2>&1 - - # 发给代理服务器的流量不再走代理 - iptables -t mangle -A GOST -d "${PROXY_ADDR}" -j RETURN > /dev/null 2>&1 - - # 符合条件的tcp流转发到本地端口 - iptables -t mangle -A GOST -p tcp -j TPROXY --tproxy-mark 0x1/0x1 --on-port "${LOCAL_PORT}" > /dev/null 2>&1 - # 进入本机的tcp流量进GOST链 - iptables -t mangle -A PREROUTING -p tcp -j GOST > /dev/null 2>&1 - - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - # 符合条件的udp流转发到本地端口 - iptables -t mangle -A GOST -p udp -j TPROXY --tproxy-mark 0x1/0x1 --on-port "${LOCAL_PORT}" > /dev/null 2>&1 - # 进入本机的udp流量进GOST链 - iptables -t mangle -A PREROUTING -p udp -j GOST > /dev/null 2>&1 - fi - - iptables -t mangle -N GOST_LOCAL > /dev/null 2>&1 - - iptables -t mangle -A GOST_LOCAL -p tcp ! -d "${PROXY_ADDR}" --match multiport --sports 5555,7000,7001 -j RETURN > /dev/null 2>&1 - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - iptables -t mangle -A GOST_LOCAL -p udp ! -d "${PROXY_ADDR}" --match multiport --sports 7000,7002 -j RETURN > /dev/null 2>&1 - fi - - iptables -t mangle -A GOST_LOCAL -d 0/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 10/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 127/8 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 169.254/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 172.16/12 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 192.168/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 224/4 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 240/4 -j RETURN > /dev/null 2>&1 - - iptables -t mangle -A GOST_LOCAL -d 100.64/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 100.125/16 -j RETURN > /dev/null 2>&1 - iptables -t mangle -A GOST_LOCAL -d 214/8 -j RETURN > /dev/null 2>&1 - - iptables -t mangle -A GOST_LOCAL -d "${PROXY_ADDR}" -j RETURN > /dev/null 2>&1 - - # 需要走代理的tcp流量打标签 - iptables -t mangle -A GOST_LOCAL -p tcp -j MARK --set-mark 1 > /dev/null 2>&1 - # 本机进程发出去的tcp流量进入GOST_LOCAL链 - iptables -t mangle -A OUTPUT -p tcp -j GOST_LOCAL > /dev/null 2>&1 - - if [ "${PROXY_ENABLE_UDP}" = "true" ] ; then - # 需要走代理的udp流量打标签 - iptables -t mangle -A GOST_LOCAL -p udp -j MARK --set-mark 1 > /dev/null 2>&1 - # 本机进程发出去的udp流量进入GOST_LOCAL链 - iptables -t mangle -A OUTPUT -p udp -j GOST_LOCAL > /dev/null 2>&1 - fi - -} - -rules_close() { - # 删除规则 - iptables -t mangle -D PREROUTING -p tcp -j GOST > /dev/null 2>&1 - iptables -t mangle -D PREROUTING -p udp -j GOST > /dev/null 2>&1 - - iptables -t mangle -D OUTPUT -p tcp -j GOST_LOCAL > /dev/null 2>&1 - iptables -t mangle -D OUTPUT -p udp -j GOST_LOCAL > /dev/null 2>&1 - - iptables -t mangle -F GOST > /dev/null 2>&1 - iptables -t mangle -X GOST > /dev/null 2>&1 - - iptables -t mangle -F GOST_LOCAL > /dev/null 2>&1 - iptables -t mangle -X GOST_LOCAL > /dev/null 2>&1 - - ip route delete local default dev lo table 100 > /dev/null 2>&1 - ip rule delete fwmark 1 lookup 100 > /dev/null 2>&1 -} - -decode() { - BASE64_DECODE="$(echo "${BASE64_CODE}" | base64 -d)" - parse ${BASE64_DECODE} -} - -generate_key() { - ${SU} system ${KEYSTORE_CLI_BIN} generate --name="${KEY_NAME}" -} - -encrypt_with_key() { - ${SU} system ${KEYSTORE_CLI_BIN} encrypt --name="${KEY_NAME}" --in="${TMP_KEY_FILE}" --out="${ENCRYPT_KEY_FILE}" - if [ $? -ne 0 ]; then - echo "error: Proxy fail to enable auto start on booting system!" - rm -f "${TMP_KEY_FILE}" - rm -f "${ENCRYPT_KEY_FILE}" - exit 109 - fi -} - -decrypt_with_key() { - ${SU} system ${KEYSTORE_CLI_BIN} decrypt --name="${KEY_NAME}" --in="${ENCRYPT_KEY_FILE}" --out="${DECRYPT_KEY_FILE}" - if [ $? -ne 0 ]; then - echo "error: Proxy fail to auto start on booting system!" - rm -f "${DECRYPT_KEY_FILE}" - exit 201 - fi -} - -enable_auto_start() { - generate_key - rm -f "${TMP_KEY_FILE}" - rm -f "${ENCRYPT_KEY_FILE}" - ${SU} system touch "${ENCRYPT_KEY_FILE}" - ${SU} system touch "${TMP_KEY_FILE}" - echo "$@" > "${TMP_KEY_FILE}" - encrypt_with_key - rm -f "${TMP_KEY_FILE}" - echo "Proxy enable auto start on booting system!" -} - -disable_auto_start() { - rm -f "${ENCRYPT_KEY_FILE}" - echo "Proxy disable auto start on booting system!" -} - -auto_start() { - if [ ! -r "${ENCRYPT_KEY_FILE}" ]; then - # no auto-start - exit 0 - fi - rm -f "${DECRYPT_KEY_FILE}" - ${SU} system touch "${DECRYPT_KEY_FILE}" - decrypt_with_key - DECRYPT_INFO="$(cat ${DECRYPT_KEY_FILE})" - rm -f "${DECRYPT_KEY_FILE}" - parse ${DECRYPT_INFO} - PROXY_AUTO_START_ACTION="none" -} - -main() { - if [ ! -x "${GOST_BIN}" ] ; then - echo "Error: can not execute ${GOST_BIN}" - exit 110 - fi - - if [ ! -r "${GOST_CFG}" ] ; then - echo "Error: can not read ${GOST_CFG}" - exit 111 - fi - - if [ $# -eq 0 ] ; then - usage - exit 0 - fi - - parse "$@" - - if [ "${PROXY_AUTO_START_ACTION}" = "disable" ] ; then - disable_auto_start - fi - - if [ "${PROXY_AUTO_START_ACTION}" = "enable" ] && [ ! -x "${SU}" ] ; then - echo "Error: can not execute ${SU}" - exit 112 - fi - - if [ "${CLOSE_PROXY}" = "true" ] ; then - rules_close - proxy_close - echo "Proxy close!" - fi - - if [ "${PROXY_AUTO_START_ACTION}" = "disable" ] || [ "${CLOSE_PROXY}" = "true" ] ; then - exit 0 - fi - - if [ "${PROXY_AUTO_START}" = "true" ] ; then - auto_start - fi - - if [ "${BASE64_CODE}" != "" ] ; then - decode - fi - - if [ "${ENABLE_DEBUG}" = "true" ] ; then - debug - fi - - validate - proxy_close - rules_close - rules_open - proxy_open - - echo "Proxy open!" - - if [ "${PROXY_AUTO_START_ACTION}" = "enable" ] ; then - enable_auto_start "$@" - fi -} - -main "$@" \ No newline at end of file