you are spot on with this script by the looks.
With that script you get access to these objects.
VclNetworkConfigSection
VclNetworkConfiguration
From there you can hook the
VclRouterInfo object and you should be good to go.
VclRouterInfo.externalIp looks like the culprit you are after.