示例#1
0
文件: option.py 项目: zzhacked/Sepia
def TargetRegister(args):
    input_path = args.script_name
    input_file = args.target_file
    input_single = args.target_urlip
    input_cidr = args.target_cidr
    api_zoomeye = args.zoomeye_dork
    api_baidu = args.baidu_dork

    if not input_path:
        msg = 'Please specify a script with [-s]'
        sys.exit(logger.error(msg))

    def __file():  #配置批量扫描文件路径
        if not os.path.isfile(input_file):
            msg = 'TargetFile not found: %s' % input_file
            sys.exit(logger.error(msg))
        conf.TARGET_MODE = TARGET_MODE_STATUS.FILE  #conf.TAGET_MODE=9 -iF模式
        conf.INPUT_FILE_PATH = input_file

    def __cidr():
        conf.TARGET_MODE = TARGET_MODE_STATUS.IPMASK  #conf.TARGET_MODE=7 -iN模式
        conf.NETWORK_STR = input_cidr
        conf.INPUT_FILE_PATH = None

    def __single():
        conf.TARGET_MODE = TARGET_MODE_STATUS.SINGLE  #conf.TARGET_MODE=8 -iS模式
        conf.SINGLE_TARGET_STR = input_single
        th.THREADS_NUM = conf.THREADS_NUM = 1
        conf.INPUT_FILE_PATH = None

    def __zoomeye():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API  #conf.TARGET_MODE=5 API模式
        conf.API_MODE = API_MODE_NAME.ZOOMEYE  #使用Zoomeye
        conf.API_DORK = api_zoomeye

    def __baidu():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API  #conf.TARGET_MODE=5 API模式
        conf.API_MODE = API_MODE_NAME.BAIDU  #使用Baidu
        conf.API_DORK = api_baidu

    msg = 'Please load targets with [-t|-f|-c] or use API with [-zoomeye|-baidu]'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__file, input_file)
    r.add(__cidr, input_cidr)
    r.add(__single, input_single)
    r.add(__zoomeye, api_zoomeye)
    r.add(__baidu, api_baidu)
    r.run()
示例#2
0
文件: option.py 项目: 0x24bin/POC-T
def _initEngine(args):
    def __thread():
        conf.ENGINE = ENGINE_MODE_STATUS.THREAD

    def __gevent():
        conf.ENGINE = ENGINE_MODE_STATUS.GEVENT

    msg = 'Use -T to set Multi-Threaded mode or -C to set Coroutine mode.'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__thread, args.T)
    r.add(__gevent, args.C)
    r.run()

    if args.t > 0 and args.t < 101:
        th.THREADS_NUM = conf.THREADS_NUM = args.t
    else:
        msg = 'Invalid input in [-t], range: 1 to 100'
        sys.exit(logger.log(CUSTOM_LOGGING.ERROR, msg))
示例#3
0
def EngineRegister(args):
    thread_status = args.engine_thread
    gevent_status = args.engine_gevent
    thread_num = args.thread_num

    def __thread():
        conf.ENGINE = ENGINE_MODE_STATUS.THREAD

    def __gevent():
        conf.ENGINE = ENGINE_MODE_STATUS.GEVENT

    conf.ENGINE = ENGINE_MODE_STATUS.THREAD  # default choice
    conf.batchfuzz = False

    msg = 'Use [-eT] to set Multi-Threaded mode or [-eG] to set Coroutine mode.'
    r = Register(mutex=True, start=0, stop=1, mutex_errmsg=msg)
    r.add(__thread, thread_status)
    r.add(__gevent, gevent_status)
    r.run()

    if 0 < thread_num < 501:
        th.THREADS_NUM = conf.THREADS_NUM = thread_num
    else:
        msg = 'Invalid input in [-t], range: 1 to 500'
        sys.exit(logger.error(msg))
示例#4
0
def _initEngine(args):
    def __thread():
        conf.ENGINE = ENGINE_MODE_STATUS.THREAD

    def __gevent():
        conf.ENGINE = ENGINE_MODE_STATUS.GEVENT

    msg = 'Use -T to set Multi-Threaded mode or -C to set Coroutine mode.'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__thread, args.T)
    r.add(__gevent, args.C)
    r.run()

    if 0 < args.t < 101:
        th.THREADS_NUM = conf.THREADS_NUM = args.t
    else:
        msg = 'Invalid input in [-t], range: 1 to 100'
        sys.exit(logger.log(CUSTOM_LOGGING.ERROR, msg))
示例#5
0
def EngineRegister(args):
    thread_status = args.engine_thread
    gevent_status = args.engine_gevent
    thread_num = args.thread_num

    def __thread():
        conf.ENGINE = ENGINE_MODE_STATUS.THREAD  #Thread=9

    def __gevent():
        conf.ENGINE = ENGINE_MODE_STATUS.GEVENT  #Gevent=8

    conf.ENGINE = ENGINE_MODE_STATUS.THREAD  # default choice Thread=9

    msg = 'Use [--threads] to set Multi-Threaded mode or [--gevent] to set Coroutine mode.'
    r = Register(mutex=True, start=0, stop=1, mutex_errmsg=msg)
    r.add(__thread, thread_status)
    r.add(__gevent, gevent_status)
    r.run()

    if 0 < thread_num < 101:
        th.THREADS_NUM = conf.THREADS_NUM = thread_num
    else:
        msg = 'Invalid input in [--number], range: 1 to 100'
        sys.exit(logger.error(msg))
示例#6
0
        conf.TARGET_MODE = TARGET_MODE_STATUS.IPMASK
        conf.NETWORK_STR = args.n
        conf.INPUT_FILE_PATH = None

    def __single():
        conf.TARGET_MODE = TARGET_MODE_STATUS.SINGLE
        conf.SINGLE_TARGET_STR = args.s
        th.THREADS_NUM = conf.THREADS_NUM = 1
        conf.INPUT_FILE_PATH = None

    def __api():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API
        _checkAPI(args)

    msg = 'To load targets, please choose one from [-s|-i|-f|-n|--api].'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__file, args.f)
    r.add(__api, args.api)
    r.add(__ipmask, args.n)
    r.add(__range, args.i)
    r.add(__single, args.s)
    r.run()


def _initOutput(args):
    if not args.nF and args.o:
        msg = 'You cannot use [--nF] and [-o] together, please read the usage with [-h].'
        sys.exit(logger.log(CUSTOM_LOGGING.ERROR, msg))

    if not args.nF and args.browser:
        msg = '[--browser] is based on file output, please remove [--nF] in your command and try again.'
def TargetRegister(args):
    input_file = args.target_file
    input_single = args.target_single
    input_network = args.target_network
    input_array = args.target_array
    api_zoomeye = args.zoomeye_dork
    api_shodan = args.shodan_dork
    api_google = args.google_dork

    def __file():
        if not os.path.isfile(input_file):
            msg = 'TargetFile not found: %s' % input_file
            sys.exit(logger.error(msg))
        conf.TARGET_MODE = TARGET_MODE_STATUS.FILE
        conf.INPUT_FILE_PATH = input_file

    def __array():
        help_str = "Invalid input in [-iA], Example: -iA 1-100"
        try:
            _int = input_array.strip().split('-')
            if int(_int[0]) < int(_int[1]):
                if int(_int[1]) - int(_int[0]) > 1000000:
                    warnMsg = "Loading %d targets, Maybe it's too much, continue? [y/N]" % (
                        int(_int[1]) - int(_int[0]))
                    logger.warning(warnMsg)
                    a = raw_input()
                    if a in ('Y', 'y', 'yes'):
                        pass
                    else:
                        msg = 'User quit!'
                        sys.exit(logger.error(msg))
            else:
                sys.exit(logger.error(help_str))
        except Exception:
            sys.exit(logger.error(help_str))
        conf.TARGET_MODE = TARGET_MODE_STATUS.RANGE
        conf.I_NUM2 = input_array
        conf.INPUT_FILE_PATH = None

    def __network():
        conf.TARGET_MODE = TARGET_MODE_STATUS.IPMASK
        conf.NETWORK_STR = input_network
        conf.INPUT_FILE_PATH = None

    def __single():
        conf.TARGET_MODE = TARGET_MODE_STATUS.SINGLE
        conf.SINGLE_TARGET_STR = input_single
        th.THREADS_NUM = conf.THREADS_NUM = 1
        conf.INPUT_FILE_PATH = None

    def __zoomeye():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API
        conf.API_MODE = API_MODE_NAME.ZOOMEYE
        conf.API_DORK = api_zoomeye

    def __shodan():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API
        conf.API_MODE = API_MODE_NAME.SHODAN
        conf.API_DORK = api_shodan

    def __google():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API
        conf.API_MODE = API_MODE_NAME.GOOGLE
        conf.API_DORK = api_google

    msg = 'Please load targets with [-iS|-iA|-iF|-iN] or use API with [-aZ|-aS|-aG]'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__file, input_file)
    r.add(__network, input_network)
    r.add(__array, input_array)
    r.add(__single, input_single)
    r.add(__zoomeye, api_zoomeye)
    r.add(__shodan, api_shodan)
    r.add(__google, api_google)
    r.run()
示例#8
0
文件: option.py 项目: 0x24bin/POC-T
        conf.TARGET_MODE = TARGET_MODE_STATUS.IPMASK
        conf.NETWORK_STR = args.n
        conf.INPUT_FILE_PATH = None

    def __single():
        conf.TARGET_MODE = TARGET_MODE_STATUS.SINGLE
        conf.SINGLE_TARGET_STR = args.s
        th.THREADS_NUM = conf.THREADS_NUM = 1
        conf.INPUT_FILE_PATH = None

    def __api():
        conf.TARGET_MODE = TARGET_MODE_STATUS.API
        _checkAPI(args)

    msg = 'To load targets, please choose one from [-s|-i|-f|-n|--api].'
    r = Register(mutex=True, mutex_errmsg=msg)
    r.add(__file, args.f)
    r.add(__api, args.api)
    r.add(__ipmask, args.n)
    r.add(__range, args.i)
    r.add(__single, args.s)
    r.run()


def _initOutput(args):
    if not args.nF and args.o:
        msg = 'You cannot use [--nF] and [-o] together, please read the usage with [-h].'
        sys.exit(logger.log(CUSTOM_LOGGING.ERROR, msg))

    if not args.nF and args.browser:
        msg = '[--browser] is based on file output, please remove [--nF] in your command and try again.'