1
我需要微调下面的正则表达式。现在它给了我srcip,dstip,srcport,dstport和日期。我需要它也给我的协议(UDP,TCP)。下面是它需要解析线:Python的正则表达式解析器
03/09-13:00:59.136048 [**] [1:2003410:9] ET POLICY FTP Login Successful [**] [Classification: Misc activity] [Priority: 3] {TCP} 172.16.112.100:21 -> 206.48.44.18:1039
这里是我当前的正则表达式:
([0-9/]+)-([0-9:.]+)\s+.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})\s+->\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})
此外,它需要能够处理没有与之相关联的端口的请求(如ICMP) :
03/09-13:57:26.523602 [**] [1:2100368:7] GPL ICMP_INFO PING BSDtype [**] [Classification: Misc activity] [Priority: 3] {ICMP} 172.16.114.50 -> 172.16.112.207