Last active
August 24, 2018 15:43
-
-
Save mjdorma/9045130 to your computer and use it in GitHub Desktop.
pyvbox: Capture network traffic from adapter.
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() | |
# 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