VBoxPortForwarding.py revision e64031e20c39650a7bc902a3e1aba613b9415dee
#
# Copyright (C) 2009 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
#################################################################################
# This program is a port-forwarding configurator supposed to simplify
# port-forwarding for NAT users
# > python VBoxPortForwarding.py --vm winXP -a 1 -p TCP -l 8080 -g 80 -P www
# generates sequence of API calls, equivalent to:
# > VBoxManage setextradata "winXP"
# > VBoxManage setextradata "winXP"
# > VBoxManage setextradata "winXP"
################################################################################
from vboxapi import VirtualBoxManager
import optparse
return True
return True
return False
usage = "usage: %prog --vm winXP -a 1 -p TCP -l 8080 -g 80 -P www"
default=None)
default=None)
default = -1)
default = -1)
default=-1)
man = VirtualBoxManager(None, None)
vm = None
try:
except:
del man
return
del man
return
name = None
print "none adapter type detected"
return -1
name = "pcnet"
name = "pcnet"
name = "e1000"
name = "e1000"
name = "e1000"
print "adapter of '%s' type has been detected" % name
if profile_name == None:
del man
if __name__ == "__main__":