Current File : //usr/sbin/pure-config.py
#! /usr/bin/python

#  Original pure-config.py by Frank Denis <j at pureftpd dot org>
#  Copyright 2001 by Joshua Rodman <joshua_rodman at yahoo dot com>,
#  Modifications Copyright 2001-2009 by Matthias Andree
#
#                All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software
# in original or modified form for any purpose and without fee
# is hereby granted, provided that the above copyright notice
# appear in all copies.
#
# Joshua Rodman DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS, IN NO EVENT SHALL Joshua Rodman BE LIABLE FOR
# ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

"""Pure-FTPd configuration parser.

   Parse pure-ftpd configuration file to options.
   If run directly, execute the program.

"""
import re
import os
import sys

# autoconf stuff
if '/usr/sbin'[0] == '/':
    pureftpd = '/usr/sbin/pure-ftpd'
else:
    pureftpd = '/usr/sbin/pure-ftpd'

argv = sys.argv[1:]
try:
    conffile = argv.pop(0)
except IndexError:
    print("Usage:", sys.argv[0], "<configuration file> [extra options]")
    sys.exit(1)

comment = re.compile("[ ]*#+.*")

# option_tuple members are lists as follows:
# 0 - case insensitive regex to match
# 1 - flag to use
# remaining - 'None' are placeholders for items matched by the regex
#             the matched items and literal strings are concatenated
#             into a literal option which follows the flag

option_tuple = (
    ["IPV4Only[\s]+yes",                   "-4"                  ],
    ["IPV6Only[\s]+yes",                   "-6"                  ],
    ["FileSystemCharset\s+(\S+)",          "-8", None            ],
    ["ClientCharset\s+(\S+)",              "-9", None            ],
    ["ChrootEveryone[\s]+yes",             "-A"                  ],
    ["TrustedGID[\s]+([\d]+)",             "-a", None            ],
    ["BrokenClientsCompatibility[\s]+yes", "-b"                  ],
    ["MaxClientsNumber\s+(\d+)",           "-c", None            ],
    ["Daemonize\s+yes",                    "-B"                  ],
    ["MaxClientsPerIP\s+(\d+)",            "-C", None            ],
    ["VerboseLog\s+yes",                   "-d"                  ],
    ["DisplayDotFiles\s+yes",              "-D"                  ],
    ["AnonymousOnly\s+yes",                "-e"                  ],
    ["MaxDiskUsage\s+(\d+)",               "-k", None            ],
    ["NoAnonymous\s+yes",                  "-E"                  ],
    ["SyslogFacility\s+(\S+)",             "-f", None            ],
    ["FortunesFile\s+(\S+)",               "-F", None            ],
    ["DontResolve\s+yes",                  "-H"                  ],
    ["MaxIdleTime\s+(\d+)",                "-I", None            ],
    ["LDAPConfigFile\s+(\S+)",             "-l", "ldap:",   None ],
    ["MySQLConfigFile\s+(\S+)",            "-l", "mysql:",  None ],
    ["PGSQLConfigFile\s+(\S+)",            "-l", "pgsql:",  None ],
    ["PureDB\s+(\S+)",                     "-l", "puredb:", None ],
    ["ExtAuth\s+(\S+)",                    "-l", "extauth:",None ],
    ["PAMAuthentication\s+yes",            "-l", "pam"           ],
    ["UnixAuthentication\s+yes",           "-l", "unix"          ],
    ["LimitRecursion\s+(\d+)\s+(\d+)",     "-L", None, ":", None ],
    ["AnonymousCanCreateDirs\s+yes",       "-M"                  ],
    ["MaxLoad\s+(\d+)",                    "-m", None            ],
    ["NATmode\s+yes",                      "-N"                  ],
    ["CallUploadScript\s+yes",             "-o"                  ],
    ["PassivePortRange\s+(\d+)\s+(\d+)",   "-p", None, ":", None ],
    ["ForcePassiveIP\s+(\S+)",             "-P", None            ],
    ["AnonymousRatio\s+(\d+)\s+(\d+)",     "-q", None, ":", None ],
    ["UserRatio\s+(\d+)\s+(\d+)",          "-Q", None, ":", None ],
    ["AntiWarez\s+yes",                    "-s"                  ],
    ["Bind\s+(\S+)",                       "-S", None            ],
    ["AnonymousBandwidth\s+([:0-9]+)",     "-t", None            ],
    ["UserBandwidth\s+([:0-9]+)",          "-T", None            ],
    ["Quota\s+([:0-9]+)",                  "-n", None            ],
    ["Umask\s+(\d+):(\d+)",                "-U", None, ":", None ],
    ["MinUID\s+(\d+)",                     "-u", None            ],
    ["AllowUserFXP\s+yes",                 "-w"                  ],
    ["AllowAnonymousFXP\s+yes",            "-W"                  ],
    ["ProhibitDotFilesWrite\s+yes",        "-x"                  ],
    ["ProhibitDotFilesRead\s+yes",         "-X"                  ],
    ["AllowDotFiles\s+yes",                "-z"                  ],
    ["AutoRename\s+yes",                   "-r"                  ],
    ["AnonymousCantUpload\s+yes",          "-i"                  ],
    ["TrustedIP\s+(\S+)",                  "-V", None            ],
    ["LogPID\s+yes",                       "-1"                  ],
    ["AltLog\s+(\S+)",                     "-O", None            ],
    ["NoChmod\s+yes",                      "-R"                  ],
    ["KeepAllFiles\s+yes",                 "-K"                  ],
    ["CreateHomeDir\s+yes",                "-j"                  ],
    ["NoRename\s+yes",                     "-G"                  ],
    ["CustomerProof\s+yes",                "-Z"                  ],
    ["NoTruncate\s+yes",                   "-0"                  ],
    ["PIDFile\s+(\S+)",                    "-g", None            ],
    ["TLSCipherSuite\s+(\S+)",             "-J", None            ],
    ["PerUserLimits\s+([:0-9]+)",          "-y", None            ],
    ["CertFile\s+(\S+)",                   "-2", None            ],
    ["TLS\s+(\d)",                         "-Y", None            ])

for option in option_tuple:
    option[0] = re.compile(option[0], re.IGNORECASE)


def build_argument(match, controls):
    """construct an argument string
    match:    a match object containing argument values
    controls: a list controlling the format of the argument

    Return parameter as string"""

    argument = ""
    value = 1

    for control in controls:
        if control:
            # concat the literal string
            argument = argument + control
        else:
            # concat a value
            argument = argument + match.group(value)
            value = value + 1

    return argument


def parse(file_obj):
    """parse/extract a pure-ftpd configuration
    file_obj: a readlines() capable object containing the configurion

    Returns list of arguments as appropriate for exec()"""

    args = [pureftpd]

    for line in file_obj.readlines():
        if comment.search(line):
            continue

        for option in option_tuple:
            match = option[0].search(line)
            if match:
                args.append(option[1])

                if len(option) <= 2:
                    # The option takes no argument
                    continue

                argument = build_argument(match, option[2:])
                args.append(argument)

    return args


def parse_filename(filename=conffile):
    """parse/extract a pure-ftpd from a named file
    filename: text path to file

    Returns list of arguments as appropriate for exec()"""

    file_obj = open(filename)
    return parse(file_obj)

if __name__ == '__main__':
    args = parse_filename()

    if os.isatty(1):
        print("Running:", args + argv)

    os.execv(pureftpd, args + argv)
blog

blog

1win официальный сайт букмекера — Обзор и зеркало для входа.3800

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Преимущества официального сайта 1win Как зарегистрироваться на официальном сайте 1win Обзор и Зеркало для Входа Способ 1: Вход через официальный сайт Способ 2: Вход через зеркало Преимущества и Функции 1win В мире ставок …

Read More »

Plinko Casino Game Online – Enjoy High Stakes Action.331

Plinko Casino Game Online Experience High Stakes Thrills and Excitement ▶️ PLAY Содержимое Plinko Casino Game: Rules and Basics How to Play Plinko for Beginners Understanding the Plinko Board Tips for New Players Strategies to Maximize Your Winnings in Plinko Casino Game Online Choose the Right Plinko Online Game Manage …

Read More »

Betshop Τι ΠΡΕΠΕΙ να γνωρίζεις πριν παίξεις.4947

Betshop Τι ΠΡΕΠΕΙ να γνωρίζεις πριν παίξεις ▶️ ΠΑΊΖΩ Содержимое Betshop Τι ΠΡΕΠΕΙ – να γνωρίζεις πριν παίξεις Η σημασία της ενημέρωσης πριν από το στοίχημα Πώς να επιλέξετε το σωστό στοίχημα Τα πλεονεκτήματα του Betshop για τους παίκτες Συμβουλές για ασφαλή και υπεύθυνο παιχνίδι Γιατί το Betshop είναι η …

Read More »

Online kaszinók Magyarországon 2025-ben: Hogyan találhat biztonságos és nyereséges kaszinót

Online kaszinók Magyarországon 2025-ben: Hogyan találhat biztonságos és nyereséges kaszinót Magyarországon az online szerencsejáték gyorsan fejlődik, bevételei meghaladják a sportfogadásokét. Sok felhasználó kedveli az online kaszinókat kényelmük, széles játékválasztékuk és vonzó bónuszaik miatt. Azonban a kezdők könnyen elveszhetnek a sokféle webhely között. Hogy tudatos döntést hozhass, érdemes felkeresni a hungary-kaszino.com …

Read More »

казино – Официальный сайт Pin up играть онлайн Зеркало и вход.494

Пин Ап казино – Официальный сайт Pin up играть онлайн | Зеркало и вход ▶️ ИГРАТЬ Содержимое Официальный сайт Pin Up Казино: Как играть онлайн, зеркало и вход Pin Up Casino – Официальный сайт Описание и функции Pin Up Казино Бонусы и акции Как играть онлайн и вход в Pin …

Read More »

Beste Online Casinos in Deutschland.64

Beste Online Casinos in Deutschland ▶️ SPIELEN Содержимое Regulierung und Sicherheit Top Casino-Anbieter 1. Bwin 2. LeoVegas 3. Betway 4. 888 Casino 5. Casino.de Bonusangebote und Promotions No-Deposit-Bonus Einwilligungsbasierte Bonus Freispins Wiederholungsbasierte Bonus Spiele und Anpassung an Spieler Vielfältige Spielangebote Anpassungsfunktionen für Spieler Wenn es um das Vergnügen und die …

Read More »

91 Club Online Casino in India Demo Mode and Practice.211

91 Club Online Casino in India – Demo Mode and Practice ▶️ PLAY Содержимое 91 Club Online Casino in India: A Comprehensive Guide What is 91 Club Online Casino? Games and Features Unlock the Fun with Demo Mode and Practice Start Your Journey with a Bang: Exclusive Offers and Promotions …

Read More »

Best Online Casinos in Canada.947

Best Online Casinos in Canada ▶️ PLAY Содержимое Top-Rated Online Casinos in Canada Best Online Casinos with Free Bonus How to Choose the Best Online Casino for You Consider Your Budget Canada is known for its rich history of gaming and entertainment, and the online casino industry is no exception. …

Read More »

91 Club Online Casino in India Demo Mode and Practice.1118

91 Club Online Casino in India – Demo Mode and Practice ▶️ PLAY Содержимое 91 Club Online Casino in India: A Comprehensive Guide Discover the Thrill of Online Casino Gaming with 91 Club Why Choose 91 Club? Practice Your Skills in Demo Mode and Get Ready to Win Big In …

Read More »