예제 #1
0
    def run(self):
        while True:
            target = self._queue.get()
            # for python 3 'unicode', and python 2 'str'
            if not py_ver_egt_3() and isinstance(target, unicode) and target == "quit":
                break
            elif isinstance(target, str) and target == "quit":
                break

            try:
                if get_global_parse_flag():
                    ip = socket.gethostbyname(target)
                    targets_pool.append(ip)
                    set_count(set_parsed_ip_count=True)
                    sys.stdout.write(cool.white("\r[+] Parsing {0:16} -> {1}".format(target, ip)))
                    sys.stdout.flush()
                else:
                    single_target_file = os.path.join(output_path, target + '.txt')
                    with open(single_target_file, 'a') as f:
                        command = subprocess.Popen('{0}{1} {2}'.format(scan_command, get_port_string(),
                                                                       target), shell=True, stdout=f)
                        c = command.communicate()
                        set_count(set_scan_items_count=True)
                        sys.stdout.write(cool.green("\r[+] Scan {0:15}, {1} items completed".format
                                         (target, get_count(get_scan_items_count=True))))
                        sys.stdout.flush()
            except KeyboardInterrupt:
                exit(cool.green("\n[*] User quit !"))
            except:
                pass
예제 #2
0
def init(target_choice, port_choice, extend_choice,  rmself):
    print(cool.green("[+] Init ..."))
    print(cool.white("[+] Threads: {0}".format(str(get_threads()))))
    check_cmd_status()
    init_target(target_choice)
    init_port(port_choice)
    auto_choose_start()
    init_extend(extend_choice, rmself=rmself)
    print(cool.orange("[+] Load: {0} targets".format(len(unique(targets_pool)))))
    if len(unique(targets_pool)) > 0:
        create_output_file()
    print(cool.green("[+] Init sucess\n"))
예제 #3
0
 def __init__(self):
     cmd.Cmd.__init__(self)
     # reload(sys)
     # sys.setdefaultencoding('utf-8')
     self.do_cls('')
     self.prompt = cool.green("pydictor SEDB>>")
     self.do_help('')
예제 #4
0
 def do_help(self, key):
     if key in help_dict:
         print(cool.orange(help_dict[key]))
     elif key == 'desc':
         for k in help_dict.keys():
             print(cool.orange(help_dict[k]))
     else:
         self.do_cls('')
         print(cool.green(pydictor_art_text))
         print(helpmsg)
예제 #5
0
from core.CONF import build_conf_dic
from core.SEDB import SEDB
from tools.shredder import shredder_enter
from tools.uniqifer import uniqifer_enter
from tools.counter import counter_enter
from tools.combiner import combiner_enter
from tools.uniqbiner import uniqbiner_enter
from plugins.idcard import get_idcard_post
from plugins.extend import get_extend_dic
from plugins.passcraper import get_passcratch_dic
from lib.text import pydictor_ascii_text as pydictor_art_text
from lib.data import set_result_store_path, get_result_store_path, set_conf_path, get_conf_path, tool_range, plug_range,\
    CRLF, scrabble_site_path, startime

if __name__ == '__main__':
    print("{}".format(cool.green(pydictor_art_text)))
    args = parse_args()
    try:
        if not os.path.exists(get_result_store_path()):
            os.mkdir(get_result_store_path())
    except IOError:
        exit(CRLF +
             cool.red("[-] Cannot create %s " % get_result_store_path()))
    if args.output:
        if os.path.exists(args.output):
            tmppath = os.path.abspath(args.output)
        else:
            try:
                os.mkdir(args.output)
                tmppath = os.path.abspath(args.output)
            except IOError:
예제 #6
0
    ----------------------------------[ {2} ]------------------------------------
    [+]help desc     (View the description) |  [+]show name     (Show current settings)
    [+]cls/clear     (Clean the screen)     |  [+]quit/exit     (Quit the progress)
    [+]run           (Build the dictionary) |
                                            |
    Usage Exp :show  (Show all of settings) |  help desc   (view all of descriptions)

    -------------------------------[ {3} ]--------------------------------
    [+]{4}      [+]{5}      [+]{6}    |  [+]{7}      [+]{8}    [+]{9}
    [+]{10}     [+]{11}     [+]{12}    |  [+]{13}   [+]{14}   [+]{15}
    [+]{16}     [+]{17}  [+]{18} |
                                            |
    Usage Exp :sname zhang wei zw zwell     |  * Each setting supports multiple values
'''.format(
    cool.orange("Social Engineering Dictionary Builder"),
    cool.green("Build by LandGrey"),
    cool.yellow("command"),
    cool.yellow("setting options"),
    sedb_range[0],
    sedb_range[1],
    sedb_range[2],
    sedb_range[3],
    sedb_range[4],
    sedb_range[5],
    sedb_range[6],
    sedb_range[7],
    sedb_range[8],
    sedb_range[9],
    sedb_range[10],
    sedb_range[11],
    sedb_range[12],
예제 #7
0
License: GNU GENERAL PUBLIC LICENSE Version 3
"""

from __future__ import unicode_literals
import os
import time
from lib.config import set_threads, output_path, result_file_path
from lib.cli import parse_args
from lib.handler import result_handler, select_by_port, select_by_service
from lib.process import init, start
from lib.text import shakala_art_text
from lib.fun import cool

if __name__ == "__main__":
    start_time = time.time()
    print("{}".format(cool.green(shakala_art_text)))
    arg = parse_args()

    if str(arg.threads).isdigit() and int(arg.threads) >= 1:
        set_threads(int(arg.threads))

    if arg.analyse != '':
        if os.path.exists(arg.analyse):
            result_handler(arg.analyse, result_file_path)
            if os.path.getsize(result_file_path) > 0:
                print(
                    cool.orange(
                        "\n[+] Store in: {0}".format(result_file_path)))
            else:
                try:
                    os.remove(result_file_path)
예제 #8
0
파일: text.py 프로젝트: cys3c/pydictor
                                                                {1}
    ----------------------------------[ {2} ]------------------------------------
    [+]help desc     (View the description) |  [+]show setting  (Show current settings)
    [+]cls/clear     (Clean the screen)     |  [+]quit/exit     (Quit the progress)
    [+]run           (Build the dictionary) |
                                            |
    Usage Exp :show  (Show all of settings) |  help desc   (view all of descriptions)

    -------------------------------[ {3} ]--------------------------------
    [+]cname      [+]ename      [+]sname    |  [+]birth      [+]usedpwd    [+]phone
    [+]uphone     [+]hphone     [+]email    |  [+]postcode   [+]nickname   [+]idcard
    [+]jobnum     [+]otherdate  [+]usedchar |
                                            |
    Usage Exp :sname zhang wei zw zwell     |  * Each setting supports multiple values
'''.format(cool.orange("Social Engineering Dictionary Builder"),
           cool.green("Build by LandGrey"), cool.yellow("command"),
           cool.yellow("setting options"))

settings_dict = OrderedDict([('cname', []), ('ename', []), ('sname', []),
                             ('birth', []), ('usedpwd', []), ('phone', []),
                             ('uphone', []), ('hphone', []), ('email', []),
                             ('postcode', []), ('nickname', []),
                             ('idcard', []), ('jobnum', []), ('otherdate', []),
                             ('usedchar', [])])

help_dict = OrderedDict([
    # settings help message
    ('cname', "cname      Chinese name's phonetic          中文名拼音全拼"),
    ('ename', "ename      English name                     英文名"),
    ('sname', "sname      Simple spellings phonetic        姓名简拼"),
    ('birth', "birth      Birthday [YYYYMMDD]              生日"),
예제 #9
0
파일: cli.py 프로젝트: tuian/shakala
def parse_args():
    parser = argparse.ArgumentParser(
        prog='shakala',
        formatter_class=argparse.RawTextHelpFormatter,
        description=cool.green(
            '*[+] A tiny batch multi-ports scanner base on nmap. [+]*\n') +
        cool.green(' [+] Build by LandGrey    email:[email protected]\n'),
        usage=cool.orange('''
shakala.py [options]
         -t         target
         -p         port
         -e         extend
         -a         dir
         -s         file port |  service
         --rmself   will remove itself
         --threads  threads'''.format(cli_all_port, cli_no_extend,
                                      cli_net_extend)))

    parser.add_argument('-t',
                        dest='target',
                        metavar='target',
                        type=str,
                        default="",
                        help=cool.yellow('''
specify  www.example.com,192.168.1.11,192.168.1-10.1-10
dir      use all files in specify directory
path     use single file'''))

    parser.add_argument('-p',
                        dest='port',
                        metavar='port',
                        type=str,
                        default=port_list_file_path,
                        help=cool.yellow('''
specify  80-89,888,8080-8088
{0:8} use all ports: 0-65535
path     (default): {1}'''.format(cli_all_port, port_list_file_path)))

    parser.add_argument('-e',
                        dest='extend',
                        metavar='mode',
                        type=str,
                        default=cli_no_extend,
                        help=cool.yellow('''
numbers  increase or decrease numbers target in /24 range
{0:8} extend whole network address: /24
{1:8} (default)'''.format(cli_net_extend, cli_no_extend)))

    parser.add_argument('-a',
                        dest='analyse',
                        metavar='dir',
                        type=str,
                        default='',
                        help=cool.yellow('''
dir      analyse the result use directory'''))

    # original_path, service
    parser.add_argument('-s',
                        dest='select',
                        metavar='select',
                        type=str,
                        nargs=2,
                        default=('', ''),
                        help=cool.yellow('''
file_path port_or_service
         file must be shakala 'result_' prefix file'''))

    parser.add_argument('--rmself',
                        dest='rmself',
                        action="store_true",
                        default='default',
                        help=cool.yellow('''
provide for '-e extend' '''))

    parser.add_argument('--threads',
                        dest='threads',
                        metavar='threads',
                        type=str,
                        default=get_threads(),
                        help=cool.yellow('''
threads  default:{0}'''.format(get_threads())))

    if len(sys.argv) == 1:
        sys.argv.append('-h')
    args = parser.parse_args()
    return args
예제 #10
0
 def __init__(self):
     cmd.Cmd.__init__(self)
     self.do_cls('')
     self.prompt = cool.green("pydictor SEDB>>")
     self.do_help('')