A command-line tool for managing QEMU virtual machines created through Syzkaller's create-image.sh.
Project description
syzqemuctl
A command-line tool for managing QEMU virtual machines created through Syzkaller's `create-image.sh`.
Features
- Easy VM creation and management
- Automated template image creation using syzkaller's create-image.sh
- SSH and file transfer support
- Command execution in VMs
- Screen session management for VM console access
See details in Usage section :)
Change Log
- 0.1.0: 2025-01-16
- Initial release (BUG: entry_point is wrong)
- 0.1.1: 2025-01-16
- Update README.md (BUG: entry_point is wrong)
- 0.1.2: 2025-01-17
- Fix bug of entry point (CLI USABLE NOW!)
- 0.1.3: 2025-01-17
- Add badges
- 0.1.4: 2025-01-20
- Fix the inconsistencies of README and code (API USABLE NOW!)
- 0.1.5: 2025-01-21
- Complete vm.wait_until_ready and update README
- 0.1.6: 2025-01-21
- Move infos to _version.py to solve the installation dependency problem
Installation
pip install syzqemuctl
Requirements
python3.8+ qemu screen ssh
Configuration
The configuration file is stored in ~/.config/syzqemuctl/config.json. It contains:
- Images home directory path
- Default VM settings
Usage
⭐ As a command-line tool (CLI)
- Initialize syzqemuctl:
syzqemuctl init --images-home /path/to/images
- Create a new VM:
syzqemuctl create my-vm
- Run the VM:
syzqemuctl run my-vm --kernel /path/to/kernel
- Check VM status:
syzqemuctl status my-vm
- Copy files to/from VM:
syzqemuctl cp local-file my-vm:/remote/path # Copy to VM
syzqemuctl cp my-vm:/remote/file local-path # Copy from VM
- Execute commands in VM:
syzqemuctl exec my-vm "uname -a" # You'd better wrap the command with double quotes
- Stop the VM:
syzqemuctl stop my-vm
- List all VMs:
syzqemuctl list
⭐ As a Python package (API)
from syzqemuctl import ImageManager, VM
manager = ImageManager("/path/to/images_home")
manager.initialize()
manager.create("my-vm")
# Or just direct specify a created VM and
vm = VM("/path/to/images_home/my-vm")
vm.start(kernel="/path/to/kernel")
# Wait several minutes for the VM to be ready, or you can check by:
if vm.is_ready():
pass
# Or use this API to wait:
if vm.wait_until_ready(timeout=180, interval=60):
pass
# You need to use this context manager to auto-connect/disconnect
with vm:
vm.copy_to_vm("/path/to/local/file", "/path/to/vm/remote/file")
stdout, stderr = vm.execute("uname -a")
print(f"stdout: {stdout}\nstderr: {stderr}")
License
Apache-2.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
syzqemuctl-0.1.6.tar.gz
(12.0 kB
view details)
File details
Details for the file syzqemuctl-0.1.6.tar.gz.
File metadata
- Download URL: syzqemuctl-0.1.6.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd65f4ea1ede40d71b23ba3af836d3998af61dd55e3a82becb6c04f334189528
|
|
| MD5 |
e15c0da9daa531a676539af00d43dd64
|
|
| BLAKE2b-256 |
fd1b60ced4732d15f61196cea91b3cdd14ce04ed4d0a08190cc0159bff0772d6
|