Skip to content

Instantly share code, notes, and snippets.

@fahadsadah
Created March 27, 2010 19:35
Show Gist options
  • Save fahadsadah/346307 to your computer and use it in GitHub Desktop.
Save fahadsadah/346307 to your computer and use it in GitHub Desktop.
OpenVPN CLIENT LIST
Updated,Sat Mar 27 19:35:56 2010
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
somebody,84.237.99.16:4324,631428,703980,Fri Mar 26 12:19:51 2010
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
10.156.210.6,somebody,84.237.99.16:4324,Fri Mar 26 12:19:54 2010
GLOBAL STATS
Max bcast/mcast queue length,0
END
file = File.new("/etc/openvpn/openvpn-status.log")
people = 0
while (line = file.gets) do
if people == 1 then
people = 0 if line == "ROUTING TABLE\n"
print line.split(",")[0] + "\n" unless line == "ROUTING TABLE\n"
else
people = 1 if line == "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment