-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettingproxy.sh
More file actions
executable file
·47 lines (32 loc) · 986 Bytes
/
settingproxy.sh
File metadata and controls
executable file
·47 lines (32 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Author mxl
# 异常情况退出shell
set -e
echo -e "\033[32m-----设置代理转发(port:8100)-----\033[0m"
export PATH=$PATH:/usr/local/bin
auto_jump_root_path="/Users/${USER}/Desktop/autoscripts"
LOGS_DIR=${auto_jump_root_path}/logs
if [ ! -d $LOGS_DIR ]; then
mkdir $LOGS_DIR
fi
STDOUT_FILE=$LOGS_DIR/proxy.log
# 检查是否安装proxy
function assertHasProxy() {
if ! command -v iproxy > /dev/null; then
echo -e "\033[31m-----没有安装 libimobiledevice -----\033[0m"
echo -e "\033[32m-----正在安装 libimobiledevice -----\033[0m"
brew install libimobiledevice
fi
}
function addProxy() {
assertHasProxy
pid=$(ps -ef | grep 8100 | grep -v grep | awk '{print $2}') > $STDOUT_FILE 2>&1 &
if [[ -n ${pid} ]]; then
#statements
echo $pid > $STDOUT_FILE 2>&1 &
kill $pid > $STDOUT_FILE 2>&1 &
fi
# 获取设备的UDID
UDID=$(idevice_id -l | head -n1) > $STDOUT_FILE 2>&1 &
iproxy 8100 8100 ${UDID} > $STDOUT_FILE 2>&1 &
}
addProxy