可以使用以下正则表达式来匹配硬编码密钥:

import re

regex = r"(?<![a-zA-Z0-9_])([a-zA-Z0-9_]{32})(?![a-zA-Z0-9_])"

str = "This is a hard-coded key: 1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6"

matches = re.findall(regex, str)

for match in matches:
    print("Match found: {}".format(match))

这个正则表达式将匹配32个字符长度的字母、数字或下划线序列,前后不能是字母、数字或下划线,表示硬编码密钥。

python中匹配硬编码密钥的正则

原文地址: https://www.cveoy.top/t/topic/ffmN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录