示例#1
0
def init():
    args = parse_args()
    pyoptions.leetmode_code = args.leet

    if not (args.len[0] == pyoptions.minlen
            and args.len[1] == pyoptions.maxlen):
        pyoptions.args_pick = True
    if pyoptions.leetmode_code:
        pyoptions.extend_leet = True
        pyoptions.passcraper_leet = True
        pyoptions.sedb_leet = True
    paths.results_path = os.path.abspath(args.output) \
        if '\\' in args.output or '/' in args.output else os.path.join(paths.results_path, args.output)

    pyoptions.head = args.head
    pyoptions.tail = args.tail
    pyoptions.encode = args.encode
    pyoptions.minlen = args.len[0]
    pyoptions.maxlen = args.len[1]
    pyoptions.letter_occur = args.occur[0]
    pyoptions.digital_occur = args.occur[1]
    pyoptions.special_occur = args.occur[2]
    pyoptions.letter_types = args.types[0]
    pyoptions.digital_types = args.types[1]
    pyoptions.special_types = args.types[2]
    pyoptions.filter_regex = args.regex

    pyoptions.args_base = args.base
    pyoptions.args_char = args.char
    pyoptions.args_chunk = args.chunk
    pyoptions.args_extend = args.extend
    pyoptions.args_plug = args.plug
    pyoptions.args_sedb = args.sedb
    pyoptions.args_conf = args.conf
    pyoptions.args_tool = args.tool
    pyoptions.level = args.level

    try:
        if os.path.isfile(paths.results_path):
            tmp_dirpath, tmp_filename = os.path.split(paths.results_path)
            if not os.path.isdir(tmp_dirpath):
                os.makedirs(tmp_dirpath)
            paths.results_path = tmp_dirpath
            paths.results_file_name = ''.join(random.sample(
                'pydictor', 4)) + '_' + tmp_filename
        elif not os.path.isdir(paths.results_path):
            tmp_dirpath, tmp_filename = os.path.split(paths.results_path)
            if '.' in tmp_filename:
                if not os.path.isdir(tmp_dirpath):
                    os.makedirs(tmp_dirpath)
                paths.results_path = tmp_dirpath
                paths.results_file_name = tmp_filename
            else:
                if not os.path.isdir(paths.results_path):
                    os.makedirs(paths.results_path)
    except WindowsError:
        exit(pyoptions.CRLF + cool.red("[-] Cannot create result file: %s " %
                                       paths.results_path))
示例#2
0
def init():
    args = parse_args()
    pyoptions.leetmode_code = args.leet

    if not (args.len[0] == pyoptions.minlen
            and args.len[1] == pyoptions.maxlen):
        pyoptions.args_pick = True
    if pyoptions.leetmode_code:
        pyoptions.extend_leet = True
        pyoptions.passcraper_leet = True
        pyoptions.sedb_leet = True

    paths.results_path = os.path.abspath(args.output)

    pyoptions.head = args.head
    pyoptions.tail = args.tail
    pyoptions.encode = args.encode
    pyoptions.minlen = args.len[0]
    pyoptions.maxlen = args.len[1]

    pyoptions.args_base = args.base
    pyoptions.args_char = args.char
    pyoptions.args_chunk = args.chunk
    pyoptions.args_extend = args.extend
    pyoptions.args_plug = args.plug
    pyoptions.args_sedb = args.sedb
    pyoptions.args_conf = args.conf
    pyoptions.args_tool = args.tool
    pyoptions.level = args.level

    try:
        if not os.path.exists(paths.results_path):
            os.mkdir(paths.results_path)
    except IOError:
        exit(pyoptions.CRLF + cool.red("[-] Cannot create output path: %s " %
                                       paths.results_path))