用python的re匹配一下数据的时间戳fawfefadsfasefe iffaefasdfeaf;decrypt1690887435;fesfsdfafelsefeafsdfafefafaef
以下是使用Python的re模块匹配时间戳的示例代码:
import re
data = """
fawfefadsfasefe
if(){faefasdfeaf;
decrypt('1690887435');fesfsdfaf}
else{feafsdfafefafaef}
"""
pattern = r"decrypt\('(\d+)'\)"
matches = re.findall(pattern, data)
if matches:
for match in matches:
timestamp = int(match)
print(timestamp)
else:
print("No timestamp found.")
以上代码将输出:
1690887435
代码解释:
- 使用正则表达式模式
decrypt\('(\d+)')匹配以decrypt('开头,'结尾的数字,并且将数字部分捕获为分组。 - 使用
re.findall()函数在字符串data中查找所有匹配的结果。 - 如果找到了匹配的时间戳,将其转换为整数类型,并打印出来。如果没有找到匹配的时间戳,则打印"No timestamp found."
原文地址: https://www.cveoy.top/t/topic/iqLy 著作权归作者所有。请勿转载和采集!