#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os

from lib.core.data import cmdLineOptions
from lib.core.data import conf
from lib.core.exception import CrackerFilePathException

def init():
    # get password list
    conf.password.extend(cmdLineOptions.password)

    if cmdLineOptions.file:
        if not os.path.isfile(cmdLineOptions.file):
            raise CrackerFilePathException
        with open(cmdLineOptions.file, 'r') as f:
            for password in f:
                password = password.strip()
                conf.password.append(password)

    # get password type
    conf.type = cmdLineOptions.type

def initConf():
    conf.password = []
    conf.type = None
