I am trying to parse the results of the TSHARK capture
Here is the line I am filtering on:
Internet Protocol, Src: 10.10.52.250 (10.10.52.250), Dst: 224.0.0.2 (224.0.0.2)
I am trying to extract the Src and Dst,
Here is my code to do that:
str(re.search("Src:\s[0-9\.]{7-15}", a, re.I|re.M).group())[5:]
str(re.search("Dst:\s[0-9\.]{7-15}", a, re.I|re.M).group())[5:]
I keep getting no match when I run this, but when I use the exact length of the IP address in the regular expression it works. ie
str(re.search("Src:\s[0-9\.]{9}", a, re.I|re.M).group())[5:]
Works just fine. How do I fix this problem?