Skip to content

Commit 72301b2

Browse files
committed
Do not use empty spec names for plugins.
Fixes sensepost#287
1 parent b999417 commit 72301b2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

objection/commands/plugin_manager.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import importlib.util
22
import os
33
import traceback
4+
import uuid
45

56
import click
67

8+
from ..console import commands
79
from ..utils.plugin import Plugin as PluginType
810

911

@@ -28,7 +30,7 @@ def load_plugin(args: list = None) -> None:
2830
os.path.dirname(path)), fg='red', dim=True)
2931
return
3032

31-
spec = importlib.util.spec_from_file_location('', path)
33+
spec = importlib.util.spec_from_file_location(str(uuid.uuid4())[:8], path)
3234
plugin = spec.loader.load_module()
3335
spec.loader.exec_module(plugin)
3436

@@ -53,7 +55,5 @@ def load_plugin(args: list = None) -> None:
5355
click.secho('{0}'.format(traceback.format_exc()), dim=True)
5456
return
5557

56-
from ..console import commands
5758
commands.COMMANDS['plugin']['commands'][instance.namespace] = instance.implementation
58-
5959
click.secho('Loaded plugin: {0}'.format(plugin.__name__), bold=True)

0 commit comments

Comments
 (0)