Virtual Machines are very useful when doing security/Operating System research. Below are some commandline strings that are useful when working with Virtualbox:

To create/set up a VM:

 VBoxManage createvm --name "Windows XP" --register
VBoxManage modifyvm "Windows XP" --memory 512--acpi on
VBoxManage createhd --remember --format VHD --filename "Windows XP.vhd" --size 20000
VBoxManage storagectl "Windows XP" --name "IDE Controller" --add ide --controller PIIX4
VBoxManage modifyvm "Windows XP" --hda "Windows XP.vhd"
VBoxManage openmedium dvd ~/Windows\ XP.iso
VBoxManage modifyvm "Windows XP" --dvd ~/Windows\XP.iso
VBoxHeadless --startvm "Windows XP" -vrdpport 3389&

VBoxManage controlvm "Windows XP" dvdattach none     //detach media from VM
VBoxManage openmedium/closemedium dvd ~/Windows\ 7.iso     //unregister disk image with VBox server
VBoxManage controlvm "Windows XP" poweroff/reset/acpipowerbutton     //change power state of VM
VBoxManage snapshot DC1 discardcurrent --state     //discard a VM state and revert to previous snapshot
VBoxManage clonehd DC1.vhd DC2.vhd     //clone a hdd

VBoxManage convertdd hda.img hda.vdi     //convert a raw dd'ed image to a vdi disk

VBoxManage modifyvm DC1 --nic1 bridged
insert VBoxGuestAdditions.iso
***make sure the tun and p8022 kernel modules are loaded and change a line in the .VirtualBox/Machines/<Machine name>.xml file: <BridgedInterface name=""/> -> <BridgedInterface name="eth0"/>***

VBoxManage showvminfo victim     //show info about a vm
VBoxManage showhdinfo victim.vhd     //show info about a hard disk

ctrl+alt+end send ctrl+alt+del to VM

To savestate and resume:

 VBoxManage controlvm DC1 savestate
VBoxHeadless --startvm "DC1"&

To attach a host dvd(make sure nonroot has read access to /dev/sr0):

VBoxManage storageattach Utilities2 --type dvddrive --type dvddrive --port 1 --device 0 --storagectl "IDE Controller" --medium host:/dev/cdrom

By: Neil Sikka

Posted On : 2011/03/16


Recent Posts


Blog Archive

WordPress Lightbox