python 正则表达式
2017-12-06 12:26
302 查看
(1)的正则表达式查找如下字符串中,sid:900001这个字符串
alert tls any any -> any any (msg:”Source Test2”; tls.fingerprint:”2b:0a:76:17:8c:be:81:a7:c1:76:27:fd:36:15:da:09:0c:74:78:99”;sid:9000001;rev:1;)
(1)的正则表达式查找如下字符串中,括号内字符串:(msg:”Source Test2”; tls.fingerprint:”2b:0a:76:17:8c:be:81:a7:c1:76:27:fd:36:15:da:09:0c:74:78:99”;sid:9000001;rev:1;)
alert tls any any -> any any (msg:”Source Test2”; tls.fingerprint:”2b:0a:76:17:8c:be:81:a7:c1:76:27:fd:36:15:da:09:0c:74:78:99”;sid:9000001;rev:1;)
(1)的正则表达式查找如下字符串中,括号内字符串:(msg:”Source Test2”; tls.fingerprint:”2b:0a:76:17:8c:be:81:a7:c1:76:27:fd:36:15:da:09:0c:74:78:99”;sid:9000001;rev:1;)
def add_custom_rules(request): frule = open('rules/aaa.txt') content = frule.readlines() max_sid = 0 for line in content: try: #print line #(1) strsid = re.search('sid:9[0-9]{6}', line).group() #2 rmsg = re.findall('\((.*?)\)', line)[0] sidflag,sid = strsid.split(':') if max_sid < int(sid): max_sid = int(sid) except: pass #print("no custom rules")
相关文章推荐
- python使用正则表达式提取网页URL的方法
- python 中的使用re 正则表达式处理文字
- Python正则表达式过滤或者替换HTML标签的方法
- python re正则表达式模块(Regular Expression)
- python 爬虫(正则表达式案例)
- Python正则表达式匹配中文
- Python 正则表达式删除非<em><strong>的其它<xml> tag
- 更强大的python正则表达式模块 -- regex
- Python正则表达式指南
- 正则表达式 & Python正则表达式操作指南
- Python3 正则表达式特殊符号及用法(详细列表)
- Python3 正则表达式
- python爬虫学习---正则表达式的使用
- 正则表达式(Python)
- Python正则表达式指南
- python 正则表达式介绍
- Python正则表达式
- 正则表达式---A bytes of python
- Python之re模块 —— 正则表达式操作
- python 3.6 正则表达式的应用(附实例代码)