Skip to content

Commit

Permalink
Added bulk-add modules and a fileprovider tracer script
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch0pin committed Dec 29, 2022
1 parent 676cbb8 commit e29fb9a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
28 changes: 27 additions & 1 deletion libraries/Modules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import glob

class Module:
def __init__(self, fullPath, name, description, useCase, code):
Expand Down Expand Up @@ -48,6 +49,24 @@ def reset(self):
self.staged = []

def stage(self, moduleName):
added = False
for mod in self.available:
if mod.Name == moduleName and mod not in self.staged:
self.staged.append(mod)
break

elif mod.Name.startswith(moduleName):
if mod not in self.staged:
self.staged.append(mod)
else:
print('Module {} alread added !'.format(mod.Name))
added = True
if added:
return
else:
print('Module {} not found!'.format(moduleName))

def stage_verbadim(self,moduleName):
if moduleName not in [mod.Name for mod in self.staged]:
for mod in self.available:
if mod.Name == moduleName:
Expand All @@ -56,7 +75,14 @@ def stage(self, moduleName):
print('Module {} not found!'.format(moduleName))

def unstage(self, moduleName):
self.staged = [mod for mod in self.staged if mod.Name != moduleName]
tmp = self.staged
self.staged = [mod for mod in self.staged if not mod.Name.startswith(moduleName)]

if len(tmp) == len(self.staged):
return False
return True

#self.staged = [mod for mod in self.staged if mod.Name != moduleName]

def findModule(self, pattern):
return [mod.Name for mod in self.available if pattern.casefold() in mod.Name.casefold()]
10 changes: 6 additions & 4 deletions medusa.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def preloop(self):
if line.startswith('MODULE'):
module = line[7:-1]
print('- Loading {}'.format(module))
self.modManager.stage(module)
self.modManager.stage_verbadim(module)
else:
data += line
self.modified = True
Expand Down Expand Up @@ -688,9 +688,11 @@ def do_EOF(self, line):

def do_rem(self, mod):
try:
self.modManager.unstage(mod)
print("\nRemoved: {}".format(mod) )
self.modified = True
if self.modManager.unstage(mod):
print("\nRemoved module(s) starting with : {}".format(mod) )
self.modified = True
else:
print("Module(s) is not active.")
print()
except Exception as e:
print(e)
Expand Down
20 changes: 20 additions & 0 deletions modules/content_providers/file_provider_implemetation.med
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Name": "content_providers/file_provider_implementation",
"Description": "Logs maps of file->content URIs",
"Help": "N/A",
"Code": "
console.log('\\n-----------File Provider impl Monitor by @chopin---------\\n');

let hook_1672136330 = Java.use('androidx.core.content.FileProvider$SimplePathStrategy');
let overloadCount_1672136330 = hook_1672136330['addRoot'].overloads.length;
for (let i = 0; i < overloadCount_1672136330; i++) {\n\thook_1672136330['addRoot'].overloads[i].implementation = function() {
colorLog('[i] File Provider detected -> uri -> content://' + this.mAuthority.value +'/' + arguments[0],{ c: Color.Green });
colorLog('\\t\\\\',{c: Color.Blue});\n\t\tcolorLog('\\t for --->file://'+arguments[1] +'\\n', {c: Color.Blue});
let retval = this['addRoot'].apply(this, arguments);
return retval;

}
}

"
}

0 comments on commit e29fb9a

Please sign in to comment.