Assuming that you are referring to the VPN service registered in the network settings, AppleScript, in particular System Network Network Preferences Suite, will work:
tell application "System Events"
tell current location of network preferences
get name of every service whose (kind is greater than 11 and kind is less than 16) and connected of current configuration is true
end tell
end tell
If you need to access this from the shell, osascript -eyour friend (one -eoption in the AppleScript line, pay attention to the quote and escaping - see man osascript).
source
share