コード例 #1
0
        else:
            path = args.dir
            BColor.ok("Use data path %s" % path)
            path_to_prefix_file = os.path.abspath(os.path.join(path, 'prefix_list'))
            as_list = load_prefix_list_from_file(path_to_prefix_file)

        BColor.process("Start resolve")

        delete_old = True
        if args.delete_old:
            BColor.ok("Not delete removed domains")
            delete_old = False

        name_server = '127.0.0.1'
        if args.name_server:
            BColor.ok("Use name server %s" % args.name_server)
            name_server = args.name_server

        Resolver.start_load_and_resolver_domain(as_list, os.path.abspath(os.path.join(path, 'work')),
                                                delete_old=delete_old, verbose=args.show_verbose,
                                                resolve_dns=name_server)

        if args.update_statistic:
            BColor.ok("Update statistic")
            statistic = Statistic()
            statistic.update_all_statistic()

    except Exception as e:
        BColor.error("Got an exception: %s" % e.message)
        print(traceback.format_exc())
コード例 #2
0
logfile = os.path.join(CURRENT_DIR, '%s.debug' % PROGRAM_NAME)

import traceback
from helpers.helpers import check_prog_run
from classes.resolver import Resolver
from helpers.helpersCollor import BColor


def print_log(log_flag, text):
    """
    Выводим сообщение в консоль или лог
    :type log_flag: bool
    :type text: unicode
    :return:
    """
    if log_flag:
        print(text)

if __name__ == "__main__":
    show_log = True
    try:
        if check_prog_run(PROGRAM_NAME):
            BColor.error("Program %s already running" % PROGRAM_NAME)
            sys.exit(1)

        Resolver.delete_not_updated_today()

    except Exception as e:
        BColor.error("Got an exception: %s" % e.message)
        print(traceback.format_exc())
コード例 #3
0
            save_prefix_list(as_list_text, path_to_prefix_file)

            BColor.process("Load AS list")
            as_list = load_prefix_list_from_var(as_list_text)

        else:
            path = args.dir
            BColor.ok("Use data path %s" % path)
            path_to_prefix_file = os.path.abspath(os.path.join(path, 'prefix_list'))
            as_list = load_prefix_list_from_file(path_to_prefix_file)

        BColor.process("Start resolve")

        delete_old = True
        if args.delete_old:
            BColor.ok("Not delete removed domains")
            delete_old = False

        name_server = '127.0.0.1'
        if args.name_server:
            BColor.ok("Use name server %s" % args.name_server)
            name_server = args.name_server

        Resolver.start_load_and_resolver_domain(as_list, os.path.abspath(os.path.join(path, 'work')),
                                                delete_old=delete_old, verbose=args.show_verbose,
                                                resolve_dns=name_server)

    except Exception as e:
        BColor.error("Got an exception: %s" % e.message)
        print traceback.format_exc()
コード例 #4
0
import traceback
from helpers.helpers import check_prog_run
from classes.resolver import Resolver
from helpers.helpersCollor import BColor


def print_log(log_flag, text):
    """
    Выводим сообщение в консоль или лог
    :type log_flag: bool
    :type text: unicode
    :return:
    """
    if log_flag:
        print text


if __name__ == "__main__":
    show_log = True
    try:
        if check_prog_run(PROGRAM_NAME):
            BColor.error("Program %s already running" % PROGRAM_NAME)
            sys.exit(1)

        Resolver.delete_not_updated_today()

    except Exception as e:
        BColor.error("Got an exception: %s" % e.message)
        print traceback.format_exc()