Skip to content

Commit

Permalink
Ftproot check (#28)
Browse files Browse the repository at this point in the history
FTPListener now checks for rel/abs service root path the way HTTPListener does
  • Loading branch information
strictlymike authored Jun 27, 2017
1 parent 9111e7b commit cd3640c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fakenet/listeners/FTPListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def __init__(self, config, name = 'FTPListener', logging_level = logging.INFO):
# Initialize webroot directory
self.ftproot_path = self.config.get('ftproot','defaultFiles')

# Try absolute path first
if not os.path.exists(self.ftproot_path):

# Try to locate the ftproot directory relative to application path
self.ftproot_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), self.ftproot_path)

if not os.path.exists(self.ftproot_path):
self.logger.error('Could not locate ftproot directory: %s', self.ftproot_path)
sys.exit(1)

def expand_ports(self, ports_list):
ports = []
for i in ports_list.split(','):
Expand Down

0 comments on commit cd3640c

Please sign in to comment.