-
Notifications
You must be signed in to change notification settings - Fork 145
/
search_urls.sh
executable file
·108 lines (92 loc) · 2.83 KB
/
search_urls.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
105
106
107
108
#!/bin/bash
#
# Script Arguments :
#
# First arg : directory of the "decompile-out" to be prepared
str_http_fog="MV49"
str_http_clear="\"http"
out_dir=__MODDED_APK_OUT__/urls/$1
mkdir -p ./$out_dir/
unfogged_url_file=../$out_dir/unfogged_urls.txt
fogged_url_file=../$out_dir/fogged_urls.txt
files_with_urls=../$out_dir/files_with_urls.txt
tmp_fogged_urls_file=../$out_dir/tmp_fogged_urls.txt
tmp_unfogged_urls_file=../$out_dir/tmp_unfogged_urls.txt
declare -A listOfFilesWithUrl assoc
declare -A foggedUrlsList assoc
declare -A unfoggedUrlsList assoc
parse_fogged_url_files () {
while read line
do
tokens=( $( echo $line ) )
filename=${tokens[0]}
if [[ $filename == *".smali" ]]
then
if ! [[ ${listOfFilesWithUrl[$filename]} ]]
then
listOfFilesWithUrl[$filename]=$filename
echo "$filename" >> $files_with_urls
fi
for token in ${tokens[@]}
do
if [[ $token == *$str_http_fog* ]]
then
if ! [[ ${foggedUrlsList[$token]} ]]
then
defog=$( ../defog_one_string.py 2 "$token")
foggedUrlsList[$token]=$defog
echo -e "0\t\"$defog\"\t$token" >> $fogged_url_file
fi
fi
done
fi
done < $1
}
parse_unfogged_url_files () {
while read line
do
tokens=( $( echo $line ) )
filename=${tokens[0]}
if [[ $filename == *".smali" ]]
then
if ! [[ ${listOfFilesWithUrl[$filename]} ]]
then
listOfFilesWithUrl[$filename]=$filename
echo "$filename" >> $files_with_urls
fi
for token in ${tokens[@]}
do
if [[ $token == *$str_http_clear* ]]
then
if ! [[ ${unfoggedUrlsList[$token]} ]]
then
unfoggedUrlsList[$token]=$token
echo -e "0\t$token" >> $unfogged_url_file
fi
fi
done
fi
done < $1
}
cd $1
if [ -e $unfogged_url_file ] || [ -e $fogged_url_file ] || [ -e $files_with_urls ]
then
echo "File needs to be deleted manually before regenerating"
exit 0
fi
rm -f $tmp_fogged_urls_file
rm -f $tmp_unfogged_urls_file
grep -T -r "\"MV49MhRk" >> $tmp_fogged_urls_file
grep -T -r "\"MV49Ml1x" >> $tmp_fogged_urls_file
grep -T -r "\"http://" >> $tmp_unfogged_urls_file
grep -T -r "\"https://" >> $tmp_unfogged_urls_file
parse_fogged_url_files $tmp_fogged_urls_file
parse_unfogged_url_files $tmp_unfogged_urls_file
echo "==============================================================================="
echo " generated files MUST be edited manually before applying url_patcher.sh "
echo " LAN adresses must remain disabled as well as some others like http:// "
echo " or https:// "
echo " you are welcome to share you config files... "
echo " files are in $out_dir "
echo " default config DO NOT DISABLE any url "
echo "==============================================================================="