Exemplo n.º 1
0
from core.config import CONFIG
from core.redisquery import RedisQuery
from core.httpd import init_httpd_thread
from core.cli import Cli
from core.ui import UI
from core.mysqlquery import MySQLQuery

if __name__ == "__main__":
    UI.banner()

    if len(sys.argv) < 3:
        UI.error(
            "Missing configuration file path or username\n\nUsage: %s config username (optional -nohttpd)"
            % sys.argv[0], True)

    config = CONFIG(sys.argv[1])
    if config.reload_config():
        config = CONFIG(sys.argv[1])

    profile = config.get("http-profile")
    if not profile == "":
        Utils.file_exists(profile, True)
        profile = CONFIG(profile)
        config.set("profile", profile)

    uid = Utils.guid()
    config.set("uid", uid)
    config.set("username", "(CLI)%s" % sys.argv[2])
    db = RedisQuery(config)
    sql = MySQLQuery(config)
    sql.install_db().init_uid()
Exemplo n.º 2
0
import sys
from core.config import CONFIG
from core.redisquery import RedisQuery
from core.httpd import init_httpd_thread
from core.cli import Cli
from core.ui import UI

if __name__ == "__main__":
    UI.banner()

    if len(sys.argv) < 2:
        UI.error(
            "Missing configuration file path\n\nUsage: %s config (optional -nohttpd)"
            % sys.argv[0], True)

    config = CONFIG(sys.argv[1])
    db = RedisQuery(config)
    config.set("redis", db)

    # Launch the HTTPD daemon
    if not "-nohttpd" in sys.argv:
        httpd_thread = init_httpd_thread(config)

    cli = Cli(config)

    while True:
        try:
            cmd = cli.prompt()
            cli.parse_cmd(cmd)

        except KeyboardInterrupt as e: