Description
^((?:[0-9]{2}[-\/:.]){5}[0-9]{6}).*[{]TCP[}]\s*(((?:[0-9]{1,3}[.]){1,3}[0-9]{1,3}):([0-9]{1,6}))\s*->\s*(((?:[0-9]{1,3}[.]){1,3}[0-9]{1,3}):([0-9]{1,6}))

** To see the image better, simply right click the image and select view in new window
This regular expression will do the following:
- Captures the timestamp into capture group 1
- Captures the source IP address and port into capture groups 2, 3, 4
- Captures the destination IP address and port into capture groups 5, 6, 7
- requires the IP source and destination to be proceeded by
{TCP}
incase the message also contains an IP address.
Example
Live Demo
https://regex101.com/r/hD4fW8/1
Sample text
03/09-14:10:43.323717 [**] [1:2008015:9] ET MALWARE User-Agent (Win95) [**] [Classification: A Network Trojan was detected] [Priority: 1] {TCP} 172.16.116.194:28692 -> 205.181.112.65:80
Sample Matches
MATCH 1
1. [0-21] `03/09-14:10:43.323717`
2. [145-165] `172.16.116.194:28692`
3. [145-159] `172.16.116.194`
4. [160-165] `28692`
5. [169-186] `205.181.112.65:80`
6. [169-183] `205.181.112.65`
7. [184-186] `80`
Explanation
NODE EXPLANATION
----------------------------------------------------------------------
^ the beginning of the string
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
(?: group, but do not capture (5 times):
----------------------------------------------------------------------
[0-9]{2} any character of: '0' to '9' (2 times)
----------------------------------------------------------------------
[-\/:.] any character of: '-', '\/', ':', '.'
----------------------------------------------------------------------
){5} end of grouping
----------------------------------------------------------------------
[0-9]{6} any character of: '0' to '9' (6 times)
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
.* any character except \n (0 or more times
(matching the most amount possible))
----------------------------------------------------------------------
[{] any character of: '{'
----------------------------------------------------------------------
TCP 'TCP'
----------------------------------------------------------------------
[}] any character of: '}'
----------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
( group and capture to \2:
----------------------------------------------------------------------
( group and capture to \3:
----------------------------------------------------------------------
(?: group, but do not capture (between 1
and 3 times (matching the most amount
possible)):
----------------------------------------------------------------------
[0-9]{1,3} any character of: '0' to '9'
(between 1 and 3 times (matching the
most amount possible))
----------------------------------------------------------------------
[.] any character of: '.'
----------------------------------------------------------------------
){1,3} end of grouping
----------------------------------------------------------------------
[0-9]{1,3} any character of: '0' to '9' (between
1 and 3 times (matching the most
amount possible))
----------------------------------------------------------------------
) end of \3
----------------------------------------------------------------------
: ':'
----------------------------------------------------------------------
( group and capture to \4:
----------------------------------------------------------------------
[0-9]{1,6} any character of: '0' to '9' (between
1 and 6 times (matching the most
amount possible))
----------------------------------------------------------------------
) end of \4
----------------------------------------------------------------------
) end of \2
----------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
-> '->'
----------------------------------------------------------------------
\s* whitespace (\n, \r, \t, \f, and " ") (0 or
more times (matching the most amount
possible))
----------------------------------------------------------------------
( group and capture to \5:
----------------------------------------------------------------------
( group and capture to \6:
----------------------------------------------------------------------
(?: group, but do not capture (between 1
and 3 times (matching the most amount
possible)):
----------------------------------------------------------------------
[0-9]{1,3} any character of: '0' to '9'
(between 1 and 3 times (matching the
most amount possible))
----------------------------------------------------------------------
[.] any character of: '.'
----------------------------------------------------------------------
){1,3} end of grouping
----------------------------------------------------------------------
[0-9]{1,3} any character of: '0' to '9' (between
1 and 3 times (matching the most
amount possible))
----------------------------------------------------------------------
) end of \6
----------------------------------------------------------------------
: ':'
----------------------------------------------------------------------
( group and capture to \7:
----------------------------------------------------------------------
[0-9]{1,6} any character of: '0' to '9' (between
1 and 6 times (matching the most
amount possible))
----------------------------------------------------------------------
) end of \7
----------------------------------------------------------------------
) end of \5
----------------------------------------------------------------------