Skip to content

Commit cfb6ce5

Browse files
committed
Normalize component names
1 parent 1598352 commit cfb6ce5

28 files changed

Lines changed: 36 additions & 15 deletions

modules/DetermineMinSDK.py

100755100644
File mode changed.

modules/GeneralIssues.py

100755100644
File mode changed.

modules/IssueType.py

100755100644
File mode changed.

modules/adb.py

100755100644
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'''
77

88
from modules import common,intents,report
9+
import re
910

1011
def showAdbCommands(component,compType,packageName):
1112
#Print ADB commands for exploitation
@@ -29,27 +30,39 @@ def showAdbCommands(component,compType,packageName):
2930
extras_list+=intents.find_extras(str(c[1]),common.sourceDirectory)
3031
if len(extras_list)>0:
3132
for t in extras_list:
32-
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+str(c[1])+"\""+" --es "+str(t)
33+
if re.match(r'^\..*',str(c[1])):
34+
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+"/"+packageName+str(c[1])+"\""+" --es "+str(t)+" \"EXTRA_VALUE_IN_QUOTES\""
35+
else:
36+
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+"/"+str(c[1])+"\""+" --es "+str(t)+" \"EXTRA_VALUE_IN_QUOTES\""
3337
print command
3438
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, None, "activity")
3539
else:
36-
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+"/"+packageName+str(c[1])+"\""
40+
if re.match(r'^\..*',str(c[1])):
41+
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+"/"+packageName+str(c[1])+"\""
42+
else:
43+
command = "adb shell am start -a \"" + c[0] + "\" -n \""+packageName+"/"+str(c[1])+"\""
3744
print command
3845
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, None, "activity")
3946
else:
4047
common.logger.debug("No intent filter on: " + str(component))
4148
extras_list=[]
4249
extras_list+=intents.find_extras(str(component),common.sourceDirectory)
4350
if len(extras_list)>0:
44-
command = "adb shell am start -n \""+packageName+"/"+packageName+component+"\""
51+
if re.match(r'^\..*',str(component)):
52+
command = "adb shell am start -n \""+packageName+"/"+packageName+component+"\""
53+
else:
54+
command = "adb shell am start -n \""+packageName+"/"+component+"\""
4555
print command
4656
extras = []
4757
for e in extras_list:
4858
extras.append("Possible extras to send: " + str(e))
4959
print "Possible extras to send: " + str(e)
5060
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, extras, "activity")
5161
else:
52-
command = "adb shell am start -n \""+packageName+"/"+packageName+component+"\""
62+
if re.match(r'^\..*',str(component)):
63+
command = "adb shell am start -n \""+packageName+"/"+packageName+component+"\""
64+
else:
65+
command = "adb shell am start -n \""+packageName+"/"+component+"\""
5366
print command
5467
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, None, "activity")
5568
elif str(compType)=='service':
@@ -67,11 +80,17 @@ def showAdbCommands(component,compType,packageName):
6780
extras_list+=intents.find_extras(str(c[1]),common.sourceDirectory)
6881
if len(extras_list)>0:
6982
for t in extras_list:
70-
command = "adb shell am startservice " +packageName+"/"+str(c[1])+" --es "+str(t)
83+
if re.match(r'^\..*',str(c[1])):
84+
command = "adb shell am startservice " +packageName+"/"+packageName+str(c[1])+" --es "+str(t)
85+
else:
86+
command = "adb shell am startservice " +packageName+"/"+str(c[1])+" --es "+str(t)
7187
print command
7288
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, None, "service")
7389
else:
74-
command = "adb shell am startservice " +packageName+"/"+str(c[1])
90+
if re.match(r'^\..*',str(c[1])):
91+
command = "adb shell am startservice " +packageName+"/"+packageName+str(c[1])
92+
else:
93+
command = "adb shell am startservice " +packageName+"/"+str(c[1])
7594
print command
7695
report.write_adb_commands("adbcommands-issues-list", common.Severity.VULNERABILITY, command, None, "service")
7796
elif str(compType)=='receiver':

modules/certValidation.py

100755100644
File mode changed.

modules/common.py

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,9 @@ def tree(l):
430430

431431
def normalizeActivityNames(activityList,package_name):
432432
for d in range(0,len(activityList)):
433-
if not re.match(r''+str(package_name),str(activityList[d])):
433+
if re.match(r'\..*',str(activityList[d])):
434434
activityList[d]=str(package_name)+str(activityList[d])
435+
return activityList
435436

436437
def check_export(tag,output):
437438
"""

modules/contentProvider.py

100755100644
File mode changed.

modules/createExploit.py

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class ExploitType:
1010
"""
11-
Enum type for exploitatin category
11+
Enum type for exploitation category
1212
"""
1313
MANIFEST, ACTIVITY, INTENT, PERMISSION, SERVICE, RECEIVER, BROADCAST_INTENT, CERTIFICATE, WEBVIEW, CRYPTO = range(10)
1414

modules/createSploit.py

100755100644
File mode changed.

modules/cryptoFlaws.py

100755100644
File mode changed.

0 commit comments

Comments
 (0)