Skip to content

Instantly share code, notes, and snippets.

@mjdorma
Last active August 24, 2018 15:43
Show Gist options
  • Save mjdorma/9045130 to your computer and use it in GitHub Desktop.
Save mjdorma/9045130 to your computer and use it in GitHub Desktop.
pyvbox: Capture network traffic from adapter.
"""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()
# Capture network traffic for 60 seconds.
adapter = session.machine.get_network_adapter(0)
adapter.trace_file = os.path.abspath('mycapture.pcap')
adapter.trace_enabled = True
time.sleep(60)
adapter.trace_enabled = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment