def meta_autoname(cls):
"Dark magic to autogenerate a name for built-in shellcode classes."
# Ignore autonaming for classes that explicitly define a name.
if 'name' in cls.__dict__:
return
# Get the module name.
module = cls.__module__
# Ignore external modules.
if not module.startswith('shellgen.'):
return
# Get the submodule name.
module = module[9:]
# Ignore autonaming for base and abstract classes.
if module.startswith('base') or module.startswith('abstract'):
return
# Generate the shellcode name based on the submodule and class names.
cls.name = "%s (%s)" % (module, cls.__name__)
评论列表
文章目录