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
# | |
# patch adb to: | |
# 1. use busybox to set the same terminal size | |
# 2. change directory to /data/local/tmp automatically | |
# | |
# NOTE: needs an executable busybox in /data/local/tmp | |
# | |
# Joshua J. Drake - jduck | |
# |
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
"""pyvbox: setup appliance description and import_machines. | |
""" | |
import virtualbox | |
vbox = virtualbox.VirtualBox() | |
# Create new IAppliance and read the exported machine | |
# called 'ubuntu'. | |
appliance = vbox.create_appliance() | |
appliance.read("~/Documents/ubuntu.ova") |
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
"""pyvbox: Rename virtual machine. | |
""" | |
import virtualbox | |
vbox = virtualbox.VirtualBox() | |
vm = vbox.find_machine('oldname') | |
# Option #1 | |
session = vm.create_session() | |
session.machine.name = 'newname' |
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
"""Assert a choice for the value of an argument. | |
Example:: | |
@begin.start | |
@choices(foo=['meh', 'one']) | |
def main(foo): | |
print(foo) | |
""" |
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
""" | |
Run a series of subcommands from the script file. | |
""" | |
import shlex | |
import begin | |
import __main__ | |
@begin.subcommand | |
@begin.convert(script=begin.utils.tofile()) | |
def script(script): |
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
"""pyvbox: Register for decoded keystrokes | |
The following code will print key press events from the guest | |
VM to the host's stdout. | |
""" | |
import sys | |
import virtualbox | |
vbox = virtualbox.VirtualBox() | |
m = vbox.find_machine("win7") |
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
"""pyvbox: Video capture to file. | |
""" | |
import os | |
import time | |
import virtualbox | |
# Assume machine is already running. | |
vbox = virtualbox.VirtualBox() | |
machine = vbox.find_machine("win7") | |
session = machine.create_session() |
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
"""pyvbox: Capture network traffic from adapter. | |
""" | |
import os | |
import time | |
import virtualbox | |
# Assume machine is already running. | |
vbox = virtualbox.VirtualBox() | |
machine = vbox.find_machine("win7") | |
session = machine.create_session() |
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
"""pyvbox: How to copy a file from a VM. | |
""" | |
import os | |
import virtualbox | |
# Assume machine is already running. | |
vbox = virtualbox.VirtualBox() | |
machine = vbox.find_machine("win7") | |
session = machine.create_session() |
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
"""pyvbox:How to set the attachment_type of a network adapter. | |
""" | |
import virtualbox | |
from virtualbox.library import NetworkAttachmentType | |
# Option 1 | |
vbox = virtualbox.VirtualBox() | |
machine = vbox.find_machine('test_vm') | |
session = machine.create_session() |
NewerOlder