Slight modification of existing templates, and created a blank server template module with comments

resolved_file
Chris Truncer 2014-12-25 12:15:11 -05:00
parent f4ec56acc5
commit 81a0764696
4 changed files with 34 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class Conductor:
pass pass
elif name.endswith(".pyc"): elif name.endswith(".pyc"):
pass pass
else: 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

View File

@ -26,6 +26,7 @@ class Server:
# handle keyboard interrupts # handle keyboard interrupts
except KeyboardInterrupt: except KeyboardInterrupt:
print "[!] Rage quiting, and stopping the web server!" print "[!] Rage quiting, and stopping the web server!"
return
def serve_on_port(self): def serve_on_port(self):
try: try:

View File

@ -28,6 +28,7 @@ class Server:
# handle keyboard interrupts # handle keyboard interrupts
except KeyboardInterrupt: except KeyboardInterrupt:
print "[!] Rage quiting, and stopping the web server!" print "[!] Rage quiting, and stopping the web server!"
return
def serve_on_port(self): def serve_on_port(self):
try: try:

View File

@ -0,0 +1,31 @@
'''
A brief description of the server module can be placed up here
All import should go between the comments and class declaration
If you have a question, feel free to check out the other server
modules ot just hit me up.
Finally, be sure to rename this to a .py file
'''
class Server:
def __init__(self, cli_object):
# This is the protocol that is viewable when using --list-servers
# This is what the user would use along with --server
# You have complete access to command line arguments
# within __init__
# Anything that needs to be set for the server to run should have
# a self attribute created within __init__
self.protocol = ""
# This is the main function that is called by the framework
# You can build out as many different functions, but they all
# need to be called from "serve". If there is a specific function
# or class that must be seperated out from this file (ideally keep
# everything in here if possible), then add them to the serverlibs
# directory
def serve(self):
return