def parse_args():
    parser = argparse.ArgumentParser(
        prog='pydictor',
        formatter_class=argparse.RawTextHelpFormatter,
        description=cool.green(
            '*[+] A Useful Hacker Dictionary  Builder. [+]*') +
        pyoptions.CRLF +
        cool.green(' [+] Build by LandGrey    email:[email protected]') +
        pyoptions.CRLF,
        usage=cool.orange('''
pydictor.py [options]
           -base        [type]
           -char        [custom_char]
           -chunk       [chunk1] [chunk2] ...
           -extend      [str_or_file]
           -plug        [{p0},{p1},{p2}]
           --conf       [config_file_path]
           --sedb
           -o,--output  [directory]
           -tool        [{t5},{t0},{t1},{t2},{t3},{t4}] [args] ...
           --len        [minlen] [maxlen]
           --head       [prefix_string]
           --tail       [suffix_string]
           --encode     [{e0},{e1},{e2},{e3},{e4},{e5},{e6},{e7}]
           --occur      [letter] [digital] [special]
           --types      [letter] [digital] [special]
           --regex      [regex]
           --level      [code]
           --leet       [code]'''.format(p0=pystrs.plug_range[0],
                                         p1=pystrs.plug_range[1],
                                         p2=pystrs.plug_range[2],
                                         t0=pystrs.tool_range[0],
                                         t1=pystrs.tool_range[1],
                                         t2=pystrs.tool_range[2],
                                         t3=pystrs.tool_range[3],
                                         t4=pystrs.tool_range[4],
                                         t5=pystrs.tool_range[5],
                                         e0=pystrs.encode_range[0],
                                         e1=pystrs.encode_range[1],
                                         e2=pystrs.encode_range[2],
                                         e3=pystrs.encode_range[3],
                                         e4=pystrs.encode_range[4],
                                         e5=pystrs.encode_range[5],
                                         e6=pystrs.encode_range[6],
                                         e7=pystrs.encode_range[7])))

    parser.add_argument(
        '-base',
        dest='base',
        choices=[
            pystrs.base_dic_type[0], pystrs.base_dic_type[1],
            pystrs.base_dic_type[2], pystrs.base_dic_type[3],
            pystrs.base_dic_type[4], pystrs.base_dic_type[5],
            pystrs.base_dic_type[6]
        ],
        metavar='Type',
        default='',
        help=cool.yellow('''Choose from  ({0}, {1}, {2}, {3}, {4}, {5}, {6})
    {0}     digital             [0 - 9]
    {1}     lowercase letters   [a - z]
    {2}     capital letters     [A - Z]
    {3}    Mix {0} and {1}         [0-9 a-z]
    {4}    Mix {0} and {2}         [0-9 A-Z]
    {5}    Mix {1} and {2}         [a-z A-Z]
    {6}   Mix {0}, {1} and {3}     [0-9 a-z A-Z]'''.format(
            pystrs.base_dic_type[0], pystrs.base_dic_type[1],
            pystrs.base_dic_type[2], pystrs.base_dic_type[3],
            pystrs.base_dic_type[4], pystrs.base_dic_type[5],
            pystrs.base_dic_type[6])))

    parser.add_argument(
        '-char',
        dest='char',
        metavar='character',
        default='',
        help=cool.yellow('Use Custom Character build the dictionary'))

    parser.add_argument(
        '-chunk',
        dest='chunk',
        metavar='arg',
        nargs='+',
        type=str,
        default='',
        help=cool.yellow('Use the multi-chunk build the dictionary'))

    parser.add_argument('-extend',
                        dest='extend',
                        metavar='arg',
                        nargs='+',
                        type=str,
                        default='',
                        help=cool.yellow('Extend the string list or file'))

    parser.add_argument('-plug',
                        dest='plug',
                        metavar='arg',
                        nargs='+',
                        type=str,
                        default='',
                        help=cool.yellow('''Choose from    ({0}, {1}, {2}, {3})
    {0:10} [idcard_last_6_digit]   default sex:{3}
    {1:10} [idcard_last_8_digit]   default sex:{3}
    {2:10} [url_or_file_path]'''.format(pystrs.plug_range[0],
                                        pystrs.plug_range[1],
                                        pystrs.plug_range[2],
                                        pystrs.default_sex)))

    parser.add_argument('--conf',
                        dest='conf',
                        nargs='?',
                        metavar='file_path',
                        default='default',
                        const='const',
                        help=cool.yellow(
                            '''Use the configuration file build the dictionary
    Default: %s''' % paths.buildconf_path))

    parser.add_argument(
        '--sedb',
        dest='sedb',
        default='',
        action="store_true",
        help=cool.yellow('Enter the Social Engineering Dictionary Builder'))

    parser.add_argument('-o',
                        '--output',
                        dest='output',
                        metavar='path',
                        type=str,
                        default=paths.results_path,
                        help=cool.yellow('''Set the output directory path
    default: %s''' % paths.results_path))

    parser.add_argument('-tool',
                        dest='tool',
                        metavar='arg',
                        nargs='+',
                        type=str,
                        default='',
                        help=cool.yellow('''Choose from    ({0}, {1}, {2},
                {3}, {4})
    {0:10} [file_or_dir]
    {1:10} [file_path]
    {2:10} ['{5}','{6}','{7}'] [file_path] [view_num]
    {3:10} [dir]
    {4:10} [dir]'''.format(pystrs.tool_range[0], pystrs.tool_range[1],
                           pystrs.tool_range[2], pystrs.tool_range[3],
                           pystrs.tool_range[4], pystrs.just_view_counter,
                           pystrs.just_save_counter, pystrs.save_and_view)))

    parser.add_argument('--len',
                        dest='len',
                        metavar=('minlen', 'maxlen'),
                        nargs=2,
                        type=int,
                        default=(pyoptions.minlen, pyoptions.maxlen),
                        help=cool.yellow('''Default: min=%s  max=%s''' %
                                         (pyoptions.minlen, pyoptions.maxlen)))

    parser.add_argument('--head',
                        dest='head',
                        metavar='prefix',
                        type=str,
                        default='',
                        help=cool.yellow('Add string head for the items'))

    parser.add_argument('--tail',
                        dest='tail',
                        metavar='suffix',
                        type=str,
                        default='',
                        help=cool.yellow('Add string tail for the items'))

    parser.add_argument(
        '--encode',
        dest='encode',
        metavar='encode',
        default='none',
        choices=[
            pystrs.encode_range[0], pystrs.encode_range[1],
            pystrs.encode_range[2], pystrs.encode_range[3],
            pystrs.encode_range[4], pystrs.encode_range[5],
            pystrs.encode_range[6], pystrs.encode_range[7],
            pystrs.encode_range[8]
        ],
        help=cool.yellow(
            '''From ({e0}, {e1}, {e2}, {e3}, {e4}, {e5}, {e6}, {e7}, {e8})'''.
            format(
                e0=pystrs.encode_range[0],
                e1=pystrs.encode_range[1],
                e2=pystrs.encode_range[2],
                e3=pystrs.encode_range[3],
                e4=pystrs.encode_range[4],
                e5=pystrs.encode_range[5],
                e6=pystrs.encode_range[6],
                e7=pystrs.encode_range[7],
                e8=pystrs.encode_range[8],
            )))

    parser.add_argument(
        '--occur',
        dest='occur',
        metavar=('letter', 'digital', 'special'),
        nargs=3,
        type=str,
        default=(pyoptions.letter_occur, pyoptions.digital_occur,
                 pyoptions.special_occur),
        help=cool.yellow('''Default: letter "%s" digital "%s" special "%s"''' %
                         (pyoptions.letter_occur, pyoptions.digital_occur,
                          pyoptions.special_occur)))

    parser.add_argument(
        '--types',
        dest='types',
        metavar=('letter', 'digital', 'special'),
        nargs=3,
        type=str,
        default=(pyoptions.letter_types, pyoptions.digital_types,
                 pyoptions.special_types),
        help=cool.yellow(
            '''Default: letter "%s"  digital "%s"  special "%s"''' %
            (pyoptions.letter_types, pyoptions.digital_types,
             pyoptions.special_types)))

    parser.add_argument('--regex',
                        dest='regex',
                        metavar='regex',
                        nargs=1,
                        type=str,
                        default=pyoptions.filter_regex,
                        help=cool.yellow('''Filter by regex, Default: (%s)''' %
                                         pyoptions.filter_regex))

    parser.add_argument(
        '--level',
        dest='level',
        metavar='code',
        default=pyoptions.level,
        type=int,
        help=cool.yellow(
            '''Use code [1-5] to filter results, default: {0}'''.format(
                pyoptions.level)))

    parser.add_argument(
        '--leet',
        dest='leet',
        metavar='code',
        nargs='+',
        type=int,
        default=pyoptions.leetmode_code,
        help=cool.yellow('Choose leet mode code (0, 1, 2, 11-19, 21-29)'))

    if len(sys.argv) == 1:
        sys.argv.append('-h')
    args = parser.parse_args()
    check_args(args)
    return args
Пример #2
0
def parse_args():
    parser = argparse.ArgumentParser(prog='pydictor',
                                     formatter_class=argparse.RawTextHelpFormatter,
                                     description=cool.green('*[+] A Useful Hacker Dictionary  Builder. [+]*') +
                                                 pyoptions.CRLF +
                                                 cool.green(' [+] Build by LandGrey    email:[email protected]') +
                                                 pyoptions.CRLF,
                                     usage=cool.orange('''
pydictor.py [options]
           -base        [type]
           -char        [custom_char]
           -chunk       [chunk1] [chunk2] ...
           -extend      [string_or_file]
           -plug        [{plugin}]
           --conf       [expression_or_file]
           --sedb
           -o,--output  [directory]
           -tool        [{tool}]
           --len        [minlen] [maxlen]
           --head       [prefix_string]
           --tail       [suffix_string]
           --encode     [{encode}]
           --occur      [letter] [digital] [special]
           --types      [letter] [digital] [special]
           --regex      [regex]
           --level      [code]
           --leet       [code]'''.format(plugin=",".join(pyoptions.plug_range), encode=",".join(pyoptions.encode_range),
                                         tool=",".join(pyoptions.tool_range))))

    parser.add_argument('-base', dest='base', choices=[pystrs.base_dic_type[0], pystrs.base_dic_type[1],
                                                       pystrs.base_dic_type[2], pystrs.base_dic_type[3],
                                                       pystrs.base_dic_type[4], pystrs.base_dic_type[5],
                                                       pystrs.base_dic_type[6]], metavar='Type',
                        default='', help=cool.yellow('''Choose from  ({0}, {1}, {2}, {3}, {4}, {5}, {6})
    {0}     digital             [0 - 9]
    {1}     lowercase letters   [a - z]
    {2}     capital letters     [A - Z]
    {3}    Mix {0} and {1}         [0-9 a-z]
    {4}    Mix {0} and {2}         [0-9 A-Z]
    {5}    Mix {1} and {2}         [a-z A-Z]
    {6}   Mix {0}, {1} and {3}     [0-9 a-z A-Z]'''.format(pystrs.base_dic_type[0], pystrs.base_dic_type[1],
                                                           pystrs.base_dic_type[2], pystrs.base_dic_type[3],
                                                           pystrs.base_dic_type[4], pystrs.base_dic_type[5],
                                                           pystrs.base_dic_type[6])))

    parser.add_argument('-char', dest='char', metavar='character', default='',
                        help=cool.yellow('Use Custom Character build the dictionary'))

    parser.add_argument('-chunk', dest='chunk', metavar='arg', nargs='+', type=str, default='',
                        help=cool.yellow('Use the multi-chunk build the dictionary'))

    parser.add_argument('-extend', dest='extend', metavar='arg', nargs='+', type=str, default='',
                        help=cool.yellow('Extend the string list or file'))

    parser.add_argument('-plug', dest='plug', metavar='arg', nargs='+', type=str, default='',
                        help=cool.yellow('''{plugins_desc}'''.format(plugins_desc=pyoptions.plugins_desc)))

    parser.add_argument('--conf', dest='conf', nargs='?', metavar='file_path', default='default', const='const',
                        help=cool.yellow("Use the configuration string or file build the dictionary"))

    parser.add_argument('--sedb', dest='sedb', default='',  action="store_true",
                        help=cool.yellow('Enter the Social Engineering Dictionary Builder'))

    parser.add_argument('-o', '--output', dest='output', metavar='path', type=str, default=paths.results_path,
                        help=cool.yellow('''Set the output directory path
    default: %s''' % paths.results_path))

    parser.add_argument('-tool', dest='tool', metavar='arg', nargs='+', type=str, default='',
                        help=cool.yellow('''{tools_desc}'''.format(tools_desc=pyoptions.tools_desc)))

    parser.add_argument('--len', dest='len', metavar=('minlen', 'maxlen'), nargs=2, type=int,
                        default=(pyoptions.minlen, pyoptions.maxlen),
                        help=cool.yellow('''Default: min=%s  max=%s''' % (pyoptions.minlen, pyoptions.maxlen)))

    parser.add_argument('--head', dest='head', metavar='prefix', type=str, default='',
                        help=cool.yellow('Add string head for the items'))

    parser.add_argument('--tail', dest='tail', metavar='suffix', type=str, default='',
                        help=cool.yellow('Add string tail for the items'))

    parser.add_argument('--encode', dest='encode', metavar='encode', default='none',
                        choices=pyoptions.encode_range,
                        help=cool.yellow('''{encode_desc}'''.format(encode_desc=pyoptions.encode_desc)))

    parser.add_argument('--occur', dest='occur', metavar=('letter', 'digital', 'special'), nargs=3, type=str,
                        default=(pyoptions.letter_occur, pyoptions.digital_occur, pyoptions.special_occur),
                        help=cool.yellow('''Default: letter "%s" digital "%s" special "%s"''' %
                                         (pyoptions.letter_occur, pyoptions.digital_occur, pyoptions.special_occur)))

    parser.add_argument('--types', dest='types', metavar=('letter', 'digital', 'special'), nargs=3, type=str,
                        default=(pyoptions.letter_types, pyoptions.digital_types, pyoptions.special_types),
                        help=cool.yellow('''Default: letter "%s"  digital "%s"  special "%s"''' %
                                         (pyoptions.letter_types, pyoptions.digital_types, pyoptions.special_types)))

    parser.add_argument('--regex', dest='regex', metavar='regex', nargs=1, type=str,
                        default=pyoptions.filter_regex, help=cool.yellow('''Filter by regex, Default: (%s)''' %
                                                                         pyoptions.filter_regex))

    parser.add_argument('--level', dest='level', metavar='code', default=pyoptions.level, type=int,
                        help=cool.yellow('''Use code [1-5] to filter results, default: {0}'''.format(pyoptions.level)))

    parser.add_argument('--leet', dest='leet', metavar='code', nargs='+', type=int, default=pyoptions.leetmode_code,
                        help=cool.yellow('Choose leet mode code (0, 1, 2, 11-19, 21-29)'))

    if len(sys.argv) == 1:
        sys.argv.append('-h')
    args = parser.parse_args()
    check_args(args)
    return args
Пример #3
0
                                            {1}
    ----------------------------[ {2} ]---------------------------
    [+]help desc             [+]exit/quit            [+]clear/cls
    [+]show option           [+]set option arguments [+]rm option
    [+]len minlen maxlen     [+]head prefix          [+]tail suffix
    [+]encode type           [+]occur L d s          [+]types L d s
    [+]regex string          [+]level code           [+]leet code
    [+]output directory      [+]run

    ----------------------------[ {3} ]----------------------------
    [+]{4}                 [+]{5}                [+]{6}
    [+]{7}                 [+]{8}              [+]{9}
    [+]{10}                [+]{11}               [+]{12}
    [+]{13}              [+]{14}             [+]{15}
    [+]{16}                [+]{17}            [+]{18}
'''.format(cool.orange("Social Engineering Dictionary Builder"), cool.green("Build by LandGrey"), cool.yellow("command")
           , cool.yellow("option"), pystrs.sedb_range[0], pystrs.sedb_range[1], pystrs.sedb_range[2],
           pystrs.sedb_range[3], pystrs.sedb_range[4], pystrs.sedb_range[5], pystrs.sedb_range[6],
           pystrs.sedb_range[7], pystrs.sedb_range[8], pystrs.sedb_range[9], pystrs.sedb_range[10],
           pystrs.sedb_range[11], pystrs.sedb_range[12], pystrs.sedb_range[13], pystrs.sedb_range[14], )


help_dict = OrderedDict([
    # settings help message
    (pystrs.sedb_range[0], " {:10}     Chinese name's phonetic        中文名拼音全拼".format(pystrs.sedb_range[0])),
    (pystrs.sedb_range[1], " {:10}     English name                   英文名".format(pystrs.sedb_range[1])),
    (pystrs.sedb_range[2], " {:10}     Simple name spellings          姓名简拼".format(pystrs.sedb_range[2])),
    (pystrs.sedb_range[3], " {:10}     Birthday [yyyyMMdd]            生日".format(pystrs.sedb_range[3])),
    (pystrs.sedb_range[4], " {:10}     Used password                  曾用密码".format(pystrs.sedb_range[4])),
    (pystrs.sedb_range[5], " {:10}     Cell phone number              手机号".format(pystrs.sedb_range[5])),
    (pystrs.sedb_range[6], " {:10}     Previous phone number          曾用手机号".format(pystrs.sedb_range[6])),
Пример #4
0
    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))


if __name__ == '__main__':
    print("{}".format(cool.green(pydictor_art_text)))
    init()
    if pyoptions.args_base:
        get_base_dic(pyoptions.args_base)
    elif pyoptions.args_char:
        get_char_dic(pyoptions.args_char)
    elif pyoptions.args_chunk:
        get_chunk_dic(pyoptions.args_chunk)
    elif pyoptions.args_extend:
        get_extend_dic(pyoptions.args_extend)
    elif pyoptions.args_plug:
        plug_parser()
    elif pyoptions.args_sedb:
        try:
            sedb_tricks()
            shell = SEDB()
 def __init__(self):
     cmd.Cmd.__init__(self)
     self.do_cls('')
     self.prompt = cool.green("pydictor SEDB>>")
     self.do_help('')