Small update/cleanup to Orchestra class

resolved_file
Chris Truncer 2015-01-24 14:45:23 -05:00
parent 32bb92c703
commit 86022ca4d1
2 changed files with 8 additions and 16 deletions

View File

@ -1,4 +1,8 @@
[1.4.2014] [1.24.2015]
Added...: DNS and ICMP client and server modules were previously added to the framework, but not documented in the changelog.
Modified: Conductor class modified for cleaner checks of modules to load - Thanks to @harmj0y for helping review it
[1.4.2015]
Added...: SMTP Client and Server modules have been added Added...: SMTP Client and Server modules have been added
[1.3.2015] [1.3.2015]

View File

@ -22,11 +22,7 @@ class Conductor:
def load_client_protocols(self, command_line_object): def load_client_protocols(self, command_line_object):
for name in glob.glob('protocols/clients/*.py'): for name in glob.glob('protocols/clients/*.py'):
if name.endswith("__init__.py"): if name.endswith(".py") and ("__init__" not in name):
pass
elif name.endswith(".pyc"):
pass
else:
loaded_client_proto = imp.load_source(name.replace("/", ".").rstrip('.py'), name) loaded_client_proto = imp.load_source(name.replace("/", ".").rstrip('.py'), name)
self.client_protocols[name] = loaded_client_proto.Client(command_line_object) self.client_protocols[name] = loaded_client_proto.Client(command_line_object)
return return
@ -34,22 +30,14 @@ class Conductor:
def load_server_protocols(self, command_line_object): def load_server_protocols(self, command_line_object):
for name in glob.glob('protocols/servers/*.py'): for name in glob.glob('protocols/servers/*.py'):
if name.endswith("__init__.py"): if name.endswith(".py") and ("__init__" not in name):
pass
elif name.endswith(".pyc"):
pass
elif name.endswith(".py"):
loaded_server_proto = imp.load_source(name.replace("/", ".").rstrip('.py'), name) loaded_server_proto = imp.load_source(name.replace("/", ".").rstrip('.py'), name)
self.server_protocols[name] = loaded_server_proto.Server(command_line_object) self.server_protocols[name] = loaded_server_proto.Server(command_line_object)
return return
def load_datatypes(self, command_line_object): def load_datatypes(self, command_line_object):
for name in glob.glob('datatypes/*.py'): for name in glob.glob('datatypes/*.py'):
if name.endswith("__init__.py"): if name.endswith(".py") and ("__init__" not in name):
pass
elif name.endswith(".pyc"):
pass
else:
loaded_datatypes = imp.load_source(name.replace("/", ".").rstrip('.py'), name) loaded_datatypes = imp.load_source(name.replace("/", ".").rstrip('.py'), name)
self.datatypes[name] = loaded_datatypes.Datatype(command_line_object) self.datatypes[name] = loaded_datatypes.Datatype(command_line_object)
return return