当前位置: 首页>>代码示例>>Python>>正文


Python exrex.generate方法代码示例

本文整理汇总了Python中exrex.generate方法的典型用法代码示例。如果您正苦于以下问题:Python exrex.generate方法的具体用法?Python exrex.generate怎么用?Python exrex.generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在exrex的用法示例。


在下文中一共展示了exrex.generate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gen_fuzz_subdomains

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def gen_fuzz_subdomains(expression, rule):
    """
    Generate subdomains based on fuzz mode

    :param  str  expression: generate subdomains's expression
    :param  str  rule: regexp rule
    :return list subdomains: list of subdomains
    """
    subdomains = list()
    fuzz_count = exrex.count(rule)
    if fuzz_count > 10000000:
        logger.log('ALERT', f'The dictionary generated by this rule is too large:{fuzz_count} > 10000000')
    logger.log('DEBUG', f'Dictionary size based on fuzz mode: {fuzz_count}')
    for fuzz_string in exrex.generate(rule):
        fuzz_string = fuzz_string.lower()
        if not fuzz_string.isalnum():
            continue
        fuzz_domain = expression.replace('*', fuzz_string)
        subdomains.append(fuzz_domain)
    random_domain = random.choice(subdomains)
    logger.log('ALERT', f'Please check whether {random_domain} is correct or not')
    return subdomains 
开发者ID:shmilylty,项目名称:OneForAll,代码行数:24,代码来源:brute.py

示例2: gen_word_subdomains

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def gen_word_subdomains(expression, path):
    """
    Generate subdomains based on word mode

    :param  str  expression: generate subdomains's expression
    :param  str  path: path of wordlist
    :return list subdomains: list of subdomains
    """
    subdomains = list()
    with open(path, encoding='utf-8', errors='ignore') as fd:
        for line in fd:
            word = line.strip().lower()
            if len(word) == 0:
                continue
            if not utils.is_subname(word):
                continue
            if word.startswith('.'):
                word = word[1:]
            if word.endswith('.'):
                word = word[:-1]
            subdomain = expression.replace('*', word)
            subdomains.append(subdomain)
    random_domain = random.choice(subdomains)
    logger.log('DEBUG', f'Dictionary based on word mode size: {len(subdomains)}')
    logger.log('ALERT', f'Please check whether {random_domain} is correct or not')
    return subdomains 
开发者ID:shmilylty,项目名称:OneForAll,代码行数:28,代码来源:brute.py

示例3: regex_to_str

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def regex_to_str(self, all_combo: bool = False):
        """Convert a regex to a matching string
        
        Args:
            all_combo (bool, optional): Generate all combos that match regex. Defaults to False.
        
        Returns:
            Chepy: The Chepy object. 
        """
        if all_combo:
            self.state = list(exrex.generate(self._convert_to_str()))
        else:
            self.state = exrex.getone(self._convert_to_str())
        return self 
开发者ID:securisec,项目名称:chepy,代码行数:16,代码来源:utils.py

示例4: get_list_of_values

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def get_list_of_values(self, num_values):
        """Returns a list of num_values strings matching regex; note that strings that match in
        multiple ways may be repeated (e.g. regex 'a|a|a' would yield 'a' as a match three times)"""
        regex_gen = exrex.generate(self.options['regex'])
        try:
            return [next(regex_gen) for _ in range(num_values)]
        except StopIteration:
            raise ValueError('Fewer than {} regex matches could be generated'.format(num_values)) 
开发者ID:twosixlabs,项目名称:acsploit,代码行数:10,代码来源:regex.py

示例5: get_max_value

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def get_max_value(self):
        raise NotImplementedError('Regex input generator cannot generate maximum values') 
开发者ID:twosixlabs,项目名称:acsploit,代码行数:4,代码来源:regex.py

示例6: get_min_value

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def get_min_value(self):
        raise NotImplementedError('Regex input generator cannot generate minimum values') 
开发者ID:twosixlabs,项目名称:acsploit,代码行数:4,代码来源:regex.py

示例7: get_greater_than

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def get_greater_than(self, value):
        raise NotImplementedError('Regex input generator cannot generate relative values') 
开发者ID:twosixlabs,项目名称:acsploit,代码行数:4,代码来源:regex.py

示例8: get_less_than

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def get_less_than(self, value):
        raise NotImplementedError('Regex input generator cannot generate relative values') 
开发者ID:twosixlabs,项目名称:acsploit,代码行数:4,代码来源:regex.py

示例9: regex_parser

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def regex_parser(regex):
    try:
        string_list = list(exrex.generate(regex))
        return string_list
    except:
        print "Incorrect regex syntax"
        sys.exit(1) 
开发者ID:utkusen,项目名称:rhodiola,代码行数:9,代码来源:rhodiola.py

示例10: __iter__

# 需要导入模块: import exrex [as 别名]
# 或者: from exrex import generate [as 别名]
def __iter__(self):
            for string in generate(self.regex, self.limit):
                value = bytes(string, encoding=CONFIG["GLOBALS"]["CODEC"])
                yield Value(value, len(value) * 8) 
开发者ID:ernw,项目名称:dizzy,代码行数:6,代码来源:regex.py


注:本文中的exrex.generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。