def LoadPayloads(self):
"""
Crawl the module path and load up everything found into self.payloads.
"""
# crawl up to 5 levels down the module path
for x in xrange(1,5):
# make the folder structure the key for the module
d = dict( (path[path.find("payloads")+9:-3], imp.load_source( "/".join(path.split("/")[3:])[:-3],path ) ) for path in glob.glob(join(settings.BYWAF_PATH+"/modules/payloads/" + "*/" * x,'[!_]*.py')) )
# instantiate the payload stager
for name in d.keys():
module = d[name].Payload()
self.payloads.append( (name, module) )
# sort payloads by their key/path name
self.payloads = sorted(self.payloads, key=lambda x: (x[0]))
评论列表
文章目录