This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathdiggy.sh
104 lines (92 loc) · 1.85 KB
/
diggy.sh
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
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
green='\033[1;32m'
end='\033[1;m'
info='\033[1;33m[!]\033[1;m'
que='\033[1;34m[?]\033[1;m'
bad='\033[1;31m[-]\033[1;m'
good='\033[1;32m[+]\033[1;m'
run='\033[1;97m[~]\033[1;m'
printf """$green ___ _
/ _ \(_)__ ____ ___ __
/ // / / _ \`/ _ \`/ // /
/____/_/\_, /\_, /\_, /
/___//___//___/
$end"""
if [ $1 ]
then
:
else
printf "Usage: ./apk.sh <path to apk file>\n"
exit
fi
apk=$1
IFS='/' read -a temp <<< "$apk"
temp=${temp[-1]}
name=${temp::-4}
dir=$( pwd )
if [ $dir == "/root" ]
then
decom="/root/Diggy/$name"
links="/root/Diggy/$name.txt"
else
decom="$dir/$name"
links="$dir/$name.txt"
fi
if type "apktool" > /dev/null; then
:
else
printf "$bad Diggy requires 'apktool' to be installed."
exit
fi
if [ -e $decom ]
then
printf $"$info Looks like this apk has been decompiled already.\n"
printf "$que"
read -p " Decompile over the existing copy? [y/N] " choice
if [ choice == "y" ]
then
rm -r $decom
else
:
fi
else
:
fi
if [ -e $links ]
then
printf $"$info Looks like links have been already extracted from this apk.\n"
printf "$que"
read -p " Rewrite the previous result? [y/N] " choice
if [ choice == "y" ]
then
rm $links
else
:
fi
else
:
fi
extract () {
k=$(apktool d $apk -o $decom -fq)
}
regxy () {
matches=$(grep -ProI "[\"'\`](https?://|/)[\w\.-/]+[\"'\`]")
for final in $matches
do
final=${final//$"\""/}
final=${final//$"'"/}
if [ $(echo "$final" | grep "http://schemas.android.com") ]
then
:
else
echo "$final" >> "$links"
fi
done
awk '!x[$1]++' $links
}
printf $"$run Decompiling the apk\n"
extract
printf $"$run Extracting endpoints\n"
regxy
printf $"$info Endpoints saved in: $links\n"
exit