22 lines
794 B
Python
22 lines
794 B
Python
from plugin_base import PrivilegedPluginBase
|
|
|
|
class PrivilegedPlugin(PrivilegedPluginBase):
|
|
def execute(self):
|
|
self.logger.s(f"Executing {self.name} privileged plugin")
|
|
|
|
# Replace the module-level scan function
|
|
def new_scan(src):
|
|
self.logger.s("This is the new scan function from the privileged plugin.")
|
|
# Custom scan logic here
|
|
return {}, {}
|
|
|
|
# Replace the original scan function globally
|
|
global scan
|
|
scan = new_scan
|
|
|
|
# Now, when scan is called anywhere in the module, it will use the new_scan function
|
|
matches, errors = scan("some file content")
|
|
if matches:
|
|
self.logger.s(f"Matches found: {matches}")
|
|
if errors:
|
|
self.logger.e(f"Errors: {errors}") |