Commit bf0c8a28 authored by Cool Fire's avatar Cool Fire

Changed pfctl parsing for new output format of 'pfctl -ss'

parent dc49e3cf
......@@ -55,12 +55,12 @@ end
# Look up function for NAT table
def natlookup( p1, p2 )
# Execute shell command to get NAT table
nattable = %x(pfctl -ss | egrep '(>.*>|<.*<)')
nattable = %x( pfctl -ss | grep "\(" )
# Search NAT table for matching enties
if( nattable =~ /tcp (.+):(.+) -> (.+):#{p1} -> (.+):#{p2} / )
server = $1
p1 = $2.to_i
if( nattable =~ /tcp (.+):#{p1} \((.+):(.+)\) -> (.+):#{p2} / )
server = $2
p1 = $3.to_i
return [server, p1, p2]
else
return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment