-
Notifications
You must be signed in to change notification settings - Fork 0
/
hack_contacts.py
executable file
·75 lines (50 loc) · 2.59 KB
/
hack_contacts.py
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
#!/usr/bin/python2
#
# Original script by Nicholas FitzRoy-Dale (lardcave.net)
# Modified by Natanji
#
import os
REPLACEMENTS = {
'Landroid/provider/ContactsContract$RawContacts;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->RAW_CONTACTS_CONTENT_URI:',
'Landroid/provider/ContactsContract$Contacts;->CONTENT_FILTER_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_FILTER_URI:',
'Landroid/provider/ContactsContract$Contacts;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_URI:',
'Landroid/provider/ContactsContract$Data;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->DATA_CONTENT_URI:',
'Landroid/provider/ContactsContract$CommonDataKinds$Phone;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CDK_PHONE_CONTENT_URI:',
'Landroid/provider/ContactsContract$PhoneLookup;->CONTENT_FILTER_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->PHONELOOKUP_CONTENT_FILTER_URI:',
'Landroid/provider/ContactsContract$RawContacts;->getContactLookupUri(':
'Lnet/lardcave/fakecontacts/FakeContract;->RawContacts_getContactLookupUri(',
'Landroid/provider/ContactsContract$Contacts;->CONTENT_VCARD_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_VCARD_URI:',
'Landroid/provider/ContactsContract$Contacts;->getLookupUri(':
'Lnet/lardcave/fakecontacts/FakeContract;->Contacts_getLookupUri(',
#added later
'Landroid/provider/ContactsContract$Profile;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_URI:',
'Landroid/provider/ContactsContract$AggregationExceptions;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_URI:',
'Landroid/provider/ContactsContract$CommonDataKinds$Email;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_URI:',
'Landroid/provider/ContactsContract$CommonDataKinds$StructuredPostal;->CONTENT_URI:':
'Lnet/lardcave/fakecontacts/FakeContract;->CONTACTS_CONTENT_URI:',
}
def getfiles():
filelist = []
def callback(arg, dirname, files):
filelist.extend(os.path.join(dirname, filename) for filename in files if filename.endswith('.smali'))
os.path.walk('apk/smali', callback, None)
return filelist
def rewrite(filename):
with open(filename, 'rb') as handle:
data = handle.read()
for repl in REPLACEMENTS.keys():
data = data.replace(repl, REPLACEMENTS[repl])
with open(filename, 'wb') as handle:
handle.write(data)
for filename in getfiles():
rewrite(filename)