Skip to content

Commit e29fb9a

Browse files
author
Ch0pin
committed
Added bulk-add modules and a fileprovider tracer script
1 parent 676cbb8 commit e29fb9a

File tree

3 files changed

+53
-5
lines changed

3 files changed

+53
-5
lines changed

libraries/Modules.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
import glob
34

45
class Module:
56
def __init__(self, fullPath, name, description, useCase, code):
@@ -48,6 +49,24 @@ def reset(self):
4849
self.staged = []
4950

5051
def stage(self, moduleName):
52+
added = False
53+
for mod in self.available:
54+
if mod.Name == moduleName and mod not in self.staged:
55+
self.staged.append(mod)
56+
break
57+
58+
elif mod.Name.startswith(moduleName):
59+
if mod not in self.staged:
60+
self.staged.append(mod)
61+
else:
62+
print('Module {} alread added !'.format(mod.Name))
63+
added = True
64+
if added:
65+
return
66+
else:
67+
print('Module {} not found!'.format(moduleName))
68+
69+
def stage_verbadim(self,moduleName):
5170
if moduleName not in [mod.Name for mod in self.staged]:
5271
for mod in self.available:
5372
if mod.Name == moduleName:
@@ -56,7 +75,14 @@ def stage(self, moduleName):
5675
print('Module {} not found!'.format(moduleName))
5776

5877
def unstage(self, moduleName):
59-
self.staged = [mod for mod in self.staged if mod.Name != moduleName]
78+
tmp = self.staged
79+
self.staged = [mod for mod in self.staged if not mod.Name.startswith(moduleName)]
80+
81+
if len(tmp) == len(self.staged):
82+
return False
83+
return True
84+
85+
#self.staged = [mod for mod in self.staged if mod.Name != moduleName]
6086

6187
def findModule(self, pattern):
6288
return [mod.Name for mod in self.available if pattern.casefold() in mod.Name.casefold()]

medusa.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def preloop(self):
7979
if line.startswith('MODULE'):
8080
module = line[7:-1]
8181
print('- Loading {}'.format(module))
82-
self.modManager.stage(module)
82+
self.modManager.stage_verbadim(module)
8383
else:
8484
data += line
8585
self.modified = True
@@ -688,9 +688,11 @@ def do_EOF(self, line):
688688

689689
def do_rem(self, mod):
690690
try:
691-
self.modManager.unstage(mod)
692-
print("\nRemoved: {}".format(mod) )
693-
self.modified = True
691+
if self.modManager.unstage(mod):
692+
print("\nRemoved module(s) starting with : {}".format(mod) )
693+
self.modified = True
694+
else:
695+
print("Module(s) is not active.")
694696
print()
695697
except Exception as e:
696698
print(e)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"Name": "content_providers/file_provider_implementation",
3+
"Description": "Logs maps of file->content URIs",
4+
"Help": "N/A",
5+
"Code": "
6+
console.log('\\n-----------File Provider impl Monitor by @chopin---------\\n');
7+
8+
let hook_1672136330 = Java.use('androidx.core.content.FileProvider$SimplePathStrategy');
9+
let overloadCount_1672136330 = hook_1672136330['addRoot'].overloads.length;
10+
for (let i = 0; i < overloadCount_1672136330; i++) {\n\thook_1672136330['addRoot'].overloads[i].implementation = function() {
11+
colorLog('[i] File Provider detected -> uri -> content://' + this.mAuthority.value +'/' + arguments[0],{ c: Color.Green });
12+
colorLog('\\t\\\\',{c: Color.Blue});\n\t\tcolorLog('\\t for --->file://'+arguments[1] +'\\n', {c: Color.Blue});
13+
let retval = this['addRoot'].apply(this, arguments);
14+
return retval;
15+
16+
}
17+
}
18+
19+
"
20+
}

0 commit comments

Comments
 (0)