-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathfox
More file actions
executable file
·92 lines (77 loc) · 2.07 KB
/
Copy pathfox
File metadata and controls
executable file
·92 lines (77 loc) · 2.07 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
#
# Fox: Android reverse-engineering toolkit.
set -euo pipefail
FOX_VERSION="1.0.0"
SELF_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
CMDS_PATH="${SELF_PATH}/cmds"
panic() {
printf 'fox: %s\n' "$*" >&2
exit 1
}
install() {
"${SELF_PATH}/extras/install" "$@"
}
version() {
printf 'fox version %s\n' "${FOX_VERSION}"
}
help() {
[[ -d "${CMDS_PATH}" ]] || panic "commands directory is missing"
cat <<'EOF'
usage: fox <command> [args]
Core commands:
version Show Fox version.
install [directory] Install/symlink bundled tools (default: ~/.local/bin).
doctor Validate the local toolchain and print versions.
help Show this help.
Android analysis commands:
decrom Decompile APK/JAR/DEX and ART OAT/ODEX images.
dump Regenerate Android framework-constant maps from SDK sources.
fixsrc Improve selected literals in JADX Java output.
replace Overlay source/resource trees by basename.
xmlcp Copy matching XML entries into companion XML files.
update Fast-forward Fox from its Git remote (legacy command).
EOF
local command
while IFS= read -r command; do
printf ' %s\n' "$(basename "${command}")"
done < <(find "${CMDS_PATH}" -maxdepth 1 -type f -perm -u+x -print | sort)
}
doctor() {
"${SELF_PATH}/cmds/doctor"
}
execute() {
local action="${1:-}"
[[ -n "${action}" ]] || {
help
return 1
}
local command="${CMDS_PATH}/${action}"
[[ -f "${command}" && -x "${command}" ]] || panic "'${action}' is not a fox command. See 'fox help'."
shift
exec "${command}" "$@"
}
action="${1:-}"
if [[ $# -gt 0 ]]; then
shift
fi
case "${action}" in
version|-V|--version)
version
;;
help|-h|--help)
help
;;
install)
install "$@"
;;
doctor)
doctor
;;
"")
help
;;
*)
execute "${action}" "$@"
;;
esac