fix load_package completer

This commit is contained in:
AlessandroZ 2018-11-16 14:47:15 +01:00
parent 195fc44fb1
commit fabb684c80
2 changed files with 10 additions and 5 deletions

View File

@ -3,20 +3,24 @@
from pupylib.PupyModule import config, PupyModule, PupyArgumentParser
from pupylib.PupyCompleter import package_completer
__class_name__="LoadPackageModule"
__class_name__ = "LoadPackageModule"
@config(cat="manage", compat="all")
class LoadPackageModule(PupyModule):
""" Load a python package onto a remote client. Packages files must be placed in one of the pupy/packages/<os>/<arch>/ repository """
"""
Load a python package onto a remote client. Packages files must be placed in one of the pupy/packages/<os>/<arch>/ repository
"""
@classmethod
def init_argparse(cls):
cls.arg_parser = PupyArgumentParser(prog="load_package", description=cls.__doc__)
cls.arg_parser.add_argument('-f', '--force', action='store_true', help='force package to reload even if it has already been loaded')
cls.arg_parser.add_argument('-f', '--force', action='store_true', help='force package to reload even '
'if it has already been loaded')
cls.arg_parser.add_argument('-r', '--remove', action='store_true', help='remove (invalidate) module')
cls.arg_parser.add_argument('-d', '--dll', action='store_true', help='load a dll instead')
cls.arg_parser.add_argument('package', completer=package_completer, help='package name (example: psutil, scapy, ...)')
cls.arg_parser.add_argument('package', completer=package_completer, help='package name '
'(example: psutil, scapy, ...)')
def run(self, args):
if args.dll:

View File

@ -48,6 +48,7 @@ def package_completer(module, args, text, context):
except OSError:
continue
completion = ''
if stat.S_ISDIR(item_info.st_mode) and os.path.isfile(
os.path.join(os.path.join(dir_to_scan, item, '__init__.py'))):
completion = item