Forked from andre1810/list_vagrant_port_forwardings.rb
Last active
March 22, 2017 21:16
-
-
Save lsloan/46bd44445003f1f873b3a34e97c7088a to your computer and use it in GitHub Desktop.
List Port Forwardings of vagrant machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vm_infos = `vboxmanage list vms` | |
puts 'Port Forwardings:' | |
puts '---------------------------------' | |
vm_infos.each_line do |vm_info| | |
vm_name = vm_info.scan(/\"(.*)\"/) | |
vm_id = vm_info.scan(/.*{(.*)}/).join('') | |
vm_detail_info = `vboxmanage showvminfo #{vm_id}` | |
puts vm_name | |
puts vm_detail_info.scan(/NIC [0-9] Rule\([0-9]\):\s*(.*)/) | |
puts '---------------------------------' | |
end | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment