Ejemplo n.º 1
0
def start(args):
    """
    启动
    """
    Config().load_config(args.config_path)

    init_check()

    real_log_path = os.path.realpath(Config().get_config("log.path"))
    log_level = Config().get_config("log.level").upper()
    print("[-] Log file will generate to {}, log level: {}".format(
        real_log_path, log_level))

    pid, config_path = Config().get_running_info()
    if pid != 0:
        try:
            os.kill(pid, 0)
        except OSError:
            pass
        else:
            print("[!] OpenRASP-IAST is already Running!")
            return

    from core.launcher import Launcher

    if not args.foreground:
        detach_run()

    Config().set_running_info()
    Launcher().launch()
Ejemplo n.º 2
0
def test_launcher():
    proc = multiprocessing.Process(target=Launcher().launch)
    proc.start()
    time.sleep(2)
    module_procs = psutil.Process(proc.pid).children(recursive=True)

    assert len(module_procs) > 2
    proc.terminate()
    proc.join(5)
    if proc.is_alive():
        raise Exception(
            "launcher process with pid {} may not be killed success!")

    time.sleep(Config().get_config("monitor.schedule_interval") * 2)
    for child in module_procs:
        try:
            child.wait(5)
        except psutil.TimeoutExpired:
            assert False

    Communicator.reset()
Ejemplo n.º 3
0
def start(args):
    """
    启动
    """
    Config().load_config(args.config_path)

    print("[-] Using config file: {}".format(Config().get_config_path()))

    init_check()
    from core.launcher import Launcher

    pid, config_path = Config().get_running_info()
    if pid != 0:
        try:
            os.kill(pid, 0)
        except OSError:
            pass
        else:
            print("[!] OpenRASP-IAST is already Running!")
            return
    if not args.foreground:
        detach_run()
    Config().set_running_info()
    Launcher().launch()