VBoxPortForwarding.py revision 82bcaaf8077ba892f39afb721dca149353c63d2c
#
# Copyright (C) 2009 Sun Microsystems, Inc.
#
# 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.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 USA or visit http://www.sun.com if you need
# additional information or have any questions.
#
#################################################################################
# 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__":