def populate(self): # path = securityheaders.models.__path__[0] # with warnings.catch_warnings(): # warnings.simplefilter("ignore") # Util.load_all_modules_from_dir(path) clazzes = list(Util.inheritors(Header)) clazzes.extend(Util.inheritors(Directive)) clazzes.extend(Util.inheritors(Keyword)) for header in list(Util.inheritors(Header)): if hasattr(header,'headerkey'): self.headers[header.headerkey] = header all_my_base_classes = {cls: cls for cls in clazzes} for clazz in all_my_base_classes: self.clazzes[clazz.__name__] = clazz
def populate(self): #path = securityheaders.formatters.__path__[0] #with warnings.catch_warnings(): # warnings.simplefilter("ignore") # Util.load_all_modules_from_dir(path) clazzes = list(Util.inheritors(FindingFormatter)) all_my_base_classes = {cls: cls for cls in clazzes} for clazz in all_my_base_classes: self.clazzes[clazz.__name__] = clazz
from .xcontenttypeoptions import * from .xframeoptions import * from .xxssprotection import * from .referrerpolicy import * from .featurepolicy import * from .server import * from .xpoweredby import * from .xwebkitcsp import * from .xcsp import * from .xdownloadoptions import * from .expectct import * from .xaspnetversion import * from .xaspnetmvcversion import * from .hpkp import * from .xpcdp import * from .setcookie import * __all__ = [ 'annotations', 'csp', 'cors', 'clearsitedata', 'hsts', 'xcontenttypeoptions', 'xframeoptions', 'xxssprotection', 'featurepolicy', 'referrerpolicy', 'server', 'xpoweredby', 'expectct', 'xcsp', 'xwebkitcsp', 'xpcdp', 'xaspnetversion', 'xaspnetmvcversion', 'hpkp', 'xdownloadoptions' ] clazzes = list(Util.inheritors(Header)) clazzes.extend(Util.inheritors(Directive)) clazzes.extend(Util.inheritors(Keyword)) all_my_base_classes = {cls.__name__: cls for cls in clazzes} __all__.extend(all_my_base_classes) __all__.append('ModelFactory') __all__.append('CSPVersion')